Skip to content

Instantly share code, notes, and snippets.

@mattb
mattb / summarize_youtube.sh
Created January 1, 2024 23:43
Download the automatic subtitle track from Youtube and summarize it with a local LLM
yt-dlp --skip-download --write-auto-sub --sub-format ttml --sub-lang en -o /tmp/out $1 &&
(
echo 'Summarize the following YouTube transcript:\n' > /tmp/out1
cat /tmp/out.en.ttml | grep ^\<p | cut -d\> -f 2 | cut -d \< -f 1 >> /tmp/out1
cat /tmp/out1 | ollama run mistral
)
@mattb
mattb / wordle-word-score.js
Created January 24, 2022 07:21
Calculating scores of first word choice in Wordle
// node wordle-word-score.js | sort -n
const fs = require('fs');
words = [];
dict = [];
idx = {};
fs.readFileSync('wordledict.txt', 'utf-8').split(/\r?\n/).forEach(line => dict.push(line));
fs.readFileSync('wordlewords.txt', 'utf-8').split(/\r?\n/).forEach(line => {
words.push(line);
line.split("").forEach((letter, i) => {
{
"parserOptions": {
"ecmaVersion": 8
},
"env": {
"jest": true,
"browser": true,
"es6": true,
"node": true
},
- name: Docker registry
docker: image=registry:0.9.0 ports=5000:5000 name=registry env="SETTINGS_FLAVOR=s3,AWS_BUCKET=docker-something,STORAGE_PATH=/registry,AWS_KEY=...,AWS_SECRET=...,SEARCH_BACKEND=sqlalchemy" state=running
@mattb
mattb / gist:22a8b666c2390c16c26c
Created November 16, 2014 03:17
Twitter IDs from 12500 to 12578
12500 - @phuly Phu
12501 - @mathie Graeme Mathieson
12502 - @BenJenkinson Ben Jenkinson
12503 - @martinsmith Martin Smith
12504 - @SteveMarshall Steve Marshall
12505 - @IcepickFIA Calum Heriot
12506 - @Marchdoe Doug March
12507 - @pixielauren Lauren
12508 - @willhowat Will Howat
12509 - @jiserra Juan Ignacio
12514 - @tomcoates Tom Coates
12515 - @indranil Indranil Dasgupta
12517 - @Neil_Ford Neil Ford
12520 - @LittleRita Rita
12521 - @josephinesiew Josephine Phua
12522 - @cc_chapman C.C. Chapman
12523 - @KDAWG KRISTIN
12526 - @paul_howard Paul Howard
12527 - @pincushiontreat Melizza
12528 - @jw Josh Williams
### Keybase proof
I hereby claim:
* I am mattb on github.
* I am mattb (https://keybase.io/mattb) on keybase.
* I have a public key whose fingerprint is 7BB0 E602 A356 DED9 D06D 694D 5A78 41CB AD19 4BE3
To claim this, I am signing this object:
@mattb
mattb / gist:90b7d6f9bc1f96ddb3af
Last active August 29, 2015 14:03
Check the mayday.us total once every 60 seconds and print stats.
ruby -rjson -ropen-uri -e 'last = - 1; while true; dollars=(JSON.parse(open("https://pledge.mayday.us/r/total").read)["totalCents"] - 100000000)/100; puts "$#{dollars} raised. $#{5000000-dollars} to go.#{last == -1 ? "" : " #{sprintf("%6s", "$"+(dollars-last).to_s)} in the last 60 seconds. #{"*" * ((dollars-last)/250.0).round}"}"; last = dollars; sleep 60 ; end'
@mattb
mattb / gist:d5e4750176275c13e300
Created June 19, 2014 07:26
ASCII-histogram of distribution of distances of NYC cab rides in 2013 - see https://gist.github.com/mattb/da8d779573a10300e512
************************************************************** 0.25 miles
***************************************************************************************************************** 0.5 miles
**************************************************************************************************************************** 0.75 miles
************************************************************************************************************************* 1.0 miles
*********************************************************************************************************** 1.25 miles
************************************************************************************************* 1.5 miles
************************************************************************************ 1.75 miles
*************************************************************************** 2.0 miles
***************************************************************** 2.25 miles
*********************************************************** 2.5 miles
@mattb
mattb / gist:da8d779573a10300e512
Last active August 29, 2015 14:02
Calculating the median distance and time of NYC taxi rides in 2013
// transcribed from an Apache Spark 1.0 spark-shell session
// using data from http://chriswhong.com/open-data/foil_nyc_taxi/
// and the QTree algorithm for approximate quantiles over large datasets
// each of the distanceRange and minutesRange calculations below takes about 15 minutes on my four-core SSD-based Macbook Pro
import com.twitter.algebird._
import com.twitter.algebird.Operators._
implicit val qtSemigroupD = new QTreeSemigroup[Double](6)
val in = sc.textFile("trip_data") // a directory containing all the trip_data*.csv files downloaded from the above link