Skip to content

Instantly share code, notes, and snippets.

View balkian's full-sized avatar
馃彔
Working from home

J. Fernando S谩nchez balkian

馃彔
Working from home
View GitHub Profile
@balkian
balkian / copyMongo.js
Last active August 29, 2015 14:17
Copy one collection from a database to another in the same MongoDB
db.<collection_name>.find().forEach(function(d){ db.getSiblingDB('<new_database>')['<collection_name>'].insert(d); });
@balkian
balkian / setup.py
Created March 13, 2015 22:25
Load the requirements from requirements.txt into your setup.py
from pip.req import parse_requirements
# parse_requirements() returns generator of pip.req.InstallRequirement objects
install_reqs = parse_requirements("requirements.txt")
# reqs is a list of requirement
# e.g. ['django==1.5.1', 'mezzanine==1.4.6']
reqs = [str(ir.req) for ir in install_reqs]
@balkian
balkian / checkdic.py
Last active August 29, 2015 14:16
Check if key and value from template are present in indic
def check_dict(indic, template):
return all(item in indic.items() for item in template.items())
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@balkian
balkian / Git magic.md
Last active August 29, 2015 14:16
Useful commands for git

#GIT MAGIC

Create a submodule from a specific folder

git clone <your_project> <your_submodule>
cd <your_submodule>
git filter-branch --subdirectory-filter 'path/to/your/submodule' --prune-empty -- --all

Remove a file from history

@balkian
balkian / coding.py
Last active August 29, 2015 14:16
Flask server that returns GET parameters and values
a = u"codificaci贸n"
print a # u"codificaci贸n"
print type(a) # <type 'unicode'>
b = a.encode("utf-8")
print b # codificaci贸n # But it depends on your terminal settings
print type(b) # <type 'str'>
c = b.decode("utf-8")
print type(c) # <type 'unicode'>
print c # u"codificaci贸n"
"""
Usage: python remove_output.py notebook.ipynb [ > without_output.ipynb ]
Modified from remove_output by Minrk
"""
import sys
import io
import os
from IPython.nbformat.current import read, write
@balkian
balkian / upload.sh
Created January 14, 2015 10:36
Fuseki commands
curl http://alpha.gsi.dit.upm.es:3030/onyx/upload -F 'UNSET FILE [email protected];type=application/rdf+xml' -F 'graph=http://example.com/prueba'
@balkian
balkian / ontology.sh
Last active October 30, 2021 10:58
Upload ontologies to GSI server
if [ $# -lt 1 ]
then
ONTO=onyx
else
ONTO=$1
fi
if [ $# -lt 2 ]
then
DIR=~/Doctorado/Ontologies/Onyx
else
@balkian
balkian / modules
Created November 7, 2014 14:55
Modules for TFT 3.2 Raspberry Pi
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
# Parameters can be specified after the module name.
snd-bcm2835
i2c-bcm2708
i2c-dev
fbtft_device name=flexfb gpios=dc:22,reset:27 speed=48000000