Skip to content

Instantly share code, notes, and snippets.

View inlanger's full-sized avatar
🍑

inlanger inlanger

🍑
View GitHub Profile
@inlanger
inlanger / app.py
Last active March 3, 2016 07:30
Django models in Tornado app
import tornado
from django.conf import settings
from application.events.models import Event
class GetDataFromCamera(tornado.web.RequestHandler):
def post(self):
json_data = json.loads(self.request.body)
self.finish()
@inlanger
inlanger / new_gist_file.sh
Created January 19, 2015 15:32
When git ignore case changes in filenames
git config --unset-all core.ignorecase && git config --system core.ignorecase false
apt-get install build-essential libsqlite3-dev zlib1g-dev libncurses5-dev libgdbm-dev libbz2-dev libreadline5-dev libssl-dev libdb-dev
wget http://www.python.org/ftp/python/2.7.6/Python-2.7.6.tgz
tar -xzf Python-2.7.6.tgz
cd Python-2.7.3
./configure
make
make install
cd ..
@inlanger
inlanger / find.sh
Created January 10, 2014 09:07
Find big folders
du -h /path/to/folder | grep ^[0-9.]*G
@inlanger
inlanger / template.html
Created December 12, 2013 09:49
Create list and get random number in Django template
{{ rand|add:"12345"|make_list|random }}
@inlanger
inlanger / 4sq.js
Created November 15, 2013 10:33
Get 9 latest photos from foursquare api for venue Need to register an app here - https://foursquare.com/oauth
$("#foursquare_photos").html('<h2>Loading photos...</h2>');
$.get("https://api.foursquare.com/v2/venues/VENUE_ID/photos?limit=9&client_id=ID&client_secret=SECRET&v=20131016", function (data) {
$("#foursquare_photos").html('');
$(data.response.photos.items).each(function (i, val) {
$("#foursquare_photos").append('<div class="fsphoto"><img src="' + val.prefix + '70x70' +val.suffix + '"></div>');
});
}, 'json');
@inlanger
inlanger / minimal.sh
Created November 11, 2013 17:57
Minimal raspbian sudo minimal.sh
#!/bin/bash
# Stephen's Raspberry Pi Mimimalist install from standard Raspdian Image
apt-get update
apt-get purge xserver* -y
apt-get purge ^x11 -y
apt-get purge ^libx -y
apt-get purge ^lx -y
apt-get purge samba* -y
apt-get autoremove -y
apt-get upgrade -y
@inlanger
inlanger / silent.js
Created October 9, 2013 08:24
Silent catch uncaughtException in NodeJS From http://shapeshed.com/uncaught-exceptions-in-node/
process.on('uncaughtException', function (err) {
console.log(err);
});
@inlanger
inlanger / mod_wsgi_install.sh
Created October 6, 2013 08:35
Install apache mod_wsgi without python2.6 on Debian7
apt-get download libapache2-mod-wsgi
dpkg --force-all -i libapache2-mod-wsgi....
@inlanger
inlanger / openvz_fake_swap.sh
Created October 1, 2013 13:25
Create 1024mb swap partition
#!/bin/bash
### BEGIN INIT INFO
# Provides: swap
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 1 0 6
# Short-Description: add fake swap.
### END INIT INFO