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
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
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
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
#!/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
#!/usr/bin/env bash | |
set -eu | |
SKIP_TRACKS=$((${SKIP_TRACKS:=0} + 1)) | |
while ALBUM="$1" && [ ! -z "$ALBUM" ]; do | |
find "$ALBUM" -iname "*.flac" \ | |
| sed -e 's:\(.*/\)\([^/]*\):\2 \1\2:' \ | |
| sort -n \ | |
| sed -e 's:[^/]* ::' \ |
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
--- src/coreaudio.c | |
+++ src/coreaudio.c | |
@@ -152,6 +152,7 @@ static int setup(sox_format_t *ft, int is_input) | |
for (i = 0; i < device_count; i++) | |
{ | |
char name[256]; | |
+ property_size = sizeof(name); | |
status = AudioDeviceGetProperty(devices[i],0,false,kAudioDevicePropertyDeviceName,&property_size,&name); | |
lsx_report("Found Audio Device \"%s\"\n",name); |
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 python3 | |
import os | |
import sys | |
import types | |
import struct | |
import itertools | |
import functools | |
import collections |
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
# Path | |
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" | |
# Return if non-interactive | |
case $- in | |
*i*) ;; | |
*) return;; | |
esac | |
shopt -s histappend |
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 C -m | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdint.h> | |
void deinterleave(const char *out_even_fname, const char *out_odd_fname, int bytes) | |
{ | |
int c; | |
FILE *fout_odd, *fout_even; | |
fout_odd = fopen(out_odd_fname, "wb"); |