Skip to content

Instantly share code, notes, and snippets.

View alesegdia's full-sized avatar
😸

Alejandro Seguí alesegdia

😸
View GitHub Profile
sudo apt-get install libxapian-dev uuid-dev
# enter virtualenv (ej.: workon myvirtualenv, source ~/env/bin/activate)
pkgver=1.2.16
mkdir -p $VIRTUAL_ENV/src && cd $VIRTUAL_ENV/src
curl -O http://oligarchy.co.uk/xapian/$pkgver/xapian-core-$pkgver.tar.xz && tar xf xapian-core-$pkgver.tar.xz
curl -O http://oligarchy.co.uk/xapian/$pkgver/xapian-bindings-$pkgver.tar.xz && tar xf xapian-bindings-$pkgver.tar.xz
#!/usr/bin/env bash
if [ "$#" -ne 1 ]; then
echo "Usage: ./savegames.sh <dest-folder>"
exit
fi
BACKUP_FOLDER=$1
echo $BACKUP_FOLDER
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
PROJECT_ROOT = os.path.join(os.path.join(BASE_DIR, '..'), '..')
LOCALE_PATHS = (
os.path.join(PROJECT_ROOT, 'conf', 'locale'),
'/path/to/project/conf/locale'
)
LANGUAGES = (
('es', 'Spanish'),
@alesegdia
alesegdia / FindAruco.cmake
Last active August 29, 2015 14:10
CMake Aruco library finder.
# - Find Aruco
# Find the native Aruco includes and libraries
#
# Aruco_INCLUDE_DIR - where to find Aruco headers.
# Aruco_LIBRARIES - libraries needed for linking Aruco.
# Aruco_FOUND - True if libaruco was found.
if(Aruco_INCLUDE_DIR)
# Already in cache, be silent
set(Aruco_FIND_QUIETLY TRUE)
@alesegdia
alesegdia / gist:c364a10cd06d284dba71
Created November 21, 2014 13:10
Django 1.6 DB creation
# create db and provide initial data
./manage.py syncdb
./manage.py migrate
./manage.py loaddata fixture.json
@alesegdia
alesegdia / gist:a3a810548ebda5ee372b
Created November 20, 2014 14:49
Using python request with curl.
# python
somevar = request.META.get('HTTP_AUTH', None)
# curl
curl -H 'AUTH:1234' http://127.0.0.1:8000/some/url/
@alesegdia
alesegdia / .vimrc
Created November 19, 2014 21:41
My little dirty .vimrc
"http://nvie.com/posts/how-i-boosted-my-vim/
" load plugins
call pathogen#infect()
set guifont=Consolas\ 10
set nocp
filetype on
filetype plugin on
@alesegdia
alesegdia / gist:6a5c9c0ee921c6086e93
Last active August 29, 2015 14:10
AwesomeWM background cycler.
local lfs = require "lfs"
-- get all images in a path (there should be only images in this path)
wp_files = {}
wp_path = "/EDIT/THIS/PATH/"
for file in lfs.dir(wp_path) do
if file:sub(1,1) ~= '.' then
table.insert(wp_files,file)
end
@alesegdia
alesegdia / .bashrc
Created November 19, 2014 21:32
~/.bashrc stuff
export PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h: \[\e[33m\]\w\[\e[0m\]\n\$ '
@alesegdia
alesegdia / gist:9fd6cd186744b6cf43c9
Last active August 29, 2015 14:09
Get (lat,lon) from address using Nominatim and OSM in Python.
import urllib2
import json
import sys
def addr_to_url(addr):
return "http://nominatim.openstreetmap.org/?format=json&addressdetails=1&q=" + addr.strip().replace(" ", "+") + "&format=json&limit=1"
def addr_to_geo(addr):
url = addr_to_url(addr)
jsonreq = urllib2.urlopen(url).read()