Skip to content

Instantly share code, notes, and snippets.

View loretoparisi's full-sized avatar
🐍
NightShift

Loreto Parisi loretoparisi

🐍
NightShift
View GitHub Profile
say --voice="?"
Albert en_US # Hello! My name is Albert.
Alice it_IT # Ciao! Mi chiamo Alice.
Alva sv_SE # Hej! Jag heter Alva.
Amélie fr_CA # Bonjour! Je m’appelle Amélie.
Amira ms_MY # Hi my name is Amira
Anna de_DE # Hallo! Ich heiße Anna.
Bad News en_US # Hello! My name is Bad News.
Bahh en_US # Hello! My name is Bahh.
Bells en_US # Hello! My name is Bells.
@loretoparisi
loretoparisi / activemq_run.sh
Last active May 31, 2023 10:22
ActiveMQ Up & Run Linux
wget https://dlcdn.apache.org//activemq/5.18.1/apache-activemq-5.18.1-bin.tar.gz
gunzip apache-activemq-5.18.1-bin.tar.gz
tar -xvf apache-activemq-5.18.1-bin.tar
cd apache-activemq-5.18.1
cd conf
myIP=$(LANG=C /sbin/ifconfig | sed -ne $'/127.0.0.1/ ! { s/^[ \t]*inet[ \t]\\{1,99\\}\\(addr:\\)\\{0,1\\}\\([0-9.]*\\)[ \t\/].*$/\\2/p; }')
sed -i "s/localhost/${myIP}/" jetty.xml
cd ..
cd bin
./activemq start
@loretoparisi
loretoparisi / longest_subsequence_bisect.py
Created January 26, 2023 16:43
Longest Common Sub Sequence (LCS) Bisect
def longest_subsequence_bisect(seq, mode='strictly', order='increasing',
key=None, index=False):
"""
@TODO: to replace longest_subsequence_linear
>>> longest_subsequence_bisect([1,2,3,4,5,6,7,2,2,2,2,2,5,1,7,8])
Return the longest increasing subsequence of `seq`.
@loretoparisi
loretoparisi / longest_subsequence_linear.py
Created January 26, 2023 16:42
Longest Common Sub Sequence (LCS) Linear
def longest_subsequence_linear(seq, keyfn=lambda value: value):
''' Longest Increasing Subsequence
>>> seq = [0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15]
>>> lis(seq)
[0, 2, 6, 9, 11, 15]
>>> lis([])
[]
'''
if not seq: return seq
@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 / REPRO_CONDA_SETUP.md
Created August 25, 2022 22:09 — forked from lmmx/REPRO_CONDA_SETUP.md
Demo of Stable Diffusion usage, storing the prompt in metadata https://twitter.com/permutans/status/1562471438501548034
@loretoparisi
loretoparisi / stablediffusionwalk.py
Created August 25, 2022 10:49 — forked from karpathy/stablediffusionwalk.py
hacky stablediffusion code for generating videos
"""
stable diffusion dreaming
creates hypnotic moving videos by smoothly walking randomly through the sample space
example way to run this script:
$ python stablediffusionwalk.py --prompt "blueberry spaghetti" --name blueberry
to stitch together the images, e.g.:
$ ffmpeg -r 10 -f image2 -s 512x512 -i blueberry/frame%06d.jpg -vcodec libx264 -crf 10 -pix_fmt yuv420p blueberry.mp4
@loretoparisi
loretoparisi / diffusers.py
Created August 24, 2022 12:49
Stable Diffusion Pipeline
# make sure you're logged in with `huggingface-cli login`
import os
from torch import autocast
from diffusers import StableDiffusionPipeline, LMSDiscreteScheduler
lms = LMSDiscreteScheduler(
beta_start=0.00085,
beta_end=0.012,
beta_schedule="scaled_linear"
)
@loretoparisi
loretoparisi / coders.md
Last active June 3, 2022 12:55
coders+00001

coders+00001

Chief: "if this than that…"
Newbie Coder: "tap tap tap…" (coding)

(5 years later…)

Chief: "if this than that…"
Veteran Coder: (Go to team) "If this than that…"

(5 minutes later…)

@loretoparisi
loretoparisi / wikidata_properties.sparql
Created April 1, 2022 08:30
Wikidata Entity Properties Sparql query
SELECT ?wdLabel ?ooLabel
WHERE {
VALUES (?s) {(wd:%@)}
?s ?wdt ?o .
?wd wikibase:directClaim ?wdt .
?wd rdfs:label ?wdLabel .
OPTIONAL {
?o rdfs:label ?oLabel .
FILTER (lang(?oLabel) = "en")
}