Skip to content

Instantly share code, notes, and snippets.

View skyler's full-sized avatar

Skyler Slade skyler

  • Constant Contact
  • Gainesville, FL
View GitHub Profile
@skyler
skyler / gist:1748364
Created February 5, 2012 23:19 — forked from uiltondutra/gist:231960
MongoDB init script
#!/bin/sh
### BEGIN INIT INFO
# Provides: mongodb
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the mongodb data-store
# Description: starts mongodb using start-stop-daemon
@skyler
skyler / gist:1748751
Created February 6, 2012 01:09
gearmand init script
#!/bin/sh
### BEGIN INIT INFO
# Provides: gearmand
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the gearmand job queue
# Description: starts gearmand using start-stop-daemon
<?php
class BadWords
{
public static $words = array("4r5e",
"5h1t",
"5hit",
"a55",
"anal",
"anus",
@skyler
skyler / gist:2690402
Created May 13, 2012 21:50
Bugjar Nginx config file
server {
listen 80 default;
server_name bugjar.git www.bugjar.git;
access_log /var/log/nginx/bugjar_access.log;
error_log /var/log/nginx/bugjar_errors.log;
root /home/skyler/workspace/bugjar/public;
index index.php;
location = /favicon.ico {
@skyler
skyler / php_fcgi_params
Created May 20, 2012 23:19
PHP fastcgi options for Nginx
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/tmp/php-fcgi.sock;
fastcgi_index index.php;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
{% macro input_with_errors(field) -%}
<div class="control-group{% if field.errors %} error{% endif %}">
<label class="control-label" for="{{ field.id }}>{{ field.label }}</label>
<div class="controls">
<input type="text" class="input-large" id="{{ field.id }}" name="{{ field.name }}"{%if field.data %} value="{{ field.data|e }}"{% endif %}>
{%- if field.errors %}<span class="help-inline">{{ field.errors|join(' ') }}</span>{% endif %}
</div>
</div>
{%- endmacro %}
@skyler
skyler / send_gmail.py
Created August 13, 2012 15:17
Send an email through a Gmail account
import smtplib
import string
gmail_user = ""
gmail_pwd = ""
def send_mail(to, subject, text):
email = string.join((
"From: %s" % gmail_user,
"To: %s" % to,
@skyler
skyler / gist:3365585
Created August 16, 2012 01:58
Coefficient nginx config
server {
server_name *.coefficientrev.com *.coefficientrevenue.com;
rewrite ^/(.*) http://www.coefficientinc.com permanent;
}
server {
# Unneeded and defaults to 80?
#listen 80;
server_name www.coefficientinc.com coefficientinc.com;
# Configure colors, if available.
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
c_reset='\[\e[0m\]'
c_user='\[\033[1;33m\]'
c_path='\[\e[0;33m\]'
c_git_clean='\[\e[0;36m\]'
c_git_dirty='\[\e[0;35m\]'
else
c_reset=
c_user=
from gearman import GearmanWorker
from traceback import format_exception, print_exception
from StringIO import StringIO
import logging
class ExceptionalGearmanWorker(GearmanWorker):
def on_job_exception(self, current_job, exception_tuple):
""" Override the default on_job_exception handler to log an error
to the console.