Skip to content

Instantly share code, notes, and snippets.

View gartenfeld's full-sized avatar

David Rosson gartenfeld

View GitHub Profile
<a href="data:text/plain;charset=utf-8;base64,Zm9vIGJhcg==">Data as URI</a>
@gartenfeld
gartenfeld / app.js
Created March 21, 2017 20:50 — forked from Turbo87/app.js
webpack + font-awesome test
require('font-awesome/css/font-awesome.css');
document.body.innerHTML = '<i class="fa fa-fw fa-question"></i>';
@gartenfeld
gartenfeld / readline.js
Created November 26, 2017 12:45
Read a file one line at a time
const fs = require('fs');
const path = require('path');
const readline = require('readline');
const FILE_PATH = path.resolve(__dirname, '../data/ingest_test.txt');
const stream = fs.createReadStream(FILE_PATH);
const interface = readline.createInterface({ input: stream });
interface.on('line', processLine);
interface.on('close', () => console.log("\nDone!"));
@gartenfeld
gartenfeld / wrap_text_nodes.js
Created September 27, 2018 17:20
Recipe for wrapping dangling text nodes with Cheerio
var $head = $('.entry h2.orth');
var $placeholder = $('<div></div>');
var nodes = $head[0].children; // Raw children nodes
// Strange enough this is an object!
// To iterate correctly without dropping nodes
// It must be converted to an array
_.toArray(nodes).forEach(child => {
if (child.type === 'text') {
@gartenfeld
gartenfeld / show_ntfs
Created November 8, 2018 09:42
Enable NTFS drives on Mac
# Append to /etc/fstab
LABEL=DRIVENAME none ntfs rw,auto,nobrowse
@gartenfeld
gartenfeld / remove_paragon.txt
Created March 9, 2019 13:07
Remove Paragon NTFS suckerware
launchctl remove com.paragon-software.ntfs.notification-agent
sudo launchctl unload -w /Library/LaunchDaemons/com.paragon-software.installer.plist
sudo launchctl unload -w /Library/LaunchDaemons/com.paragon-software.ntfsd.plist
sudo launchctl unload -w /Library/LaunchDaemons/com.paragon-software.ntfs.loader.plist
@gartenfeld
gartenfeld / ffmpeg_cut_video.sh
Last active May 29, 2019 11:24
Cut video with ffmpeg
# -i Input
# -ss Starting timestamp HH:MM:SS.xxx
# -t duration
# https://superuser.com/questions/138331/using-ffmpeg-to-cut-up-video
# https://stackoverflow.com/questions/18444194/cutting-the-videos-based-on-start-and-end-time-using-ffmpeg
# -c copy
ffmpeg -ss 00:00:05 -i input.mp4 -t 00:00:15 output.mp4
@gartenfeld
gartenfeld / ffmpeg_gif.sh
Created May 29, 2019 11:36
Video to GIF
# https://superuser.com/questions/556029/how-do-i-convert-a-video-to-gif-using-ffmpeg-with-reasonable-quality
ffmpeg -y -ss 0 -t 12 -i input.mp4 -vf fps=10,scale=320:-1:flags=lanczos,palettegen palette.png
ffmpeg -ss 0 -t 12 -i input.mp4 -i palette.png -filter_complex "fps=10,scale=320:-1:flags=lanczos[x];[x][1:v]paletteuse" output.gif
@gartenfeld
gartenfeld / ffmpeg_timelapse.sh
Created May 31, 2019 10:04
Generate time-lapse
# 0.1 makes it 10x as fast
ffmpeg -i input.mp4 -filter:v "setpts=0.1*PTS" output.mp4
@gartenfeld
gartenfeld / de_word_final_ngrams.csv
Last active October 5, 2019 12:57
German Word-Final N-Grams
We can't make this file beautiful and searchable because it's too large.
reverse, ending, length, is_word, ngram_weight, m_raw, f_raw, n_raw, m_freq, f_freq, n_freq, highest, predicted, correct, top
e, e, 1, 0, 473.2622, 306, 3562, 175, 0.0652, 0.8713, 0.0635, 0.8713, f, 3562, Woche, Seite, Frage
t, t, 1, 0, 416.4539, 1178, 1573, 873, 0.3479, 0.4234, 0.2287, 0.4234, f, 1573, Stadt, Arbeit, Welt
g, g, 1, 0, 369.4735, 727, 2307, 94, 0.3026, 0.676, 0.0214, 0.676, f, 2307, Regierung, Entscheidung, Zeitung
r, r, 1, 0, 362.7837, 2421, 336, 394, 0.7634, 0.1102, 0.1264, 0.7634, m, 2421, September, Oktober, November
re, er, 2, 0, 283.5243, 2063, 146, 280, 0.8272, 0.0535, 0.1193, 0.8272, m, 2063, September, Oktober, November
gn, ng, 2, 0, 278.8847, 197, 2301, 57, 0.0941, 0.8921, 0.0138, 0.8921, f, 2301, Regierung, Entscheidung, Zeitung
gnu, ung, 3, 0, 250.8859, 18, 2299, 0, 0.0093, 0.9907, 0, 0.9907, f, 2299, Regierung, Entscheidung, Zeitung
n, n, 1, 0, 234.9137, 671, 1019, 590, 0.297, 0.4714, 0.2316, 0.4714, f, 1019, Million, Information, Region
l, l, 1, 0, 136.552, 585, 175, 445, 0.4508,