Skip to content

Instantly share code, notes, and snippets.

View AdrianoFerrari's full-sized avatar

Adriano Ferrari AdrianoFerrari

View GitHub Profile
import sys
import plyvel
import re
import hashlib
from Crypto.Cipher import AES
if len(sys.argv) != 4:
print "Invalid arguments. Usage is:"
print "python decrypt.py originalPath targetPath decryptKey"
exit()
--- TYPES
type alias ViewState =
{ active : String
, activePast : List String
, activeFuture : List String
, descendants : List String
, editing : Maybe String
, field : String
}
@AdrianoFerrari
AdrianoFerrari / gist:504e0d523cc3fcfee214
Created May 20, 2015 19:54
Use Prism.js to highlight code
<script>/* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+ruby&plugins=show-language */
self = (typeof window !== 'undefined')
? window // if in browser
: (
(typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope)
? self // if in worker
: {} // if in node js
);
/**
@AdrianoFerrari
AdrianoFerrari / countdown
Created May 3, 2015 10:18
Countdown to Datetime
<script>
/*
countdown.js v2.5.2 http://countdownjs.org
Copyright (c)2006-2014 Stephen M. McKamey.
Licensed under The MIT License.
*/
var module,countdown=function(y){function C(a,b){var c=a.getTime();a.setMonth(a.getMonth()+b);return Math.round((a.getTime()-c)/864E5)}function z(a){var b=a.getTime(),c=new Date(b);c.setMonth(a.getMonth()+1);return Math.round((c.getTime()-b)/864E5)}function A(a,b){b=b instanceof Date||null!==b&&isFinite(b)?new Date(+b):new Date;if(!a)return b;var c=+a.value||0;if(c)return b.setTime(b.getTime()+c),b;(c=+a.milliseconds||0)&&b.setMilliseconds(b.getMilliseconds()+c);(c=+a.seconds||0)&&b.setSeconds(b.getSeconds()+
c);(c=+a.minutes||0)&&b.setMinutes(b.getMinutes()+c);(c=+a.hours||0)&&b.setHours(b.getHours()+c);(c=+a.weeks||0)&&(c*=7);(c+=+a.days||0)&&b.setDate(b.getDate()+c);(c=+a.months||0)&&b.setMonth(b.getMonth()+c);(c=+a.millennia||0)&&(c*=10);(c+=+a.centuries||0)&&(c*=10);(c+=+a.decades||0)&&(c*=10);(c+=+a.years||0)&&b.setFullYear(b.getFullYear()+c);return b}function l(a,b){re
@AdrianoFerrari
AdrianoFerrari / tex-to-pdf
Created April 3, 2015 12:40
Node server to take Gingko Tex output into PDF
var TreeId = "your_tree_id_here";
var Filename = "output_filename";
var http =require('http');
var fs = require('fs');
var request = require('request');
var exec = require('child_process').exec;
var header = fs.readFileSync('parts/header.tex', 'utf8');
var footer = fs.readFileSync('parts/footer.tex', 'utf8');
var replacements = { '\\\\begin\\{center\\}\\\\rule\\{3in\\}\\{0\\.4pt\}\\\\end\\{center\\}': '\\hr', '\\\\section\{([^\}]*)\}\\\\label\{([^\}]*)\}\\n\\n([^\.]*[\\.\\\'\\\'\\?\\!]*)\\s': '\\finishchapter\n\\section{$1}\\label{$2}\n\\setupchapter\n\\newthought{$3} ' };