This file contains 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
# grep current directory recursively for foo | |
# case-insensitive | |
# ignore binary files | |
# show line numbers | |
# ignore svn cruft | |
# force color | |
grep -rIin --color=force foo . | grep -v svn |
This file contains 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
# Assuming your workspace is called "workspace" and at the root of your virtualenv | |
# In $WORKON_HOME/postactivate | |
############################### | |
export PREACTIVATE_PYTHONPATH=$PYTHONPATH | |
for f in $VIRTUAL_ENV/workspace/* | |
do | |
export PYTHONPATH=$PYTHONPATH:$f | |
done |
This file contains 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
""" An example of writing a decorator that takes an argument. | |
Based on e-satis's answer at http://stackoverflow.com/questions/739654/understanding-python-decorators#1594484. | |
""" | |
from functools import wraps | |
# The outer-most level is the decorator factory. The middle level is the | |
# decorator and the inner most level is where we call the decorated function. | |
def decorator_maker(buzz): |
This file contains 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
# Installs the prerequisites to set up a Django app on Heroku Cedar [2]. | |
apt-get install python-setuptools | |
apt-get install python-dev | |
easy_install pip | |
pip install virtualenvwrapper | |
apt-get install curl | |
apt-get install postgresql | |
sudo apt-get install postgresql-server-dev-9.1 |
This file contains 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
[ | |
{ "keys": ["ctrl+e"], "command": "move_to", "args": {"to": "eol"} }, | |
{ "keys": ["ctrl+a"], "command": "move_to", "args": {"to": "bol"} } | |
] |
This file contains 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
# nvidia-settings: X configuration file generated by nvidia-settings | |
# nvidia-settings: version 295.33 (buildd@allspice) Fri Mar 30 13:37:33 UTC 2012 | |
Section "ServerLayout" | |
Identifier "Layout0" | |
Screen 0 "Screen0" 0 0 | |
InputDevice "Keyboard0" "CoreKeyboard" | |
InputDevice "Mouse0" "CorePointer" | |
Option "Xinerama" "0" | |
EndSection |
This file contains 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
# http://www.voidspace.org.uk/python/mock/ | |
from mock import MagicMock | |
open_name = '%s.open' % __name__ | |
with patch(open_name, create=True) as mock_open: | |
mock_file = MagicMock(spec=file) | |
mock_file.read.return_value = 'hello' | |
mock_open.return_value.__enter__.return_value = mock_file | |
with open('/some/path', 'rU') as f: |
This file contains 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
# -*- coding: utf-8 -*- | |
import sys | |
import datetime | |
import base64 | |
import requests | |
def main(): |
This file contains 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
payload = {'html': ' <!doctype html> <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]--> <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]--> <!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]--> <!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]--> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title>Home | Linkminded</title> <meta name="description" content="Discover like minded individuals with complementing skillset to collaborate on an idea together."> <meta name="keywords" content="link, minded, like, developers, designers, entrepreneurs, startup, collaborate, collaboration, find, discover, ideas, projects"> <meta name="author" content="link-minded.com"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="shortcut icon" href="https://d1ttgy8gd6pa2l.cloudfront.net/img/favicon.fbe95e4d6cf2.ico"> |
OlderNewer