Skip to content

Instantly share code, notes, and snippets.

powellc / gogs.conf
Created October 28, 2014 14:29
Gogs Upstart Script
# upstart script for gogs (Go Git Service)
author "tsv"
description "gogs upstart script"
start on (local-filesystems and net-device-up)
stop on shutdown
powellc /
Created February 1, 2010 00:22 — forked from heckj/
Forked for my own vps info.
#!/usr/bin/env python
from __future__ import with_statement # needed for python 2.5
from fabric.api import *
from fabric.contrib.console import confirm
# ================================================================
# using this fabfile expects that you have the python utility
# fabric installed locally, ssh access to, and your
# ssh public key associated with the account ''
# The purpose of this file is to, as quickly as possible, set up a home directory
# with all the creature comforts I expect.
# For this to work:
# 1. Add ssh keys to github and personal git repo
# 2. sudo aptitude install zsh git-core
mkdir $HOME/.virtualenvs
# terminfo and termcap for nice 256 color terminal
# allow bold colors - necessary for some reason
attrcolor b ".I"
# tell screen how to set colors. AB = background, AF=foreground
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
# erase background with current bg color
defbce "on"
powellc / .zshrc
Created September 15, 2010 16:33
export TERM=xterm-256color
# Default the box color to red, but change to differentiate boxes or VPSs
export BOXCOLOR="%{$fg[red]%}"
# Path to your oh-my-zsh configuration.
export ZSH=$HOME/.oh-my-zsh
# Set to the name theme to load.
# Look in ~/.oh-my-zsh/themes/
### This script simply parses ifconfig and loads a box's main IP into a shell variable
IP="" # store IP
case $OS in
Linux) IP=`ifconfig | grep 'inet addr:'| grep -v '' | cut -d: -f2 | awk '{ print $1}' | grep 24 `;;
diff --git a/src/adzone/ b/src/adzone/
index 347e85e..271e36d 100644
--- a/src/adzone/
+++ b/src/adzone/
@@ -8,8 +8,15 @@ class AdManager(models.Manager):
Returns a random advert that belongs to the specified category and zone
- try:
- ad = self.get_query_set().filter(category__slug=ad_category, zone__slug=ad_zone).order_by('?')[0]
powellc /
Created March 7, 2011 20:21
A development script to run django with gevent instead of flup
import sys
from gevent import monkey; monkey.patch_all()
from gevent.wsgi import WSGIServer
import os
import traceback
from django.core.handlers.wsgi import WSGIHandler
from import call_command
powellc / gist:de1b1a73cf814b16e39f
Created October 5, 2015 15:20
// ==UserScript==
// @name Toggl-Button GitHub
// @namespace
// @version 1.3
// @include http*://*
// @grant GM_xmlhttpRequest
// @grant GM_addStyle
// @grant GM_getResourceText
// @grant GM_getValue
// @grant GM_setValue
powellc /
Last active December 11, 2015 17:08
MySQL backup script for nightly dumps that clean up after a certain number of days and keep a symlink to the latest one so you can easily setup a webserver to provide dumps for development purposes
HN=`hostname | awk -F. '{print $1}'`
# Remove backups older than 10 days