View cow.c
// A Lua module written in C.
// This module enables terminal-based ASCII art
// of a loquacious bovine nature.
#include <stdio.h>
#include <stdlib.h>
#include "lua.h"
View lua_interp.c
// A bare-bones Lua interpreter, in C.
#include <stdio.h>
#include <string.h>
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
int main() {
import itertools, os, sys
it, chars = 20, '.-=*x#X'
w = int(os.popen('tput cols').read())
h = int(os.popen('tput lines').read()) - 1
x_max, y_max = float(w) / (2.0 * h) * 1.2, 1.2
for j in itertools.count(1):
""" A function that can read MNIST's idx file format into numpy arrays.
The MNIST data files can be downloaded from here:
This relies on the fact that the MNIST dataset consistently uses
unsigned char types with their data segments.
# A bash function to print out a table of
# colors supported by your terminal.
colortable() {
tput setaf 0
for i in $(seq 0 $(tput colors)); do
tput setab $i
printf %4d $i
View in_yo_.profile
ssfile ()
f="$(ls -1tr $HOME/Desktop/Screen*.png | tail -1)";
g=$(echo $f | tr ' ' _);
mv "$f" "$g";
echo $g
View [goes in your .profile]
timey() {
# Inspired by
if [ "$#" -ne 1 ]; then
echo "usage: timey <number of minutes>"
seconds=$(( $1 * 60 ))
((sleep $seconds; open -a "Google" $url) &)
View .block
license: mit
View random_subset.lua
-- This returns a sequence of k distinct indexes in the range [1, n] chosen so
-- that, within the context of the pseudorandom generator, each k-subset has an
-- equal probability of being returned.
function random_indexes(k, n)
-- This is a partial Fisher-Yates shuffle, as suggested by this answer:
local shuf = {}
local indexes = {}
for i = 1, k do
local j = math.random(i, n)
View animated_svg.html
<svg width="600" height="600" vertion="1.1"
id="svg" xmlns="">
<clipPath id="angleClip">
<polygon id="atriangle" />