Skip to content

Instantly share code, notes, and snippets.

View vrachnis's full-sized avatar

vrachnis vrachnis

View GitHub Profile
@gillien
gillien / TextmasterApi.java
Created October 31, 2012 07:13
Access TextMaster API with different languages
//date formatting
import java.util.Date;
import java.text.SimpleDateFormat;
import java.util.TimeZone;
//http request
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.DataOutputStream;
@mmrwoods
mmrwoods / postgres
Created January 20, 2012 13:47
Postgres maintenance crontab file
# dump all databases once every 24 hours
45 4 * * * root nice -n 19 su - postgres -c "pg_dumpall --clean" | gzip -9 > /var/local/backup/postgres/postgres_all.sql.gz
# vacuum all databases every night (full vacuum on Sunday night, lazy vacuum every other night)
45 3 * * 0 root nice -n 19 su - postgres -c "vacuumdb --all --full --analyze"
45 3 * * 1-6 root nice -n 19 su - postgres -c "vacuumdb --all --analyze --quiet"
# re-index all databases once a week
0 3 * * 0 root nice -n 19 su - postgres -c 'psql -t -c "select datname from pg_database order by datname;" | xargs -n 1 -I"{}" -- psql -U postgres {} -c "reindex database {};"'
@9b
9b / jshooker.js
Created December 13, 2011 16:50
Hook JS calls for easier analysis
//preserve originals
var ori = function() {
var self = this;
this.unescape = unescape;
this.alert = alert;
this.eval = eval;
this.fromCharCode = String.fromCharCode;
this.call_unescape = function(e) {
document.write("<br>original unescape was passed data");