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
(add-to-list 'load-path "~/.emacs-lisp") | |
;; Auto-Complete | |
(require 'anything) | |
;; Python nice-to-haves | |
(require 'lambda-mode) | |
(add-hook 'python-mode-hook #'lambda-mode 1) | |
(setq lambda-symbol (string (make-char 'greek-iso8859-7 107))) |
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
# Point end-of-life Ubuntu versions' apt source URLs to old-releases.* | |
# See: https://help.ubuntu.com/community/EOLUpgrades | |
sudo sed -i s/us.archive.ubuntu/old-releases.ubuntu/g /etc/apt/sources.list | |
sudo sed -i s/security.ubuntu/old-releases.ubuntu/g /etc/apt/sources.list | |
sudo apt-get update |
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
def foobar(a, b, c, (username, password)=(None,None)): | |
print a, b, c, username, password | |
foobar(1, 2, 3, ('hello','world')) # 1 2 3 hello world | |
foobar(1, 2, 3) # prints "1 2 3 None 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
""" | |
Copyright (c) 2012 Anthony Wu, twitter.com/anthonywu | |
Permission is hereby granted, free of charge, to any person obtaining | |
a copy of this software and associated documentation files (the | |
"Software"), to deal in the Software without restriction, including | |
without limitation the rights to use, copy, modify, merge, publish, | |
distribute, sublicense, and/or sell copies of the Software, and to | |
permit persons to whom the Software is furnished to do so, subject to | |
the following conditions: |
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
# Author: Anthony Wu | |
# A quick way to make Python enum classes. | |
# Uses range/enumerate to quickly generate a list of enumerated values, | |
# but only safe/useful for your application logic where you don't have | |
# to persist these values to a data store. | |
# Example A: hard code enum classes | |
class Fruits(object): |
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 functools | |
import pymongo | |
import logging | |
import time | |
MAX_AUTO_RECONNECT_ATTEMPTS = 5 | |
def graceful_auto_reconnect(mongo_op_func): | |
"""Gracefully handle a reconnection event.""" | |
@functools.wraps(mongo_op_func) |
NewerOlder