A ZSH theme optimized for people who use:
- Solarized
- Git
- Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)
For Mac users, I highly recommend iTerm 2 + Solarized Dark
| import smtplib | |
| from email.MIMEMultipart import MIMEMultipart | |
| from email.MIMEText import MIMEText | |
| def sendmail(message, subject='subject', username='username', password='password', address='reciever'): | |
| msg = MIMEMultipart() | |
| msg['From'] = username | |
| msg['To'] = address | |
| msg['Subject'] = subject | |
| msg.attach(MIMEText(message, 'plain')) |
| import mechanize | |
| import cookielib | |
| # Browser | |
| br = mechanize.Browser() | |
| # Cookie Jar | |
| cj = cookielib.LWPCookieJar() | |
| br.set_cookiejar(cj) |
| class _Singleton(type): | |
| _instances = {} | |
| def __call__(cls, *args, **kwargs): | |
| if cls not in cls._instances: | |
| cls._instances[cls] = super(_Singleton, cls).__call__(*args, **kwargs) | |
| return cls._instances[cls] | |
| class Singleton(_Singleton('SingletonMeta', (object,), {})): pass |
| class MetaCommand(type): | |
| def __new__(meta, name, bases, dct): | |
| print '-----------------------------------' | |
| print "Allocating memory for class", name | |
| print meta | |
| print bases | |
| print dct | |
| return super(MetaCommand, meta).__new__(meta, name, bases, dct) | |
| def __init__(cls, name, bases, dct): | |
| print '-----------------------------------' |
| #!/bin/bash | |
| mkdir -p /home/mshuff | |
| chown mshuff:mshuff /home/mshuff | |
| usermod -d /home/mshuff mshuff |
| var flattenObject = function(ob) { | |
| var toReturn = {}; | |
| for (var i in ob) { | |
| if (!ob.hasOwnProperty(i)) continue; | |
| if ((typeof ob[i]) == 'object') { | |
| var flatObject = flattenObject(ob[i]); | |
| for (var x in flatObject) { | |
| if (!flatObject.hasOwnProperty(x)) continue; |
| # Apache .htaccess | |
| # angularjs pushstate (history) support: | |
| # See http://www.josscrowcroft.com/2012/code/htaccess-for-html5-history-pushstate-url-routing/ | |
| <ifModule mod_rewrite.c> | |
| RewriteEngine On | |
| RewriteCond %{REQUEST_FILENAME} !-f | |
| RewriteCond %{REQUEST_FILENAME} !-d | |
| RewriteCond %{REQUEST_URI} !index | |
| RewriteRule (.*) index.html [L] |
| console.oldLog = console.log; | |
| console.log = function(value) { | |
| console.oldLog(value); | |
| window.$log = value; | |
| }; |