This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ... | |
| # Some more alias to avoid making mistakes: | |
| alias rm='rm -i' | |
| alias mv='mv -i' | |
| alias cp='cp -i' | |
| alias crontab='crontab -i' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| f = open (...) | |
| for k,v in kwargs.iteritems(): | |
| f.write("%s = <%s>\n" % (str(k), str(v))) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import redis | |
| import threading | |
| class Listener(threading.Thread): | |
| def __init__(self, r, channels): | |
| threading.Thread.__init__(self) | |
| self.redis = r | |
| self.pubsub = self.redis.pubsub() | |
| self.pubsub.subscribe(channels) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class SettingsBackend(object): | |
| """ | |
| Authenticate against the settings ADMIN_LOGIN and ADMIN_PASSWORD. | |
| Use the login name, and a hash of the password. For example: | |
| ADMIN_LOGIN = 'admin' | |
| ADMIN_PASSWORD = 'sha1$4e987$xxxxx' | |
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MyClass(object): | |
| ''' Example class for the toDict method. ''' | |
| # We want these in our JSON result. | |
| place = "World" | |
| name = "Steve Jobs" | |
| # We do not want these in our JSON result. | |
| tmpdata = None | |
| connection = None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| TARGET=/usr/local/bin/mysqlsyncdb | |
| wget https://gist.github.com/philippeowagner/7485160/raw/mysqlsyncdb -O $TARGET | |
| chmod 755 $TARGET |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ... | |
| <div id="dev-warning"> | |
| dev-warning | |
| </div> | |
| ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var output = ''; | |
| for (property in objects) { | |
| output += property + ': ' + objects[property]+'; '; | |
| } | |
| alert(output); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.http import HttpResponse, iri_to_uri | |
| class HttpResponseTemporaryRedirect(HttpResponse): | |
| status_code = 307 | |
| def __init__(self, redirect_to): | |
| HttpResponse.__init__(self) | |
| self['Location'] = iri_to_uri(redirect_to) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (* | |
| Applescript to launch a diff tool to compare two notes in Evernote. | |
| Useful to compare conflicting notes | |
| 1. Place the script file in ~/Library/Scripts/Applications/Evernote | |
| 2. Ensure Applescript menu bar item is on. Option to turn on/off is under General Preferences in AppleScript Editor | |
| 3. The variable difftool can be change to any command line tool you require | |
| *) | |
| -- opendiff launches FileMerge.app developer tool |