Skip to content

Instantly share code, notes, and snippets.

View Apkawa's full-sized avatar
🌴
On vacation

Apkawa Apkawa

🌴
On vacation
View GitHub Profile
@bdarnell
bdarnell / django_tornado_handler.py
Created October 29, 2010 18:59
django_tornado_handler.py
# NOTE: This code was extracted from a larger class and has not been
# tested in this form. Caveat emptor.
import django.conf
import django.contrib.auth
import django.core.handlers.wsgi
import django.db
import django.utils.importlib
import httplib
import json
import logging
@adeleinr
adeleinr / gist:672140
Created November 11, 2010 07:12 — forked from anonymous/gist:156623
django deployment
"""
This fabric file makes setting up and deploying a django application much
easier, but it does make a few assumptions. Namely that you're using Git,
Apache and mod_wsgi and your using Debian or Ubuntu. Also you should have
Django installed on your local machine and SSH installed on both the local
machine and any servers you want to deploy to.
_note that I've used the name project_name throughout this example. Replace
this with whatever your project is called._
from struct import unpack
import Image
tag_types = { 0 : 'End',
1 : 'Byte',
2 : 'Short',
3 : 'Int',
4 : 'Long',
5 : 'Float',
6 : 'Double',
@snay2
snay2 / funcs.py
Created March 3, 2011 22:21
Examples using SQS
import uuid
import time
import boto
import json
from boto.sqs.message import RawMessage
AWSKey = "{redacted}"
AWSSecret = "{redacted}"
testQueue = "testqueue"
@hohyon-ryu
hohyon-ryu / ES_Stemming.rb
Created May 25, 2011 19:19
Stemming for ElasticSearch
# Script to test stemming for ElasticSearch. Working now!!
# Reference: http://stackoverflow.com/questions/4981001/why-elasticsearch-is-not-finding-my-term
require 'rubygems'
require 'net/http'
require 'yaml'
require 'json'
# kill the index
delete = Net::HTTP::Delete.new("/willindex")
@oduvan
oduvan / find_serialization_errors.py
Created June 10, 2011 14:32
www.lyabah.com Django find_serialization_errors
from django.core.exceptions import ImproperlyConfigured
from django.core.management.base import BaseCommand, CommandError
from django.core import serializers
from django.utils.datastructures import SortedDict
from optparse import make_option
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option('--format', default='json', dest='format',
@phpdude
phpdude / nginx.conf
Last active October 6, 2024 19:22
Nginx image filter + caching of results.
location /resize {
alias /tmp/nginx/resize;
set $width 150;
set $height 100;
set $dimens "";
if ($uri ~* "^/resize_(\d+)x(\d+)/(.*)" ) {
set $width $1;
set $height $2;
set $image_path $3;
@deoxxa
deoxxa / WILD SPECULATION
Created August 29, 2012 12:01
AniDB Database Stuff
64617461 // "data"
0a000000 // 10 (elements?)
7f000000 // 127 (somehow related to length...?)
000100040800000000 // no idea
ffffffbb // ffffffbb shows up 10 times, same as the "element count" value above
ffffffe4 // seems to mark the beginning of a field? maybe?
000600000000000000000200041800000003
ffffffbb
ffffffe4
0041006e0069006d0065002d0045006d00700069007200650000 // ucs2-be/utf16-be string terminated with a null character
@mamchenkov
mamchenkov / update_translations.sh
Created September 10, 2012 13:41
gettext translations update
#!/bin/bash
DOMAIN="easyforex"
POT="$DOMAIN.pot"
LANGS="en_US ru_RU"
SOURCES="*.php"
# Create template
echo "Creating POT"
rm -f $POT
@ivanvanderbyl
ivanvanderbyl / gist:4222308
Created December 6, 2012 06:55
Postgres 9.1 to 9.2 upgrade guide for Ubuntu 12.04
sudo add-apt-repository ppa:pitti/postgresql
sudo apt-get update
sudo apt-get install postgresql-9.2 postgresql-server-dev-9.2 postgresql-contrib-9.2
sudo su -l postgres
psql -d template1 -p 5433
CREATE EXTENSION IF NOT EXISTS hstore;
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
service postgresql stop
/usr/lib/postgresql/9.2/bin/pg_upgrade -b /usr/lib/postgresql/9.1/bin -B /usr/lib/postgresql/9.2/bin -d /var/lib/postgresql/9.1/main/ -D /var/lib/postgresql/9.2/main/ -O "-c config_file=/etc/postgresql/9.2/main/postgresql.conf" -o "-c config_file=/etc/postgresql/9.1/main/postgresql.conf"