Skip to content

Instantly share code, notes, and snippets.

@j4mie
j4mie / gunicorn-projectname.conf
Created May 13, 2011 08:07
upstart configuration for gunicorn
description "upstart configuration for gunicorn"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
exec /home/jamie/.virtualenvs/projectname/bin/gunicorn_django -c /home/jamie/code/projectname/gunicorn.py /home/jamie/code/projectname/settings/production.py
@bvajda
bvajda / server_install.md
Created October 18, 2011 21:37
Postgresql 9.1 server on CentOS 6

install CentOS 6

yum update
yum upgrade

check the server time. sync the time to a time server if needed (service 'ntpd')

download and install Postgresql Server v9.1 rpm package:

rpm -Uvh http://yum.pgrpms.org/9.1/redhat/rhel-6-x86_64/pgdg-centos91-9.1-4.noarch.rpm

This should have installed the necessary server package: postgresql91-server.x86_64.

@huobazi
huobazi / gist:997492
Created May 29, 2011 05:09 — forked from dstufft/gist:997475
Configuration Files for Nginx + Gunicorn + Supervisord
We couldn’t find that file to show.
@Fodsuk
Fodsuk / gist:3025099
Created June 30, 2012 18:56
service layer exampe
public class InventoryController : ApiController
{
private readonly IInventoryManagementService _inventoryManagementService;
private readonly IUnitOfWork _unitOfWork;
public InventoryController(IUnitOfWork unitOfWork)
{
_unitOfWork = unitOfWork; //access services
_inventoryManagementService = _unitOfWork.Get<IInventoryManagementService>();
}
@adeleinr
adeleinr / fabric.py
Created April 20, 2011 21:21
fabric config for deploying a Django project
"""
Distributor ID: Ubuntu
Description: Ubuntu 10.04 LTS
Release: 10.04
Codename: lucid
Author: Adelein Rodriguez, adeleinr@gmail.com
Note: This is an adaptation from a fabric script presented here:
http://morethanseven.net/2009/07/27/fabric-django-git-apache-mod_wsgi-virtualenv-and-p.html
Summary: This script:
@brosner
brosner / setup.md
Last active April 26, 2020 11:32
My development environment setup

Prepare by switching out of bash from Homebrew:

chsh -s /bin/zsh

To clean my system and reinstall Homebrew:

rm -rf ~/.local && mkdir ~/.local
rm -rf ~/Library/Caches/pip
rm -rf ~/.pyenv

rm -rf ~/.yarn

@kamranayub
kamranayub / DataContext.js
Created April 24, 2013 05:12
A working ASP.NET Web API MVC 4 Anti-Forgery approach that also works on cloud hosts like AppHarbor. See: http://kamranicus.com/Blog/Posts/70/protip-using-anti-forgery-token-with-aspnet-web-ap
var options = {};
// jQuery options
// options.url = foo;
// CSRF Token
var csrfToken = $("input[name='__RequestVerificationToken']").val();
if (csrfToken) {
options.headers = {
@timmyomahony
timmyomahony / nginx.conf
Created June 26, 2011 13:29
Python, UWSGI, Supervisor & Nginx
upstream uwsgi {
ip_hash;
server 127.0.0.1:40000;
}
server {
listen 80;
server_name www.domain.com;
root /sites/mysite/;
access_log /sites/mysite/log/nginx/access.log;
@mitsuhiko
mitsuhiko / .gitconfig
Last active January 30, 2021 20:22
Adds the ultimate of all pull request commands to git
# Alternatively don't use slog but something else. I just like that more.
[aliases]
slog = log --pretty=format:"%C(auto,yellow)%h%C(auto)%d\\ %C(auto,reset)%s\\ \\ [%C(auto,blue)%cn%C(auto,reset),\\ %C(auto,cyan)%ar%C(auto,reset)]"
addprx = "!f() { b=`git symbolic-ref -q --short HEAD` && \
git fetch origin pull/$1/head:pr/$1 && \
git fetch -f origin pull/$1/merge:PR_MERGE_HEAD && \
git rebase --onto $b PR_MERGE_HEAD^ pr/$1 && \
git branch -D PR_MERGE_HEAD && \
git checkout $b && echo && \
git diff --stat $b..pr/$1 && echo && \
@johnnyreilly
johnnyreilly / PdfGenerator.cs
Created April 9, 2012 05:58
C# Wrapper for WKHTMLtoPDF
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security;
using System.Web;
using System.Web.Hosting;
namespace PdfGenerator
{
public class PdfGenerator