Skip to content

Instantly share code, notes, and snippets.

@mmozeiko
mmozeiko / MagicRingBuffer.h
Last active October 15, 2024 22:28
Magic RingBuffer for Windows, Linux and macOS
#pragma once
//
// Magic Ring Buffer
// https://gist.github.com/mmozeiko/3b09a340f3c53e5eaed699a1aea95250
//
// Sets up memory mapping so the same memory block follows itself in virtual address space:
//
// [abcd...xyz][abc...xyz]
//
@samselikoff
samselikoff / use-state.code-snippets
Last active October 15, 2024 22:27
A VSCode snippet that lets you type `ush` to define some new React state.
{
"Use state": {
"scope": "javascriptreact,typescriptreact",
"prefix": "ush",
"body": [
"let [${1}, set${1/(.*)/${1:/capitalize}/}] = useState($2);",
],
"description": "useState()"
}
}
@jackrusher
jackrusher / trinity.js
Created March 29, 2021 09:23
A fast, minimal JS triple store implementation in ~70 lines of code
// three indices to efficiently support all lookups
function createDB() {
return {eav: new Map(),
ave: new Map(),
vea: new Map()};
}
function addToIndex(xs, x, y, z, triple) {
let ys = xs.get(x);
if(ys == undefined) {
@yelouafi
yelouafi / multishot-callcc.js
Created September 21, 2018 17:05
multi shot continuations
function isGenerator(x) {
return x != null && typeof x.next === "function"
}
function isFrame(x) {
return x != null && x._type_ === 'call_frame'
}
function call(genFunc, ...args) {
@joshuabaker
joshuabaker / languages.json
Last active October 15, 2024 22:22
List of languages with ISO 639-1 Alpha-2 codes in JSON.
[
{
"code": "aa",
"name": "Afar",
"native": "Afar"
},
{
"code": "ab",
"name": "Abkhazian",
"native": "Аҧсуа"

Terraforming API Gateway to SQS queue

Example of a bare-minimum terraform script to setup an API Gateway endpoint that takes records and puts them into an SQS queue.

SQS

Start by creating the SQS queue.

resource "aws_sqs_queue" "queue" {
@Soheab
Soheab / API's.md
Last active October 15, 2024 22:18
See here some of the API's you can use in your discord bot or anything

Some API's for you.

See here some of the API's you can use in your discord bot or anything. For any help or questions on how to use one, please contact the owner of the API and not me.

A much bigger list of APIs can be found here


[TOKEN] = API requires a token to access some if not all endpoints.

The descriptions are mostly copied from the API, sometimes personal or from the dev.

@dannguyen
dannguyen / wget-snapshotpage.md
Last active October 15, 2024 22:18
Use wget to snapshot a page and its necessary visual dependencies

Use wget to mirror a single page and its visible dependencies (images, styles)

Money graphic via State of Florida CFO Vendor Payment Search

Graphic via State of Florida CFO Vendor Payment Search (flair.myfloridacfo.com)

This is a quick command I use to snapshot webpages that have a fun image I want to keep for my own collection of WTFViz. Why not just right-click and save the image? Oftentimes, the webpage in which the image is embedded contains necessary context, such as captions and links to important documentation just incase you forget what exactly that fun graphic was trying to explain.

@SpoddyCoder
SpoddyCoder / fix-kube-prometheus-stack-on-docker-dekstop-for-mac.md
Created February 26, 2024 11:07
Kube-Prometheus-Stack on Docker Desktop for Mac (Sonoma 14.3 + Docker Desktop 4.27)

Kube-Prometheus-Stack on Docker Desktop for Mac (Sonoma 14.3 + Docker Desktop 4.27)

Initial Setup - reconfigure docker-desktop to expose metrics endpoints