Skip to content

Instantly share code, notes, and snippets.

View gist:4000306
# search and browse manpages interactively
function woman {
err="usage: $FUNCNAME [object]"
test $# -ne 1 && echo $err && return 1
IFS=$'\n' manpgs=( $(apropos $1 | grep ^$1) )
select line in ${manpgs[@]}; do
n=${line%%) *}; n=${n#* (}
man ${n} ${line%% *}
return 0
@htor
htor / makaroni.c
Last active Oct 12, 2015
makaroni-suppe
View makaroni.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* function aliases */
#define talk printf
#define die talk
#define space calloc
/* keywords */
View harmonic.c
int main(t) {
for(t=0;;t++)putchar(
t*5&(t>>7)|t*3&(t*4>>10)
);}
View lambda.rkt
(define rember
(lambda (a lat)
(cond
((null? lat) lat)
((eq? (car lat) a) (cdr lat))
(else (cons (car lat) (rember a (cdr lat)))))))
(define (rember2 a lat)
(cond
((null? lat) lat)
@htor
htor / huff.scm
Created Feb 26, 2013
Riktig-ish?
View huff.scm
(define (grow-huffman-tree pairs)
(define (make-tree leaf-set)
(cond
((null? leaf-set) '()) ; no element
((null? (cdr leaf-set)) (car leaf-set)) ; one element
(else ; two elements
(let ((first (car leaf-set))
(second (cadr leaf-set))
(rest (cddr leaf-set)))
(if (null? rest)
@htor
htor / test
Created Oct 23, 2013
For diffing log files.
View test
#!/usr/bin/env bash
#
# test: diff logs against reference compiler logs
# usage: test [parser|scanner] [all|file] [log|res]
#
source_files=( easter float-opers gcd heron medium micro mini next opers primes strings wrong )
mod_test=$1
ext=$3
View bpm-detect.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="https://unpkg.com/bpm-detective@2.0.1/dist/bpm-detective.js" charset="utf-8"></script>
<script>
let context = new AudioContext();
fetch("01 Xtal.mp3")
.then(response => response.arrayBuffer())
@htor
htor / lower.js
Created Jun 20, 2018
node transform stream
View lower.js
const { Transform } = require('stream')
const ts = Transform({ decodeStrings: false })
ts._write = (chunk, enc, next) => {
ts.push(chunk.toUpperCase())
next()
}
process.stdin.setEncoding('utf8')
process.stdin.pipe(ts).pipe(process.stdout)
@htor
htor / package.json
Last active Jul 16, 2018
portable (verbose) package.json
View package.json
{
"name": "portable-npm-scripts",
"version": "0.0.2",
"private": true,
"dependencies": { ... },
"devDependencies": {
"babel-core": "^6.26.0",
"babel-preset-env": "^1.6.1",
"babelify": "^8.0.0",
"browserify": "^14.5.0",
@htor
htor / schelp.ohm
Last active Oct 2, 2019
grammar for supercollider help files written in ohm-grammar
View schelp.ohm
SCHelp {
Document = (Element|Text)+
Element
= Class
| Title
| Summary
| Related
| Redirect
| Categories
You can’t perform that action at this time.