Skip to content

Instantly share code, notes, and snippets.

View loretoparisi's full-sized avatar
🐍
NightShift

Loreto Parisi loretoparisi

🐍
NightShift
View GitHub Profile
@loretoparisi
loretoparisi / ffmpeg_frames.sh
Last active April 19, 2024 05:17
Extract all frames from a movie using ffmpeg
# Output a single frame from the video into an image file:
ffmpeg -i input.mov -ss 00:00:14.435 -vframes 1 out.png
# Output one image every second, named out1.png, out2.png, out3.png, etc.
# The %01d dictates that the ordinal number of each output image will be formatted using 1 digits.
ffmpeg -i input.mov -vf fps=1 out%d.png
# Output one image every minute, named out001.jpg, out002.jpg, out003.jpg, etc.
# The %02d dictates that the ordinal number of each output image will be formatted using 2 digits.
ffmpeg -i input.mov -vf fps=1/60 out%02d.jpg
@loretoparisi
loretoparisi / github_quick_setup.md
Last active April 10, 2024 18:25
Github Quick setup — if you’ve done this kind of thing before

Get started by creating a new file or uploading an existing file. We recommend every repository include a README, LICENSE, and .gitignore.

…or create a new repository on the command line

echo "# myrepo" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/loretoparisi/myrepo.git
git push -u origin master
@loretoparisi
loretoparisi / macos-tts-say-voices.txt
Created October 26, 2016 21:40
macOS Sierra Text to Speech (TTS) Voices
Alex en_US # Most people recognize me by my voice.
Alice it_IT # Salve, mi chiamo Alice e sono una voce italiana.
Alva sv_SE # Hej, jag heter Alva. Jag är en svensk röst.
Amelie fr_CA # Bonjour, je m’appelle Amelie. Je suis une voix canadienne.
Anna de_DE # Hallo, ich heiße Anna und ich bin eine deutsche Stimme.
Carmit he_IL # שלום. קוראים לי כרמית, ואני קול בשפה העברית.
Damayanti id_ID # Halo, nama saya Damayanti. Saya berbahasa Indonesia.
Daniel en_GB # Hello, my name is Daniel. I am a British-English voice.
Diego es_AR # Hola, me llamo Diego y soy una voz española.
Ellen nl_BE # Hallo, mijn naam is Ellen. Ik ben een Belgische stem.
@loretoparisi
loretoparisi / sanremo_music_festival_dataset_1951-2019.csv
Created January 21, 2020 00:51
Sanremo Music Festival Dataset Tracks 1951 - 2019
We can make this file beautiful and searchable if this error is corrected: Illegal quoting in line 3.
track_year track_id track_pos artist_name track_name track_writers track_votes
1951 1 Nilla Pizzi Grazie dei Fiori G. C. Testoni, M. Panzeri,S. Seracini 50
1951 1 2 Nilla Pizzi,Achille Togliani "La luna si veste d'argento" V. Mascheroni,Biri 30
1951 2 3 Achille Togliani Serenata a nessuno W. Colì 20
1951 3 F Achille Togliani,Duo Fasano Al mercato di Pizzighettone N. Ravasini,A. Locatelli
1951 4 F Nilla Pizzi,Achille Togliani Eco tra gli abeti E. Bonagura,C. A. Rossi
1951 5 F Achille Togliani,Duo Fasano Famme durmì V. Panzuti,Danpa
1951 6 F Duo Fasano La cicogna distratta Da Rovere, A. Valleroni,Carrel
1951 7 F Nilla Pizzi,Duo Fasano La margherita E. B. Valdes
1951 8 F Achille Togliani Sedici anni L. Gambetti, M. Mariotti,A. Mari
@loretoparisi
loretoparisi / lda.js
Created March 15, 2018 13:37
LDA in JavaScript
/**
* Latent Dirichlet Allocation
* Based on javascript implementation https://github.com/awaisathar/lda.js
* @author Loreto Parisi (loretoparisi at gmail dot com)
*/
"use strict";
/**
* Based on javascript https://github.com/primaryobjects/lda/
@loretoparisi
loretoparisi / wavesurfer.js
Last active December 20, 2023 00:08
Wavesurfer js setup with timing labels and time formating callback
/**
* Wavesurfer.js minimalistic example with
* regions loading, save, plugins, waveform loading from json, waveform zoom, player events, keyboard codes, auto play
* @author: Loreto Parisi (loretoparisi at gmail dot com) - mainly, some code and functions adpated from Wavesurfer examples
* @disclaimer: code adapted from online examples
*/
// JavaScript
// Wrap the native DOM audio element play function and handle any autoplay errors
@loretoparisi
loretoparisi / jquery_injection.js
Created October 18, 2017 21:15
Jquery Code Injection
script = document.createElement('script');script.src = "https://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js";document.getElementsByTagName('head')[0].appendChild(script);
@loretoparisi
loretoparisi / sanremo_music_festival_tracks_dataset.js
Last active August 16, 2023 17:58
Sanremo Music Festival Tracks Dataset
script = document.createElement('script');script.src = "https://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js";document.getElementsByTagName('head')[0].appendChild(script);
function download(name,jsonObject) {
var fileContents = JSON.stringify(jsonObject, null, 2);
var pp = document.createElement('a');
pp.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(fileContents));
pp.setAttribute('download', name+'.json');
pp.click();
}
const title = $('.firstHeading').text().replace(/[aA-zZ]/g,'').trim();
const table = $('.wikitable').length - 1;
@loretoparisi
loretoparisi / gist:c147ca437ab9d5e163b7
Created October 23, 2015 22:01
Using JavaScript and k-means to find the dominant colors in images
<html>
<head>
<!-- adapted from http://charlesleifer.com/blog/using-python-and-k-means-to-find-the-dominant-colors-in-images/ -->
<script type="text/javascript">
function euclidean(p1, p2) {
var s = 0;
for (var i = 0, l = p1.length; i < l; i++) {
s += Math.pow(p1[i] - p2[i], 2)
}
@loretoparisi
loretoparisi / english_contractions_dataset.json
Last active June 17, 2023 01:49
List of English contractions from Wikipedia
{
"ain't": "am not / is not / are not / has not / have not / did not",
"amn't": "am not",
"aren't": "are not",
"can't": "cannot",
"'cause": "because",
"could've": "could have",
"couldn't": "could not",
"couldn't've": "could not have",
"daren't": "dare not / dared not",