Skip to content

Instantly share code, notes, and snippets.

View barbolani's full-sized avatar

Alfonso García-Patiño Barbolani barbolani

View GitHub Profile
@barbolani
barbolani / mp3udownload.py
Last active April 7, 2019 13:38
Script that parses an m3u file, downloads its components and sets everything up to assemble all components as a single mp4 file using ffmpeg
import os
import re
import sys
import urllib.request
from urllib.parse import urlparse, urlunparse, ParseResult, urljoin
class M3UFile:
x_stream_inf = re.compile(r'#EXT-X-STREAM-INF:(?:.*),RESOLUTION=(\d+)x(\d+)(?:,(?:.*))*')
@barbolani
barbolani / gist:e1f1e1d7456f286ff29a
Last active January 20, 2016 17:59
You have executed Django's tests with python manage.py test xxxx >log.txt 2>&1 and want to see in which order they were executed
grep "^test\_.*(.*)" log.txt | awk '{ split($0,a,"(") ; split(a[2],b,")") ; print b[1] }' | uniq
@barbolani
barbolani / clean-names
Created February 18, 2015 18:45
Bash script to clean up file names
#!/bin/bash
#
# Often multimedia files downloaded from the internet contain
# as part of the filename things like the site from where they came
# the local language of the audio and such info that is not useful
# when you archive the file to your multimedia repository.
#
# This script renames a set of files, removing everything that does
# not look like part of the file name
#
@barbolani
barbolani / toipad
Last active August 29, 2015 14:15
Script to convert video files to a format that an iPad v1 is able to play
#!/bin/bash
#
# This is the script I use to convert video files to a format
# that my iPad 1 is able to play
#
# You use this script like this
# toipad [-o <output folder>] [FILE]...
# where
# -o <outputfolder> is optional and tells the destination folder for converted files
#
@barbolani
barbolani / Remove The Register headline article image
Last active August 29, 2015 14:13
This short snippet can be added to GreaseMonkey to supress the headline images that appear at the top of articles inThe Register site
// ==UserScript==
// @name Remove The Register article headline picture
// @namespace www.theregister.co.uk
// @description Remove headline image from articles
// @include http://www.theregister.co.uk/*
// @version 1
// @grant none
// ==/UserScript==
var img = document.getElementsByClassName("article_img")[0];
@barbolani
barbolani / Permutations
Created December 18, 2014 15:07
Prolog - generate list permutations
% Short permutation generator permutations(L,S) is true whenever S is a permutation
% of the elements of list L
permutations([],[]).
permutations( A, [R21 | X ] ) :-
append( L, [R21 | R22], A ),
append( L, R22, X2),
permutations( X2, X).