This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
TMP_INPUT=$(mktemp) | |
PARTS="$TMP_INPUT 1 $TMP_INPUT 2" | |
SAMPLE_RATE="${SAMPLE_RATE:=16000}" | |
N_POINTS="${N_POINTS:=64}" | |
FREQUENCIES="${FREQUENCIES:=1000,6000}" | |
halve $1 $TMP_INPUT | |
echo $PARTS | env SAMPLE_RATE=$SAMPLE_RATE N_POINTS=$N_POINTS FREQUENCIES=$FREQUENCIES \ | |
xargs -P 2 -n 2 bash -c 'amodem send -i $0.$1 -o $0.$1.raw' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import express from "express"; | |
import { graphqlHTTP } from "express-graphql"; | |
import { introspectSchema, wrapSchema } from "@graphql-tools/wrap"; | |
import { stitchSchemas } from "@graphql-tools/stitch"; | |
import { print } from "graphql"; | |
import fetch from "node-fetch"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type Getter<A, B> = (a: A) => B; | |
export type Setter<A, B> = (b: B, a: A) => A; | |
export type ProxyLensOperations<A, B> = { | |
get(a?: A): B; | |
set(b: B, a?: A): A; | |
put(b: B, a?: A): ProxyLens<A, A>; | |
mod(mod: (b: B) => B): ProxyLens<A, B>; | |
iso<C>(bcGet: Getter<B, C>, bcSet: Setter<B, C>): ProxyLens<A, C>; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export interface Lens<A, B> { | |
(a: A): B; | |
(a: A, b?: B): A; | |
} | |
export function prism<A, B>() { | |
return function (get: (a: A) => B, set: (a: A, b?: B) => A): Lens<A, B> { | |
function prismImpl(a: A): B; | |
function prismImpl(a: A, b?: B): A; | |
function prismImpl(a: A, b?: B): B | A { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Transitions<T, P> = { | |
[K in keyof Partial<T>]: ( | |
payload: P | |
) => { | |
type: keyof T & T[K]; | |
payload: P; | |
} | void; | |
}; | |
function createReducer<T, P>(transitions: Transitions<T, P>) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
class Item(models.Model): | |
title = models.CharField(max_length=128) | |
class GroupItems(models.Model): | |
group = models.ForeignKey(Group) | |
item = models.ForeignKey(Item) | |
class Group(models.Model): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FieldRoot(object): | |
def __init__(self, __id__, __parent_repr__=lambda x: x): | |
self.__id__ = __id__ | |
self.__parent_repr__ = __parent_repr__ | |
def __repr__(self): | |
return self.__parent_repr__(self.__id__) | |
def __embed__(self, child, __id__): | |
return child(__id__, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const SOLID = "SOLID"; | |
const LIQUID = "LIQUID"; | |
const GAS = "GAS"; | |
const transitions = { | |
[SOLID]: { | |
melt: LIQUID, | |
sublimate: GAS, | |
}, | |
[LIQUID]: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
// discogs2spotify <spotify-playlist-id> <start-year>-<end-year> [discogs search params] | |
const args = require("minimist")(process.argv); | |
const Spotify = require("spotify-web-api-node"); | |
const Discogs = require("disconnect").Client; | |
const Confirm = require("prompt-confirm"); | |
const Prompt = require("prompt-base"); | |
const DISCOGS_USER_TOKEN = "<DISCOGS_USER_TOKEN>"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
// requires: npm i -g get-stdin net-ping | |
// usage: ping-rng [bits?] < hosts | |
const stdin = require('/usr/local/lib/node_modules/get-stdin') | |
const ping = require('/usr/local/lib/node_modules/net-ping') | |
let sid = 0 | |
const probe = async (hosts) => { |