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 sublime | |
| import sublime_plugin | |
| import re | |
| import json | |
| from xml.dom.minidom import * | |
| from os.path import basename | |
| from copy import copy | |
| from xml.sax.saxutils import escape, unescape | |
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 datetime import datetime | |
| ######################################### | |
| # Set up the django environment | |
| ######################################### | |
| from django.core.management import setup_environ |
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
| # saved from: http://pastie.org/private/bclbdgxzbkb1gs2jfqzehg | |
| import sublime | |
| import sublime_plugin | |
| import subprocess | |
| class RunExternalCommand(sublime_plugin.TextCommand): | |
| """ | |
| Runs an external command with the selected text, |
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 multiprocessing | |
| import time | |
| from os import getpid | |
| def worker(): | |
| pid = getpid() | |
| print 'START %d' % pid | |
| time.sleep(3) |
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
| 1. Delete DB | |
| 2. Create DB | |
| 3. Remove south from INSTALLED_APPS | |
| 4. syncdb | |
| 5. Insert south into INSTALLED_APPS | |
| 6. sycndb | |
| 7. migrate --fake | |
| 8. YAY! |
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 datetime | |
| # Time is Central! | |
| d = datetime.datetime(2012, 9, 26, 14, 00) | |
| # So we can convert our times to Pacific time | |
| dt = datetime.timedelta(hours=2) |
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.contrib import admin | |
| from django.db.models import get_models, get_app | |
| from models import BaseModel | |
| app = get_app('app_name') | |
| for model in get_models(app): | |
| if issubclass(model, BaseModel): | |
| try: |
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 firebirdsql | |
| conn = firebirdsql.connect( | |
| dsn='localhost/3050:PATH_TO_DB.fdb', | |
| user='sysdba', | |
| password='masterkey' | |
| ) | |
| cur = conn.cursor() | |
| # Get all rows from a table |
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
Show hidden characters
| [ | |
| // Reload currently active view key shortcut. | |
| { "keys": ["ctrl+alt+o"], "command": "reload_view"} | |
| ] |
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
| [ | |
| // Change the syntax of the current file to YAML | |
| { "keys": ["ctrl+alt+y"], "command": "change_syntax", "args": {"syntax": "Packages/YAML/YAML.tmLanguage"}} | |
| ] |
OlderNewer