Skip to content

Instantly share code, notes, and snippets.

View patriziotufarolo's full-sized avatar

Patrizio Tufarolo patriziotufarolo

View GitHub Profile
@patriziotufarolo
patriziotufarolo / boolean_evaluator.py
Last active November 4, 2016 13:12
Simple evaluator for boolean expressions, supporting not, and, or, implies and iff operators. It supports nested formulas with parentheses. Based on http://stackoverflow.com/a/2472414/3800901
TOKEN = {
"True": True,
"False": False,
"and": lambda a, b: a and b,
"or": lambda a, b: a or b,
"implies": lambda a, b: (not a) or b,
"iff": lambda a, b: ((not a) or b) and ((not b) or a),
"not": lambda a: not a,
"(": "(",
")": ")"
@patriziotufarolo
patriziotufarolo / imunes-export.sh
Created March 15, 2016 21:45
IMUNES - Scripts to export data changed while running an experiment, and load them back
#!/bin/bash
ExperimentToLoad=$(docker ps | grep "imunes" | awk '{print $NF}' | cut -d . -f 1 | sort | uniq | awk 'NR==1{print "TRUE\n"$0} NR>1{print "FALSE\n"$0}'\
| zenity --list --radiolist --separator='\n' --title="Seleziona l'esperimento nel quale caricare i dati" --column="" --column="Nome" --text="Seleziona l'esperimento nel quale caricare i dati")
if [ -z "$ExperimentToLoad" ]; then
zenity --error --text "Esperimento non selezionato" --title "Errore"
exit;
fi