Skip to content

Instantly share code, notes, and snippets.

View alesegdia's full-sized avatar
😸

Alejandro Seguí alesegdia

😸
View GitHub Profile
@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 / 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 / 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)
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'),
#!/usr/bin/env bash
if [ "$#" -ne 1 ]; then
echo "Usage: ./savegames.sh <dest-folder>"
exit
fi
BACKUP_FOLDER=$1
echo $BACKUP_FOLDER
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
@alesegdia
alesegdia / mongodb_startup.md
Last active September 24, 2017 22:11
MongoDB startup

MONGODB STARTUP

  • Install MongoDB

  • Make sure noauth = true is uncommented at /etc/mongodb.conf (enabled by default, but just in case)

  • Create admin user:

@alesegdia
alesegdia / glfuncgen.py
Created May 28, 2015 19:13
Generate OpenGL function names from a file
import sys
import re
infile = open( sys.argv[1], 'r' )
ret = " return\n"
for line in infile.readlines():
try:
funcname = line.rstrip()
@alesegdia
alesegdia / pyfunc.py
Created June 11, 2015 10:55
python: functions i.
def upload_to_rename(instance, filename):
# handle instance and filename
return "sample"
def build_concat(basepath, f):
def _ret(instance, filename):
return basepath + f(instance, filename)
return _ret
@alesegdia
alesegdia / install-luarocks.sh
Created October 29, 2015 09:50
LuaRocks for 5.1 and 5.2
# LuaRocks for 5.1
./configure --lua-version=5.1 --versioned-rocks-dir --lua-suffix=5.1
make build
sudo make install
# LuaRocks for 5.2
./configure --lua-version=5.2 --versioned-rocks-dir --lua-suffix=5.2
make build
sudo make install