This guide assumes a fresh install of Mac OSX 10.7 Lion.
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 functools import wraps | |
| from django.conf import settings | |
| from django.http import HttpResponseRedirect | |
| def require_ssl(view): | |
| """ | |
| Decorator that requires an SSL connection. If the current connection is not SSL, we redirect to the SSL version of | |
| the page. |
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 zmq | |
| import threading | |
| import time | |
| from random import choice | |
| class ClientTask(threading.Thread): | |
| """ClientTask""" | |
| def __init__(self): | |
| threading.Thread.__init__ (self) |
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
| #!/usr/bin/env python | |
| # | |
| # A Python implementation of the handy `which' shell command, showing | |
| # the full path to a command that's in your path. | |
| # | |
| # Written by: Senko Rasic <[email protected]> | |
| # | |
| # Released to Public Domain. Use it as you like. | |
| import sys |
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
| #!/usr/bin/env python | |
| # | |
| # Written in 2013. by Senko Rasic <[email protected]> | |
| # This code is Public Domain. You may use it as you like. | |
| __all__ = ['updated'] | |
| def updated(dct, *others): |
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
| #!/usr/bin/env python | |
| from PIL import Image, ImageDraw | |
| def main(): | |
| # Open the original image | |
| main = Image.open("12voltm.jpg") | |
| # Create a new image for the watermark with an alpha layer (RGBA) | |
| # the same size as the original image | |
| watermark = Image.new("RGBA", main.size) |
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 re | |
| from django.utils.text import compress_string | |
| from django.utils.cache import patch_vary_headers | |
| from django import http | |
| try: | |
| import settings | |
| XS_SHARING_ALLOWED_ORIGINS = settings.XS_SHARING_ALLOWED_ORIGINS |
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/bash | |
| # | |
| # Watch current directory (recursively) for file changes, and execute | |
| # a command when a file or directory is created, modified or deleted. | |
| # | |
| # Written by: Senko Rasic <[email protected]> | |
| # | |
| # Requires Linux, bash and inotifywait (from inotify-tools package). | |
| # | |
| # To avoid executing the command multiple times when a sequence of |
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
| #!/usr/bin/env python | |
| """ | |
| Parse phone and email records out of vCard file and store them in a CSV. | |
| Copyright (C) 2012 Senko Rasic <[email protected]> | |
| 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 |
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
| # Written by Senko Rasic <[email protected]> | |
| # Released into Public Domain. Use it as you like. | |
| from django.db import models | |
| class SingletonModel(models.Model): | |
| """Singleton Django Model | |
| Ensures there's always only one entry in the database, and can fix the |