Skip to content

Instantly share code, notes, and snippets.

@gialloporpora
gialloporpora / README.md
Created October 25, 2015 07:44 — forked from hofmannsven/README.md
My simply Git Cheatsheet
@gialloporpora
gialloporpora / vigenere.js
Last active August 29, 2015 14:05
This code implement the Vigenere cypher to solve EFF Puzzle (2014).
/*
This is the implementation in JS of the Vigenere cypher to solve EFF puzzle:
https://www.eff.org/deeplinks/2014/08/effs-defcon-22-t-shirt-puzzle-explained
*/
String.prototype.charOrdinalCodeAt = function(pos){
/*
This function returns this values:
* -1 if the character at position pos is not a letter;
* if the character at position pos is a letter it returns the positional value in alphabet, for lower case letter it returns its positional value + 26, for example:
@gialloporpora
gialloporpora / exl.py
Created April 27, 2014 08:52
Extracts links from a json file
import re
def elff(filename):
f = open(filename, "r")
s=f.read()
f.close()
regex = re.compile(r'"(http[^"]*)"')
links = regex.findall(s)
return links
def savefile(filename, s):
@gialloporpora
gialloporpora / key-view-watched-thread-with-unread.js
Created April 25, 2014 14:31
This code add an hotkey to switch from View Watched Thread with Unread and All Thread in Thunderbird using userChrome.js add-on.
if (location == "chrome://messenger/content/messenger.xul") {
/* Aggiungo l'accel text nella voce di menu */
document.getElementById('viewWatchedThreadsWithUnreadMenuItem').setAttribute('acceltext', 'Maiusc+W');
/* Seleziono il main keyset dove sono inserite le scorciatoie da tastiera */
let ks = document.getElementById('mailKeys');
/* Creo una nuova chiave */
let nk = document.createElement('key');
nk.setAttribute('id', 'key_viewwatchedthreadwithunread');
nk.setAttribute('modifiers','shift');
nk.setAttribute('keycode', 'w');
@gialloporpora
gialloporpora / svn-sheatsheet.md
Last active December 22, 2015 05:29
SVN cheatsheet

SVN cheatsheet

Clonare da server remoto

svn checkout URL svn co URL

Aggiornare la copia locale

svn up
@gialloporpora
gialloporpora / gist:4572776
Created January 19, 2013 13:49
This batch file saves the list of installed programs in a tXT file for printing.
@echo off
REM Reference: http://www.techrepublic.com/forum/questions/101-215911/dos-command-to-list-all-installed-programs
echo ================= >>software_list.txt
reg export HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall temp1.txt
find "DisplayName" temp1.txt| find /V "ParentDisplayName" > temp2.txt
for /f "tokens=2,3 delims==" %%a in (temp2.txt) do (echo %%a >> software_list.txt)
del temp1.txt
del temp2.txt
REM type software_list.txt | more
echo.
@gialloporpora
gialloporpora / example_base64.md
Created September 6, 2012 13:37
Esempio di pagina HTML codificata come URL

// Questa è una pagina web codificata in base64:

data:text/html;base64,PGh0bWw+DQo8aGVhZD4NCjx0aXRsZT4NClBoaXNoaW5nDQo8L3RpdGxlPg0KPC9oZWFkPg0KPGJvZHk+DQo8aDE+SGVsbG8gd29ybGQhPC9oMT4NCjxhIGhyZWY9ImRhdGE6dGV4dC9odG1sO2Jhc2U2NCxQR2gwYld3K0RRbzhhR1ZoWkQ0TkNqeDBhWFJzWlQ0TkNsQm9hWE5vYVc1bkRRbzhMM1JwZEd4bFBnMEtQQzlvWldGa1BnMEtQR0p2WkhrK0RRbzhhREUrU0dWc2JHOGdkMjl5YkdRaFBDOW9NVDROQ2p4aElHaHlaV1k5SW1acGJHVTZMeTh2UkRvdlEwbEJUMzR4TGtoVVRTSWdkR0Z5WjJWMFBTSmZZbXhoYm1zaVBreHBibXNnZEc4Z2RHaHBjeUJ3WVdkbFBDOWhQZzBLUEM5aWIyUjVQZzBLUEM5b2RHMXNQZz09IiB0YXJnZXQ9Il9ibGFuayI+TGluayB0byB0aGlzIHBhZ2U8L2E+DQo8L2JvZHk+DQo8L2h0bWw+
@gialloporpora
gialloporpora / lastfm.py
Created August 16, 2012 22:32
Download album art from Last.fm. It requires PyQuery module.
# download images from last.fm
# PyQuery is a very powerful module to parse HTML pages, but it is not by default distributed with Python
# if you want install it you need first install lxml module
# Same features of this script works only with pyquery, but the most important ones (download images of cover and artist) works without installing it
try:
from pyquery import PyQuery as pq
pyquery = True
except ImportError:
@gialloporpora
gialloporpora / tail.bat
Created July 31, 2012 17:23
Batch file to emulate tail command using SED
@echo off
if "%2"=="" (set lines=3) else (set lines=%2)
set /a lines=%lines% + 1
set sed="$q;N;%lines%,$D;ba"
sed -e :a -e %sed% %1
@gialloporpora
gialloporpora / base64.bat
Created July 13, 2012 16:00
Batch script to obtain the encoded base64 url of a file
@echo off
set tempfile="%~dp0\temp.txt"
set mimetypes=%~dp0mimetypes.txt
REM Extracting the extension of the file
set ext=%~x1_
REM Removing the period for using as correct variable name
set ext=%ext:~1,-1%
REM Load mimetypes from file, if some mimetype is missing update the file mimetypes.txt
REM for any mimetypes is created a variable mime_mimetype, for example mime_png for image/png
for /f "delims== tokens=1,2 eol=#" %%i in (%mimetypes%) do set mime_%%i=%%j