Skip to content

Instantly share code, notes, and snippets.

View toniher's full-sized avatar

Toni Hermoso Pulido toniher

View GitHub Profile
@toniher
toniher / neo4jclient-ncbi-py2neo-1.6.py
Created February 7, 2015 12:48
py2neo 1.6 version of script requesting distance and parent from NCBI Taxonomy Neo4j database
#!/usr/bin/env python
from py2neo import neo4j
import sys
import logging
import argparse
from inspect import getmembers
from pprint import pprint
parser = argparse.ArgumentParser()
parser.add_argument("acc1",

Keybase proof

I hereby claim:

  • I am toniher on github.
  • I am toniher (https://keybase.io/toniher) on keybase.
  • I have a public key whose fingerprint is A3B2 B108 0990 FB04 454E F32E BB7E 8E7B 8D1C C5BE

To claim this, I am signing this object:

@toniher
toniher / hls.sh
Created March 28, 2016 23:17
Bash script for starting hls with ffmpeg in a raspberry pi
#!/bin/bash
base=/var/hls
mkdir -p $base
cd $base
raspivid -n -w 720 -h 405 -fps 25 -vf -t 86400000 -b 1800000 -ih -o - \
| ffmpeg -y \
@toniher
toniher / hls.service
Last active March 28, 2016 23:22
Simple hls systemd unit
[Unit]
Description=hls: starts hls service
After=nginx.service
[Service]
Type=forking
User=www-data
ExecStart=/usr/local/bin/hls.sh
Restart=on-failure
@toniher
toniher / Dockerfile
Created September 3, 2016 07:39
Example of changing uid and gid of a Docker image - MariaDB
FROM mariadb:10.1
# To be changed here
ENV MYSQL_UID 27
ENV MYSQL_GID 27
RUN usermod -u $MYSQL_UID mysql; groupmod -g $MYSQL_GID mysql;
RUN chown -R mysql:mysql /var/lib/mysql /var/run/mysqld
@toniher
toniher / importWikiEsExtract.py
Last active February 4, 2018 09:36
Simple Python script for extraction es wikipedia extract text
import sys
import requests
import urllib
pagename = str( ' '.join( sys.argv[1:] ) )
wikiurl = "https://es.wikipedia.org/w/api.php?action=query&format=json&titles="+urllib.quote_plus( pagename )+"&prop=extracts&exintro&explaintext&redirects=true"
r = requests.get(wikiurl)
@toniher
toniher / putingroups.pl
Created April 10, 2018 13:56
Simple script for putting in groups in a random way
#!/usr/bin/env perl
use Data::Dumper;
use Text::Trim;
use POSIX;
use List::Util qw(shuffle);
my $file = shift;
my @struct;
my @groups;
@toniher
toniher / mediawiki-phpbrew.md
Last active April 18, 2020 11:11
PHP installation via phpbrew for MediaWiki

phpbrew install php-7.2.28 +default +mcrypt +hash +exif +mbstring +zip +fileinfo +ctype +zlib +curl +xml +mysql +xmlrpc +iconv +intl +fpm +sqlite +openssl=shared -- --with-libdir=lib64

phpbrew ext install redis latest

@toniher
toniher / newRecursive.php
Last active May 22, 2018 16:45
Basic recursive iterator for generating a file and directory array
<?php
# Based on https://secure.php.net/manual/en/class.recursivedirectoryiterator.php#111142
# Based on https://stackoverflow.com/questions/834303/startswith-and-endswith-functions-in-php
$hidden = false;
if ( count( $argv ) > 1 ) {
$ritit = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($argv[1], RecursiveIteratorIterator::SELF_FIRST) );
$r = array();
@toniher
toniher / docker2singularity.sh
Last active February 2, 2020 07:52
Bash script wrapper for generating a singularity image from a local Docker image
#!/bin/bash
# Based on https://github.com/sylabs/singularity/issues/1537
# Usage: bash docker2singularity.sh mydockerimg mysingularity.simg
set -ueo pipefail
IMG=$1
FILEOUT=$2
PORT=${3:-5000}