Skip to content

Instantly share code, notes, and snippets.

======================================================
Setting up Django using Apache/mod_wsgi on Ubuntu 8.10
======================================================
This article will cover setting up Django using Apache/mod_wsgi on Ubuntu
8.10. The article is targeted at a production environment, but keep in mind
this is a more generalized environment. You may have different requirements,
but this article should at least provide the stepping stones.
The article will use distribution packages where nesscary. As of 8.10 the
@border
border / Makefile
Created January 12, 2011 01:36
json example in golang
include $(GOROOT)/src/Make.inc
GOFMT=gofmt -spaces=true -tabindent=false -tabwidth=4
all:
$(GC) jsontest.go
$(LD) -o jsontest.out jsontest.$O
format:
$(GOFMT) -w jsontest.go
@derekwyatt
derekwyatt / dir.sh
Created August 18, 2011 14:04
A BASH script to handle directory management
export DIRSTACK_MAX=15
DS=()
function eecho
{
echo $@ 1>&2
}
function shiftStackUp
{
@erikankrom
erikankrom / accounts-models.py
Created September 5, 2011 22:36
Multiple Profiles for Internal/External Users
from django.db import models
from django.contrib.auth import User
from mycompany.models import Client
from userprofiles.models import Profile
class External(Profile):
#External-specific models
client = models.ForeignKey(Client)
def __unicode__(self):
@masaedw
masaedw / emacs.sh
Created January 6, 2012 16:27
run emacs.app or emacsclient on Mac OS X
function e() {
if [ -z `pgrep Emacs` ]; then
env LANG=C open -a Emacs "$@"
return
fi
local client="/Applications/MacPorts/Emacs.app/Contents/MacOS/bin/emacsclient"
local uid=`id -u`
local socket="$TMPDIR"/emacs"$uid"/server
@eerohele
eerohele / mosh-cygwin.md
Last active March 3, 2024 04:20
Compiling Mosh (http://mosh.mit.edu/) under Cygwin

NOTE: You don't need to compile Mosh on Cygwin yourself anymore; just install the package with Cygwin's setup.exe.

  1. Download Cygwin.

  2. Run setup.exe and install the following packages in addition to the default ones:

    • make
    • boost
    • libncurses-devel
    • pkg-config
  • perl
@gpakosz
gpakosz / gist:2947616
Created June 18, 2012 09:18
vim - toggle between relative / absolute / no line numbering
if exists("+relativenumber")
set relativenumber " show relative line numbers
set numberwidth=3 " narrow number column
" cycles between relative / absolute / no numbering
function! RelativeNumberToggle()
if (&relativenumber == 1)
set number number?
elseif (&number == 1)
set nonumber number?
else
@hoffrocket
hoffrocket / parhttp.py
Created August 28, 2012 00:29
Python parallel http requests using multiprocessing
#!/usr/bin/env python
from multiprocessing import Process, Pool
import time
import urllib2
def millis():
return int(round(time.time() * 1000))
def http_get(url):
@puffnfresh
puffnfresh / hipchat.el
Created November 2, 2012 15:34
HipChat + jabber.el
;; Connect using jabber-connect
;; My username from the HipChat configuration
;; from https://www.hipchat.com/account/xmpp
(setq jabber-account-list '(("10804_81219@chat.hipchat.com")))
;; To join HipChat rooms easily
(defvar hipchat-number "10804")
(defvar hipchat-nickname "Brian McKenna")
(defun hipchat-join (room)
@tribut
tribut / mosh_pc.sh
Last active June 4, 2018 11:33
wrapper for mosh to work with ssh's proxycommand directive. this only makes sense if the target machine is directly reachable from the internet using udp (but probably not via tcp). usage: mosh_pc.sh [host as mentioned in .ssh/config] [public ip of host]
#!/bin/sh
# ########################################################## #
# wrapper for mosh to work with ssh's proxycommand directive #
# this only makes sense if the machine is directly reachable #
# from the internet using udp. #
# ########################################################## #
THISSCRIPT="`basename \"$0\"`"
REMOTE="$1"