Skip to content

Instantly share code, notes, and snippets.


David Moreno Montero davidmoreno

View GitHub Profile
davidmoreno /
Last active Mar 29, 2021
Watches a diretory and runs a command on save changes.
if [ ! "$1" ]; then
cat << EOF
$0 -- Watch a directory and run a command on changes
$0 cmd options
Environmental vars:
davidmoreno /
Last active Oct 28, 2018
Script to change database column names on Sqlite3 databases.
#!/usr/bin/env python
import os, sys, subprocess, re
if len(sys.argv)==1:
print "Usage:"
print " %s <databasefile> <tablename,tablename2,...> <origcolumn> <destcolumn> [--apply]"%sys.argv[0]
print "Options (must appear at the end):"
print " --apply Apply the changes directly to database file"
View gist:5264730
// Compile it with:
// $ gcc -o bench bench.c -lonion -Wall -O2 -lsqlite3
// $ export ONION_LOG=noinfo # To properly test, you may need some control over logging. Here almost disabled.
// $ ./bench
// It listens to localhost:8080, known addresses: http://localhost:8080/ , http://localhost:8080/db , http://localhost:8080/db20
// Test it with ab:
// $ ab -k -t 10 -c 20 http://localhost:8080/
// It gave me (Intel(R) Core(TM) i7-2677M CPU @ 1.80GHz):
// Requests per second: 58288.10 [#/sec] (mean)