Skip to content

Instantly share code, notes, and snippets.

View slok's full-sized avatar
⚙️
Building reliable solutions

Xabier Larrakoetxea Gallego slok

⚙️
Building reliable solutions
View GitHub Profile
@slok
slok / gist:836833
Created February 21, 2011 09:05
metaproxy script loader snippet
#with resp.body_stream() as body:
body = resp.body_string()
#-----------------------------------------------------------------------
#get path and split in "/" parts
actualPath = request.get_full_path()
parts = []
for part in actualPath.split('/'):
parts.append(part)
#create the import string. Ex: scripts.dipina.ModifyBody
importString = "scripts."
@slok
slok / gist:846176
Created February 27, 2011 13:18
Redland librdf installation (GNU/Linux)
--------------
Raptor2-2.0.0
--------------
[For GRDDL requieres libxml2 and libxslt]
$ tar xvf ./raptor2-2.0.0.tar.gz
$ cd ./raptor2-2.0.0
$ ./configure --prefix=/usr --libdir=/usr/lib64
$ make
$ make check
$ cd ./examples
@slok
slok / gist:847177
Created February 28, 2011 10:50
patch for raptor(redland) python bindings: adds seralization from stream to string
--- /usr/lib64/python2.6/site-packages/RDF.py.original 2011-02-28 11:32:55.235000011 -0100
+++ /usr/lib64/python2.6/site-packages/RDF.py 2011-02-28 11:33:03.555000011 -0100
@@ -2283,7 +2283,19 @@
else:
rbase_uri = None
return Redland.librdf_serializer_serialize_model_to_string(self._serializer, rbase_uri, model._model)
-
+
+ def serialize_stream_to_string(self, stream, base_uri=None):
+ """Serialize to a string using the optional base URI."""
@slok
slok / gist:926165
Created April 18, 2011 21:00
This program returns the position of an array that after this position all the numbers are repeated in the numbers before the returned array positio
/*
Copyright (C) 2011 Xabier Larrakoetxea (slok) <slok69@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@slok
slok / uwsgi.sh
Created June 19, 2011 12:07
This script executes the uwsgi command needed to deploy the Django app for example for Nginx.
#!/bin/bash
# uwsgi.sh: This script executes the uwsgi command needed to deploy the Django app for example for Nginx.
# The only things needed that have to be changed are the PYTHON_PATH and WSGI_CONF_NAME variables
# NOTE: The script must be inside the Django project(root folder)
#
# Author: Xabier Larrakoetxea (slok) <slok69@gmail.com>
#
# License: This script is in public domain.
@slok
slok / deployAllDj.sh
Created June 19, 2011 13:15
This scripts executes all the uwsgi scripts in the Django projects(project's path) that are ready to be deployed, by this way we can deploy all the Django apps automatically and not one by one
#!/bin/bash
# deployAllDj.sh: This scripts executes all the uwsgi scripts in the Django projects(project's path) that are ready
# to be deployed, by this way we can deploy all the Django apps automatically and not one by one
#
# Author: Xabier Larrakoetxea (slok) <slok69@gmail.com>
#
# License: This script is in public domain.
#MODIFY THIS!!
@slok
slok / 51-android.rules
Created June 21, 2011 18:21
Android Rules (permissions)
#/etc/udev/rules.d/51-android.rules
#This rules are for the Android Devices that will be connected for debugging apps (or internet tethering)
#Geeksphone Zero(Qualcomm)
#SUBSYSTEM=="usb", ATTRS{idVendor}=="05c6", ATTRS{idProduct}=="9025", MODE="0666", USER="slok"
SUBSYSTEM=="usb", ATTRS{idVendor}=="05c6", MODE="0666"
@slok
slok / php-cgi.sh
Created June 23, 2011 06:52
Daemon script to start the spawn-cgi service with php-cgi, for example to support php with fcgi in Nginx
#!/bin/bash
#/etc/rc.d/rc.php-cgi
#spawn-fcgi -a 127.0.0.1 -p 9000 -u nobody -g nobody -f /usr/bin/php-cgi
IP=127.0.0.1
PORT=9000
USER=nobody
GROUP=nobody
@slok
slok / nginx.conf
Created June 23, 2011 06:54
Nginx config file
#/etc/nginx/nginx.conf
user nobody nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
@slok
slok / bash_profile.sh
Created June 23, 2011 07:00
.bashrc and .bash_profile config files
##/home/slok/.bash_profile
# Source .bashrc
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi