This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name *.dev; | |
location / { | |
proxy_pass http://localhost:8080; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_connect_timeout 150; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Usage Example | |
$save_handler = new MyRedisSessionModule(); | |
$save_handler->save_path = "tcp://127.0.0.1:6379?weight=1"; | |
session_set_save_handler($save_handler, true); | |
*/ | |
class MyRedisSessionModule implements SessionHandlerInterface { | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sqlite3 | |
import os | |
import json | |
import time | |
sql_data_file = 'app_data.sqlite' | |
dirname = os.path.dirname(os.path.realpath(__file__)) | |
ts = int(time.time()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def single_instance_task(function=None, timeout=None): | |
"""Enforce only one celery task at a time.""" | |
def _dec(run_func): | |
"""Decorator.""" | |
@wraps(run_func) | |
def _caller(*args, **kwargs): | |
"""Caller.""" | |
ret_value = None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# originaly from http://tinyurl.com/twitch-linux from taladan | |
# www.youtube.com/user/taladan | |
# gist created by brodul | |
INRES="1920x1200" # input resolution | |
#OUTRES="1024x640" # Output resolution | |
OUTRES="scale=1280:-1" # Output resolution |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install php5-dev php-pear | |
sudo add-apt-repository ppa:gearman-developers/ppa | |
sudo apt-get update | |
sudo apt-get install libgearman-dev | |
sudo pecl install gearman | |
sudo sh -c 'echo "extension=gearman.so" > /etc/php5/conf.d/gearman.ini' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>CSV Maker</title> | |
<script> | |
function get(id){ | |
return document.getElementById(id); | |
} | |
function rand(min, max){ | |
min = parseInt(min); | |
max = parseInt(max); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* G::set('foo', 'bar'); | |
* G::get('foo'); // bar | |
*/ | |
class G { | |
private static $_vars = array(); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Use for $_POST $_GET and $_COOKIE vars | |
function mysql_escape_request($str){ | |
if (get_magic_quotes_gpc()) { | |
$str = stripslashes($str); | |
} | |
return mysql_real_escape_string($str); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Wrapper class for ZMQ PECL extension | |
class ZMQ_Socket { | |
private $_context; | |
private $_socket; | |
private $_signer; | |
private $_dsn; |