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
from django.core.management.base import BaseCommand, CommandError | |
from django.conf import settings | |
from optparse import make_option | |
import os | |
import sys | |
import glob | |
import shutil | |
try: | |
set | |
except NameError: |
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
alias dos2unix-recursive='find . -iname '*.tpl' | xargs dos2unix' | |
alias edit='mcedit' | |
alias del='rm' | |
alias deltree='rm -r' | |
alias dir='/bin/ls $LS_OPTIONS --format=vertical' | |
alias attrib='chmod' | |
alias chdir='cd' | |
alias copy='cp' | |
alias ls='ls -a' |
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
#! /usr/bin/env python | |
""" | |
This code works with Python 2.6 but fails on Python 2.7 | |
""" | |
import httplib, urllib2 | |
params = b'\x40\x00\x01\x02\xFF' | |
url = unicode("http://posttestserver.com/post.php") |
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
#! /usr/bin/env python | |
import os, sys | |
paths = ["/Applications/Microsoft Office 2011/", | |
"/Applications/Remote Desktop Connection", | |
"/Applications/Microsoft Communicator", | |
"/Applications/Microsoft Messenger", | |
"/Users/username/Library/Preferences/Microsoft/Office 2011/", | |
"/~/Library/Application Support/Microsoft/", | |
"/~/Documents/Microsoft User Data/", | |
"/Library/Automator", |
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
#! /usr/bin/env python | |
import os, sys, plistlib | |
# Warning this solution works with 10.6+ (including 10.7) | |
# On 10.5 the apps executed via Spotlight are not going to see the new PATH | |
f = os.path.expanduser("~/.MacOSX/environment.plist") | |
try: | |
dic = plistlib.readPlist(f) | |
except Exception as e: |
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
#! /usr/bin/env python | |
import MySQLdb | |
host = "localhost" | |
passwd = "" | |
user = "root" | |
dbname = "mydbname" | |
db = MySQLdb.connect(host=host, user=user, passwd=passwd, db=dbname) | |
cursor = db.cursor() |
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
94:~ ssbarnea$ brew install git | |
==> Downloading http://kernel.org/pub/software/scm/git/git-1.7.6.tar.bz2 | |
File already downloaded in /Users/ssbarnea/Library/Caches/Homebrew | |
==> make prefix=/usr/local/Cellar/git/1.7.6 install | |
GIT_VERSION = 1.7.6 | |
* new build flags or prefix | |
./generate-cmdlist.sh > common-cmds.h+ && mv common-cmds.h+ common-cmds.h | |
gcc -o hex.o -c -O3 -w -pipe -I. -DUSE_ST_TIMESPEC -DSHA1_HEADER='<openssl/sha.h>' -DNO_MEMMEM hex.c | |
gcc -o ident.o -c -O3 -w -pipe -I. -DUSE_ST_TIMESPEC -DSHA1_HEADER='<openssl/sha.h>' -DNO_MEMMEM ident.c | |
gcc -o levenshtein.o -c -O3 -w -pipe -I. -DUSE_ST_TIMESPEC -DSHA1_HEADER='<openssl/sha.h>' -DNO_MEMMEM levenshtein.c |
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
#!/usr/bin/env python | |
import sys, os, time, platform | |
sample_ansi = '\x1b[31mRED' + '\x1b[33mYELLOW' + '\x1b[32mGREEN' + '\x1b[35mPINK' + '\x1b[0m' + '\n' | |
for handle in [sys.stdout, sys.stderr]: | |
if (hasattr(handle, "isatty") and handle.isatty()) or \ | |
('TERM' in os.environ and os.environ['TERM']=='ANSI'): | |
if platform.system()=='Windows' and not ('TERM' in os.environ and os.environ['TERM']=='ANSI'): |
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
import sys, os, subprocess, shutil | |
import traceback | |
from _winreg import * | |
from ctypes import c_int, WINFUNCTYPE, windll | |
from ctypes.wintypes import HWND, LPCSTR, UINT | |
prototype = WINFUNCTYPE(c_int, HWND, LPCSTR, LPCSTR, UINT) | |
paramflags = (1, "hwnd", 0), (1, "text", "Hi"), (1, "caption", None), (1, "flags", 0) | |
MessageBox = prototype(("MessageBoxA", windll.user32), paramflags) | |
# use flag=1 to make it Yes|No | |
# See http://msdn.microsoft.com/en-us/library/windows/desktop/ms645505(v=vs.85).aspx) |
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
@cls | |
@echo --- testing --- | |
@echo Should all return: | |
@echo %~dp0 | |
@echo. | |
@echo. | |
@echo #1 | |
@cd /D %~dp0 | |
python path-tester.py |
OlderNewer