Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>name.henriknyh.znc</string>
<key>Program</key>
<string>/usr/local/bin/znc</string>
<key>RunAtLoad</key>
<true/>
import socket
def sockrecv(sock):
d = ''
while not d or d[-1] != '\n':
d += sock.recv(8192)
return d
# unicorn_rails -c /data/github/current/config/unicorn.rb -E production -D
rails_env = ENV['RAILS_ENV'] || 'production'
# 16 workers and 1 master
worker_processes (rails_env == 'production' ? 16 : 4)
# Load rails+github.git into the master before forking workers
# for super-fast worker spawn times
preload_app true
import django
from django.utils.translation import ugettext_lazy as _
from debug_toolbar.panels import DebugPanel
from haystack.backends import queries
class HaystackDebugPanel(DebugPanel):
"""
Panel that displays the Haystack queries.
"""
name = 'Haystack'
#!/usr/bin/env python
import os, random, subprocess, sys
HAS_VENV = bool(subprocess.Popen(['which','virtualenv'], stdout=subprocess.PIPE).communicate()[0])
if not HAS_VENV:
print "virtualenv is required to run this script. Please install it with\n easy_install virtualenv\n\nor\n\n pip virtualenv"
sys.exit(1)
HAS_VENVW = bool(subprocess.Popen(['which','virtualenvwrapper.sh'], stdout=subprocess.PIPE).communicate()[0])
import redis
from django.conf import settings
from django.core.signals import request_finished
try:
from eventlet.corolocal import local
except ImportError:
from threading import local
# This is the entire preseed config file used on an example Lucid system. See the preseed
# documentation for more information on the options here. This will use US English by default.
#
# https://help.ubuntu.com/10.04/installation-guide/amd64/preseed-contents.html
#
# This preseed will automatically install Ubuntu 10.04 with default options. Understand what
# it is doing before you use it.
#
# Boot Options line:
#
@klipstein
klipstein / b64field.py
Created November 22, 2010 12:25
Base64 file handling for django-tastypie
import base64
import os
from tastypie.fields import FileField
from django.core.files.uploadedfile import SimpleUploadedFile
class Base64FileField(FileField):
"""
A django-tastypie field for handling file-uploads through raw post data.
It uses base64 for en-/decoding the contents of the file.
Usage:
@dcramer
dcramer / track_data.py
Created December 6, 2010 19:15
Tracking changes on properties in Django
from django.db.models.signals import post_init
def track_data(*fields):
"""
Tracks property changes on a model instance.
The changed list of properties is refreshed on model initialization
and save.
>>> @track_data('name')
@streeter
streeter / port-update-notifier.sh
Last active November 22, 2017 22:22
Display notifications via Growl when updates to MacPorts are available.
#!/bin/bash
#
# Notify of MacPort updates via Growl on Mac OS X
#
# Author: Chris Streeter http://www.chrisstreeter.com
# Requires: Growl Notify Extra to be installed (but fails gracefully). Info
# about how to get the extra is at http://growl.info/extras.php
TERM_APP='/Applications/Terminal.app'