Skip to content

Instantly share code, notes, and snippets.

Avatar

Toni Hermoso Pulido toniher

View GitHub Profile
@toniher
toniher / pergola-webservice.py
Created Mar 7, 2019
Webservice script for using pergola through the Web
View pergola-webservice.py
# -*- coding: utf-8 -*-
"""
Pergola webservice client
~~~~~~~~~~~~~~~~~~~~~~~~~~~
More details at: https://pergola.crg.eu
Usage: python pergola-webservice.py myconfig.json myoutput.zip
"""
import requests
import json
import sys
@toniher
toniher / parseGff.pl
Created Feb 14, 2019
Handy parse of GFF files
View parseGff.pl
#!/usr/bin/env perl
# List of IDs - one per line
my $list = shift;
# File with potential IDs, it can be GFF but also othersH
my $gff = shift;
my @ids;
open( LIST, $list ) || die "Cannot open $list";
@toniher
toniher / docker2singularity.sh
Last active Feb 2, 2020
Bash script wrapper for generating a singularity image from a local Docker image
View docker2singularity.sh
#!/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}
@toniher
toniher / newRecursive.php
Last active May 22, 2018
Basic recursive iterator for generating a file and directory array
View newRecursive.php
<?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 / mediawiki-phpbrew.md
Last active Apr 18, 2020
PHP installation via phpbrew for MediaWiki
View mediawiki-phpbrew.md

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 / putingroups.pl
Created Apr 10, 2018
Simple script for putting in groups in a random way
View putingroups.pl
#!/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 / importWikiEsExtract.py
Last active Feb 4, 2018
Simple Python script for extraction es wikipedia extract text
View importWikiEsExtract.py
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 / Dockerfile
Created Sep 3, 2016
Example of changing uid and gid of a Docker image - MariaDB
View Dockerfile
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 / hls.service
Last active Mar 28, 2016
Simple hls systemd unit
View hls.service
[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 / hls.sh
Created Mar 28, 2016
Bash script for starting hls with ffmpeg in a raspberry pi
View hls.sh
#!/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 \