Skip to content

Instantly share code, notes, and snippets.


Loisaida Sam loisaidasam

View GitHub Profile
munificent / generate.c
Last active Apr 17, 2019
A random dungeon generator that fits on a business card
View generate.c
#include <time.h> // Robert Nystrom
#include <stdio.h> // @munificentbob
#include <stdlib.h> // for Ginny
#define r return // 2008-2019
#define l(a, b, c, d) for (i y=a;y\
<b; y++) for (int x = c; x < d; x++)
typedef int i;const i H=40;const i W
=80;i m[40][80];i g(i x){r rand()%x;
}void cave(i s){i w=g(10)+5;i h=g(6)
+3;i t=g(W-w-2)+1;i u=g(H-h-2)+1;l(u
johnhw /
Last active Mar 20, 2019
1 million prime UMAP layout
### JHW 2018
import numpy as np
import umap
# This code from the excellent module at:
import random
threepointone / box.js
Last active Sep 20, 2017
react-motion + react-vr
View box.js
/* @flow */
import React from 'react';
import { Motion, spring } from 'react-motion';
import {
} from 'react-vr';
from num2words import num2words
from matplotlib import pyplot
lang = 'de'
words = [num2words(i, lang=lang) for i in range(1000000)]
fig = pyplot.figure()
ax = fig.add_subplot(111)
ax.semilogx([len(word) for word in words], color='green')
aparrish / understanding-word-vectors.ipynb
Last active Apr 18, 2019
Understanding word vectors: A tutorial for "Reading and Writing Electronic Text," a class I teach at ITP. (Python 2.7) Code examples released under CC0, other text released under CC BY 4.0
View understanding-word-vectors.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Creating a redis Module in 15 lines of code!

A quick guide to write a very very simple "ECHO" style module to redis and load it. It's not really useful of course, but the idea is to illustrate how little boilerplate it takes.

Step 1: open your favorite editor and write/paste the following code in a file called module.c

#include "redismodule.h"
/* ECHO <string> - Echo back a string sent from the client */
int EchoCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
rauchg /
Last active Mar 25, 2019
subfuzion /
Last active Apr 18, 2019
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

jdp /
Created Feb 10, 2016
Serve directory listing kinda like a GitHub project page
#!/usr/bin/env python
import cgi
import os
import mistune
from SimpleHTTPServer import SimpleHTTPRequestHandler
from SocketServer import TCPServer
from cStringIO import StringIO
View timespec.yacc
* Abbreviated version of the yacc grammar used by at(1).
%token <charval> DOTTEDDATE
%token <charval> HYPHENDATE
%token <charval> HOURMIN
%token <charval> INT1DIGIT
%token <charval> INT2DIGIT
%token <charval> INT4DIGIT
You can’t perform that action at this time.