Skip to content

Instantly share code, notes, and snippets.

@itorres
itorres / getopt.py
Created October 1, 2014 02:46
YAPOP (Yet Another Python Option Parser)
def getopt(wat,default=None):
"""
getopt("flag") returns a bool
getopt("flag","default value") returns the next item in the argument list
Examples:
when calling "script -f filename":
getopt("-f","defaultname") would return "filename"
getopt("-v") would return False
when calling "script -v":
@itorres
itorres / solarize_gnome_terminal
Created August 6, 2013 16:41
Configure Solarized (http://ethanschoonover.com/solarized) in Gnome Terminal 3.8
#!/usr/bin/env ruby
#
# Configure Solarized (http://ethanschoonover.com/solarized) in
# Gnome Terminal 3.8
#
# Hacked away in a lazy summer afternoon by http://ignacio.torresmasdeu.name/
profile_dir="/org/gnome/terminal/legacy/profiles"
default_profile=`gsettings get org.gnome.Terminal.ProfilesList default`.strip.delete("'")
@itorres
itorres / ssha.js
Created June 18, 2012 06:10
node.js ssha hash generation and check functions intended for use with LDAP servers.
var crypto = require('crypto');
/*
* node.js ssha hash generation and check functions intended for use with LDAP servers.
*/
function ssha(cleartext, salt) {
var sum = crypto.createHash('sha1');
( typeof(salt) == 'undefined') ? salt = new Buffer(crypto.randomBytes(20)).toString('base64') : salt = salt;
sum.update(cleartext);