Skip to content

Instantly share code, notes, and snippets.

View kortina's full-sized avatar

kortina kortina

View GitHub Profile
@kortina
kortina / LebowskiPhrases.csv
Created March 28, 2021 04:23 — forked from zacs/LebowskiPhrases.csv
Text segmentation analysis of the Big Lebowski script, looking for multi-word phrase size and frequency.
Phrase Word Count Frequency
this is what happens when you fuck a stranger in the ass 12 2
he lives in north hollywood on radford near the in-and-out burger 11 2
it's a complicated case maude lotta ins lotta outs 9 2
so what the fuck are you talking about 8 2
what the fuck are you talking about 7 6
what the fuck is he talking about 7 2
we know that this is your homework 7 2
we throw the money out of the 7 2
you're out of your element this chinaman 7 2
@kortina
kortina / pocket-bookmarklet.js
Created March 31, 2020 02:47
Pocket Bookmarklet That Avoids Cookie Errors
// Was getting the following error on many sites with the 'official' Pocket Bookmarklet
// ( available at https://getpocket.com/add/?ep=1 )
//
// VM171:1 Refused to load the script 'https://getpocket.com/b/r4.js?h=qqualnjcokmhwrrxefqvqbftooidhfpmommvsfsecblmtqugvmwf46684f1f0&u=https%3A%2F%2Fwww.linkedin.com%2Fpulse%2Fmechanics-war-economy-ray-dalio%2F&t=(6)%20The%20Mechanics%20of%20the%20War%20Economy%20%7C%20LinkedIn'
// because it violates the following Content Security Policy directive:
// "script-src 'report-sample' 'sha256-6gLjSWp3GRKZCUFvRX5aGHtECD1wVRgJOJp7r0ZQjV0=' 'unsafe-inline' s.c.lnkd.licdn.com static-fstl.licdn.com static-src.linkedin.com https://www.linkedin.com/voyager/service-worker-push.js s.c.exp1.licdn.com s.c.exp2.licdn.com static-lcdn.licdn.com s.c.lcdn.licdn.com https://www.linkedin.com/sc/ https://www.linkedin.com/scds/ https://qprod.www.linkedin.com/sc/ https://www.linkedin.com/sw.js https://www.linkedin.com/voyager/abp-detection.js https://snap.licdn.com/li.lms-analytics/insight.mi
@kortina
kortina / ffmpeg-snippets.sh
Last active January 8, 2020 22:43
ffmpeg snippets
#!/usr/bin/env bash
########################################
# extract 1m 45s of video starting at 1h 3m 0s in input.mov and save to output.mov
input="input.mov"
output="output.mov"
ffmpeg -ss 01:03:00 -i "$input" -t 00:01:45 -c:v h264 -c:a pcm_s16le "$output"
########################################
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶
// Step 1: Get an API key here: https://developers.google.com/url-shortener/v1/getting_started#APIKey
// Step 2: Paste your api key below
// Step 3: Add the code below to your browser as a bookmark
// Step 4: Visit a non-goo.gl URL and click your bookmark
// NOTE: The security policy of some sites (such as this gist.github.com!) will prevent this from working.
// Check your javascript console if something doesn't work.
javascript:(function(){
var googleApiKey = 'INSERT YOUR API KEY HERE';
@kortina
kortina / postgres_queries_and_commands.sql
Created February 22, 2017 05:35 — forked from indigoviolet/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@kortina
kortina / dumb-read-time.js
Created January 22, 2015 21:31
dumb-read-time.js
var words = document.body.innerText.trim().replace(/\s+/gi, ' ').split(' ').length;
var avgwpm = 275; /* 275 words per min avg adult read speed */
console.log(words.toString() + " words / " + Math.round(words/avgwpm).toString() + " min read");
/* ref: https://medium.com/the-story/read-time-and-you-bc2048ab620c */
@kortina
kortina / growth.md
Last active December 20, 2015 14:59
Figuring out how to compute average period growth rate given start size, end size, and number of periods.
g = period growth rate, eg, % MOM growth
S = starting size
E = ending size
n = number of periods elapsed between S and E

We know that to compute E from S, g, and n, we can use the equation:

E = S * (1 + g) ^ n
@kortina
kortina / tesseract.md
Created June 8, 2013 23:21
Hacked together a little tool to search images from your camera uploads for a string of text.

Today, I was looking for some screenshots I wanted to use for a presentation, and rather than looking through all 1478 of my uploaded camera photos ( ls -1 ~/Dropbox/Camera\ Uploads/ | wc -l ), I decided to write a quick bash script to use the tesseract OCR tool to help me out.

I wanted to use https://github.com/jbochi/python-tesseract so first I installed the dependencies.

sudo pip install PIL
brew install tesseract
cd ~/Dropbox/git/
git clone git@github.com:jbochi/python-tesseract.git
~/Dropbox/git/python-tesseract/tesseract.py ~/Dropbox/Camera\ Uploads/2013-06-06\ 21.55.03.png 
chmod 700 ~/Desktop/find-images-with-text.sh