Skip to content

Instantly share code, notes, and snippets.

@dansouza
dansouza / keybase.md
Created September 12, 2019 03:07
keybase.md

Keybase proof

I hereby claim:

  • I am dansouza on github.
  • I am dansouza (https://keybase.io/dansouza) on keybase.
  • I have a public key whose fingerprint is 9AFF 13EB 0873 6FFB 5216 9A91 9EC2 173C 444A 5821

To claim this, I am signing this object:

@dansouza
dansouza / plus_times_table.php
Last active December 21, 2019 21:19
outputs an addition and multiplication table for kids that is shorter to memorize because it doesn't have repeated values
#!/usr/bin/php
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
# outputs an addition table for kids that is shorter to memorize because
# it doesn't have repeated values
function fill(&$table, $x, $sign, $y) {
$min = min($x, $y);
@dansouza
dansouza / gist:3757165
Created September 20, 2012 17:19
Lua prettyprinter
#!/usr/bin/env lua
-- works like PHP's print_r(), returning the output instead of printing it to STDOUT
function prettyprint(data)
-- cache of tables already printed, to avoid infinite recursive loops
local tablecache = {}
local buffer = ""
local padder = " "
local inited = 0
@dansouza
dansouza / lz4.lua
Created September 20, 2012 17:14
LuaJIT FFI LZ4
#!/usr/bin/luajit
local M = {}
local ffi = require "ffi"
ffi.cdef[[
/*
LZ4_compress() :
isize : is the input size. Max supported value is ~1.9GB
return : the number of bytes written in buffer dest
@dansouza
dansouza / extras.py
Created August 23, 2012 02:13
Quick fix on SublimeLint's extras.py Lua() and PHP() classes so that Lua uses STDIN instead of a temporary file and PHP can also catch fatal errors
# extras.py - sublimelint plugin for simple external linters
from lint.linter import Linter
import os
class Coffee(Linter):
language = 'coffeescript'
cmd = ('coffee', '--compile', '--stdio')
regex = r'^[A-Za-z]+: (?P<error>.+) on line (?P<line>\d+)'