Skip to content

Instantly share code, notes, and snippets.

View timendum's full-sized avatar

Timendum timendum

  • Italy
View GitHub Profile
@timendum
timendum / stopwords-it.txt
Last active May 24, 2018 10:58
Stopwords
adesso
allora
altre
altri
altro
ancora
avere
ben
bene
buono
@timendum
timendum / create.sh
Last active September 10, 2020 11:05
Create a GIF with ffmpeg
ffmpeg -y -ss $BEGIN -t $LENGTH -i $INPUT cut.mkv
ffmpeg -i cut.mkv -vf cropdetect=24:16:0 -f null -
ffmpeg -i cut.mkv -vf crop=$CROP cropped.mkv
ffmpeg -y -i cropped.mkv -vf fps=10,scale=320:-1:flags=lanczos,palettegen palette.png
ffmpeg -y -i cropped.mkv -i palette.png -filter_complex "fps=10,scale=400:-1:flags=lanczos[x];[x][1:v]paletteuse" output.gif
# example:
# $INPUT = file.mkv
# $BEGIN = 00:00:50.5
# $LENGTH = 1.6
### Keybase proof
I hereby claim:
* I am timendum on github.
* I am timendum (https://keybase.io/timendum) on keybase.
* I have a public key whose fingerprint is BAE7 79F7 5132 386E C2DE 938F 0CE8 A46B 020F 4ABA
To claim this, I am signing this object:
@timendum
timendum / gist:1122292
Created August 3, 2011 09:51
View the definition of a user defined function in MS SQL Server
SELECT OBJECT_DEFINITION(OBJECT_ID('dbo.Function_Name'));
@timendum
timendum / BirthAge.java
Created July 27, 2011 10:13
Calculate the age from birth date
/**
* Calculate the age from birth date
* @param birth the birth date
* @return the age
*/
public static int getAge(Calendar birth) {
Calendar today = Calendar.getInstance();
int age = today.get(Calendar.YEAR) - birth.get(GregorianCalendar.YEAR);
if (
today.get(Calendar.MONTH) < birth.get(GregorianCalendar.MONTH) ||
@timendum
timendum / CfDate.java
Created July 27, 2011 10:12
Calculate the birth date form CodiceFiscale
public static GregorianCalendar getDateFromCF(String cf) {
GregorianCalendar date = new GregorianCalendar();
int anno = Integer.parseInt("19" + cf.substring(6, 8));
date.set(GregorianCalendar.YEAR, anno);
int month = 0;
switch (Character.toUpperCase(cf.charAt(8))) {
case 'A':
month = GregorianCalendar.JANUARY;
break;
@timendum
timendum / gist:1109073
Created July 27, 2011 10:11
Check if a page is in a frame
if (top != self) {
//framed
} else {
// stand-alone
}
@timendum
timendum / gist:1109072
Created July 27, 2011 10:10
Check exit status in Windows
if %errorlevel% == 0 goto :ENDD
@timendum
timendum / sleep.bat
Created July 27, 2011 10:10
Sleep in Windows shell [ trick ]
ping 1.1.1 -w 10 >/null
@timendum
timendum / check-gzip.sh
Created July 27, 2011 10:09
Check if gzip is enabled [ http bash curl ]
curl -I -H "Accept-Encoding: gzip,deflate" "$URL" --silent | grep -i "Content-Encoding:"
# OR
curl -H "Accept-Encoding: gzip,deflate" "$URL" --silent --write-out "%{size_download}" --output /dev/null
curl "$URL" --silent --write-out "%{size_download}" --output /dev/null
# 2nd must be greater the 1st