Skip to content

Instantly share code, notes, and snippets.

@frasten
frasten / init.lua
Created March 22, 2017 19:37
NodeMCU Init script to avoid semi-brick on infinite loops
local IDLE_AT_STARTUP_MS = 5000;
local DELTA = 1000
local current = 0
local function printRimanente()
local rimanente = (IDLE_AT_STARTUP_MS - current)
print("Caricamento. Hai ancora " .. rimanente .. "ms per annullare modificando program.lua...")
end
@frasten
frasten / mac-open-with-remove-duplicates.sh
Created October 10, 2012 22:29
Mac Open with... list: remove duplicates
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/\
LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local\
-domain system -domain user
@frasten
frasten / gist:1497741
Created December 19, 2011 15:50
Istruzioni blocchi ADL PPDL
Considerare il mondo dei blocchi a 4 operatori
vogliamo che generi uno stato in cui tutti i blocchi sono sul tavolo.
In un qualche istante.
Possiamo farlo come un'azione speciale che ha come precondizione che tutti
i blocchi siano sul tavolo.
Aggiungo al dominio l'azione:
(
:action all-on-table
:parameter (?t - table)
@frasten
frasten / esempi-classi.php
Created October 28, 2011 14:37
esempi-classi.php
<?php
error_reporting(E_ALL);
class Matematica {
function quadrato($num) {
if (! is_numeric($num)) die();
return $num * $num;
}
@frasten
frasten / Makefile
Created October 3, 2011 14:24
Makefile per LaTeX
all: tesi
tesi:
pdflatex -shell-escape tesi.tex
clean:
rm -f tesi.aux tesi.idx tesi.log tesi.toc tesi.pdf tesi.out
@frasten
frasten / gist:814376
Created February 7, 2011 13:43
My public SSH key
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA3yFy7itt35k3oobo6wGrxbNMqTgkndEG6E+6QO0K9JXiyzNXCgau5HcKR9Jv4UauhyKzY5BBU9le3rs/o9IC8yxDsXoop4Sxafoeq4XODv1sdMEoRZ/CdggK+pTRFOjocS+hmhg0ijkEQrJjqzk/IhLsVaHH9PtbTBMZpp8RT8ZOlig+O13fB75yLZE18CMESyJ6PlAF1eqwQzVPlSuguKYxVc2pwXKen+5AmpciNSJgT4t7Nu9hEt+DWwEZh8BkzGwpNwhBKRcMK7S0DDREtSwdGS/vXVaGBi68iPVWMJn2YqMnVQXeM2xYIZ5wkW5cxNfamu4Y7vb8f6CS3dTvKQ== Chiave SSH da frasten@cthulhu
@frasten
frasten / gist:803433
Created January 30, 2011 23:47
IE, getElementById, gli id e le variabili omonime
<html>
<head>
</head>
<body>
<div id="mario"></div>
<script type="text/javascript">
// Questo da errore
mario = 1;
@frasten
frasten / gist:796734
Created January 26, 2011 14:09
Eseguire un comando piu' volte in parallelo
for i in {1..4}; do (COMANDO_DA_ESEGUIRE > output_$i &) ; done
@frasten
frasten / gist:669018
Created November 9, 2010 12:11
Creare patch SVN con file binari
svn diff --force --diff-cmd /usr/bin/diff -x "-au --binary" > patch.patch
# Per importarla:
patch -p0 < patch.patch
http://leandrovieira.com/projects/jquery/lightbox/