Skip to content

Instantly share code, notes, and snippets.

View gartenfeld's full-sized avatar

David Rosson gartenfeld

View GitHub Profile
@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_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 / 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 / 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 / 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 / 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 / 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>';
<a href="data:text/plain;charset=utf-8;base64,Zm9vIGJhcg==">Data as URI</a>
@gartenfeld
gartenfeld / drag_and_drop_files.js
Created October 21, 2016 22:10
Drag and Drop Files
var element = $('#drop-area')[0];
var callback = function onFileDrop() {
var filenames = event.target.result;
};
function droppable(element, callback) {
element.addEventListener('dragover', function onDrag(event) {
event.stopPropagation();
event.preventDefault();
@gartenfeld
gartenfeld / centering.css
Created September 27, 2016 01:00
Centering without Flexbox
// Add full screen wrapper
.box {
top: 50%;
left: 50%;
margin: 0;
position: absolute;
transform: translate(-50%, -50%);
}