Skip to content

Instantly share code, notes, and snippets.

View mapio's full-sized avatar
🎯
Focusing

Massimo Santini mapio

🎯
Focusing
View GitHub Profile
@mapio
mapio / b2
Last active December 6, 2015 02:47
A bash_completion file for b2
have b2 &&
_b2 () {
local _b2_subcommands=(
'authorize_account'
'clear_account'
'create_bucket'
'delete_bucket'
'delete_file_version'
'download_file_by_id'
'download_file_by_name'
from json import loads, dumps
from base64 import b64decode, b64encode
def relocate( conf_data, old_path, new_path ):
def rdt( dct ):
for k, v in dct.items():
if isinstance( v, dict ):
rdt( v )
else:
@mapio
mapio / 30.svg
Last active January 20, 2016 16:12
The Hasse diagram of the divisibility graph
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mapio
mapio / query_atm_stop
Last active March 24, 2019 09:44
A tool to query ATM stops
#!/bin/bash
if ! type jq >/dev/null 2>&1; then
echo >&2 "$(basename $0): please install https://stedolan.github.io/jq/ first."
exit 1
fi
if [ -z "$1" ]; then
echo >&2 "$(basename $0): plase provide stop number (see http://giromilano.atm.it/)"
exit 1
@mapio
mapio / LexicographicListComparator.java
Last active May 3, 2016 14:10
A List Comparator implementing Lexicographic order
import static org.junit.Assert.assertEquals;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import org.junit.Test;
public class LexicographicListComparator {
@mapio
mapio / install_firma.sh
Last active October 16, 2017 08:38
Installa "firma" nel file .bashrc
#!/bin/bash
rc="$HOME/.bashrc"
jars="$HOME/.labprog-jars"
if [ ! -w "$rc" ]; then
echo "Attenzione, il file .bashrc non era presente, l'installazione potrebbe fallire"
fi
if grep -q "### labprog-firma (non cancellare questa riga e le seguenti)" "$rc"; then
@mapio
mapio / HOWTO-ML4A-OSX-GPU.md
Last active November 22, 2016 22:10
How to install the required libs for ML4A on OS X with GPU support

How to setup a virtualenv for ml4a on OS X with GPU support

Requirements

This is tested on OS X 10.11.6 running on a MacBook Pro with NVIDIA GeForce GT 750M as of Tuesday, November 22, 2016; if you are note sure about your system, run

sw_vers
@mapio
mapio / Dijkstra.ipynb
Last active November 23, 2016 12:00
Apparently not so nice…
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mapio
mapio / config
Created March 17, 2017 21:01
How to smudge Jupyter notebooks in git
[filter "handle-ipynb-output"]
clean = "jupyter nbconvert --to notebook --NbConvertApp.from_stdin=True --ClearOutputPreprocessor.enabled=True --NbConvertApp.writer_class=StdoutWriter"
smudge = cat
@mapio
mapio / graph.png
Last active July 23, 2020 22:22
Playing with my son Federico
graph.png