Skip to content

Instantly share code, notes, and snippets.

View davidmoreno's full-sized avatar

David Moreno Montero davidmoreno

View GitHub Profile
@davidmoreno
davidmoreno / gist:5264730
Last active October 14, 2016 01:44
Comments to @dmoreno_cb. http://blog.coralbits.com.
// 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)
@davidmoreno
davidmoreno / sqlite_rename_column.py
Last active October 28, 2018 12:53
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
print "Options (must appear at the end):"
print " --apply Apply the changes directly to database file"
@davidmoreno
davidmoreno / watch-dir-do.sh
Last active March 29, 2021 08:27
Watches a diretory and runs a command on save changes.
#!/bin/bash
if [ ! "$1" ]; then
cat << EOF
$0 -- Watch a directory and run a command on changes
$0 cmd options
Environmental vars: