Skip to content

Instantly share code, notes, and snippets.

@vojd
vojd / gist:4284560
Last active October 14, 2015 01:08
local.py
from settings import *
DATABASES = {
"default" : {
"ENGINE" : "django.db.backends.sqlite3",
"NAME" : "db/dev.db"
}
}
# add johnny's middleware
LOCAL_MIDDLEWARE_CLASSES = (
proxy_cache_path /var/cache/nginx/sub.example.com levels=1:2 keys_zone=media-cache:8m max_size=100m inactive=600m;
proxy_temp_path /var/cache/nginx/tmp/media;
server {
listen 80;
server_name sub.example.com;
client_max_body_size 20m;
access_log /var/log/nginx/sub.example.com.access.log;
error_log /var/log/nginx/sub.example.com.error.log;
@vojd
vojd / gist:4364500
Created December 23, 2012 17:11
.inputrc
# Autocompletion without case sensitivity
# ---------------------------------------
set completion-ignore-case on
# Word jumping
# ------------
# CTRL left/right arrow
"\e[1;5D": backward-word
"\e[1;5C": forward-word
@vojd
vojd / summing.py
Last active December 14, 2015 04:29
Mundane summing from lists
objects = [
[{'price' : 100}],
[{'price' : 200}],
[{'price' : 300}]
]
the_sum = 0
for o in objects:
for i in o:
the_sum += i['price']
@vojd
vojd / .slate
Created April 2, 2013 07:42
Slate configuration
config defaultToCurrentScreen true
config nudgePercentOf screenSize
config resizePercentOf screenSize
# Resize Bindings
bind right:cmd;alt resize +10% +0
bind left:cmd:alt resize -10% +0
bind up:cmd;alt resize +0 -10%
bind down:cmd;alt resize +0 +10%
bind right:ctrl;cmd;alt resize -10% +0 bottom-right
@vojd
vojd / linuxmint.md
Created April 12, 2013 18:05
Create LinuxMint bootable USB

Creating a bootable USB stick with LinuxMint 14 (works on both Debian and Ubuntu versions)

For OSX

hdiutil convert -format UDRW -o linuxmint-14.1-mate-dvd-64bit.img linuxmint-14.1-mate-dvd-64bit.iso

remove auto-appended .dmg file extension

mv linuxmint-14.1-mate-dvd-64bit.img.dmg linuxmint-14.1-mate-dvd-64bit.img

diskutil list

@vojd
vojd / image_rotate.py
Last active December 17, 2015 06:48
Rotate image based on EXIF tags. Useful for iphone uploads
from PIL import Image
def rotate_image(image):
"""
Rotates an image based on EXIF information. Used to mitigate non-rotated landscape photos taken from iPhone.
:Args ``image`` Image, opened using PIL:
"""
ANGLES = {
6: -90,
# -*- coding: utf-8 -*-
from django.contrib.auth.decorators import login_required
from django.utils.cache import patch_response_headers
from django.utils.decorators import method_decorator
from django.views.decorators.cache import cache_page, never_cache
from django.views.decorators.csrf import csrf_exempt
class NeverCacheMixin(object):
@method_decorator(never_cache)
# -*- coding: utf-8 -*-
from django.contrib.auth.decorators import login_required
from django.utils.cache import patch_response_headers
from django.utils.decorators import method_decorator
from django.views.decorators.cache import cache_page, never_cache
from django.views.decorators.csrf import csrf_exempt
class NeverCacheMixin(object):
@method_decorator(never_cache)
@vojd
vojd / clj-libgdx.sh
Last active January 3, 2016 01:48
Creates a skeleton for using Clojure and libGDX. Usage: ``sh clj-libgdx.sh name_of_project``
#!/bin/bash
if [[ $# -eq 0 ]] ; then
echo 'Please give your project a name'
exit 0
fi
echo "Creating new clojure-project with libgdx"
git clone [email protected]:vojd/libgdx-skeleton-clj.git
cd libgdx-skeleton-clj