Skip to content

Instantly share code, notes, and snippets.

View bertrandom's full-sized avatar

Bertrand Fan bertrandom

View GitHub Profile
#!/bin/sh
palette="/tmp/palette.png"
filters="fps=4,scale=320:-1:flags=lanczos"
ffmpeg -v warning -framerate 4 -f image2 -i $1 -vf "$filters,palettegen" -y $palette
ffmpeg -v warning -framerate 4 -f image2 -i $1 -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y $2
const async = require('async');
var gm = require('gm');
var sprintf = require("sprintf-js").sprintf;
var faces = require('./faces.json');
var bumps = [];
for (var i = 1; i <= 66; i++) {
bumps.push(i.toString());
}
{
"1": [
{
"faceId": "e2a4980d-6af1-4cad-b67d-9d72cb6b0c21",
"faceRectangle": {
"top": 563,
"left": 676,
"width": 113,
"height": 113
}
@bertrandom
bertrandom / gist:665795
Last active August 24, 2016 14:44
Bookmarklet for setting the date posted for a photo on Flickr to now
javascript:(function()%7Bvar photoId %3D location.href.match(%2F%5C%2Fphotos%5C%2F((%5B0-9%5D%2B%40N%5B0-9%5D%2B)%7C%5B0-9a-zA-Z-_%5D%2B)%5C%2F(%5B0-9%5D%2B)%2F)%5B3%5D%3Bwindow.appContext.flickrAPI.callMethod('flickr.photos.setDates'%2C %7B"date_posted"%3A Math.round(new Date().getTime() %2F 1000)%2C "photo_id"%3A photoId%7D).then(function() %7Bwindow.appContext.flickrAPI.callMethod('flickr.photos.setPerms'%2C %7B"is_public"%3A 1%2C "is_friend"%3A 0%2C "is_family"%3A 0%2C "photo_id"%3A photoId%7D)%3B%7D)%7D)()
@bertrandom
bertrandom / private.xml
Created August 18, 2016 17:11
Karabiner config to set WASD keyboard F13 to display sleep
<?xml version="1.0"?>
<root>
<devicevendordef>
<vendorname>My_Keyboard_VendorID</vendorname>
<vendorid>0x04d9</vendorid>
</devicevendordef>
<deviceproductdef>
<productname>My_Target_Keyboard_ProductID</productname>
#!/bin/bash
for i in `seq 1 7306`;
do
frame=$(printf '%06d' "$i")
echo $frame
curl "https://slack.com/api/chat.postMessage?token=SLACK_API_TOKEN&channel=CHANNEL_ID&username=Star%20Wars&text=http://starwars.toomanycooks.kitchen/out$frame.jpg&as_user=starwarsbot"
sleep 10
done
$ mkvinfo Seinfeld.S01E01.The.Seinfeld.Chronicles.mkv
...
|+ Segment tracks
...
| + A track
| + Track number: 3 (track ID for mkvmerge & mkvextract: 2)
| + Track UID: 17434673961305370787
| + Track type: subtitles
| + Lacing flag: 0
| + Codec ID: S_TEXT/UTF8
$ mkvinfo Seinfeld.S01E01.The.Seinfeld.Chronicles.mkv
...
|+ Segment tracks
...
| + A track
| + Track number: 3 (track ID for mkvmerge & mkvextract: 2)
| + Track UID: 17434673961305370787
| + Track type: subtitles
| + Lacing flag: 0
| + Codec ID: S_TEXT/UTF8
convert data/frames/S03E11/270.gif -gravity south -font Helvetica -pointsize 14 -stroke '#000C' -strokewidth 3 -annotate 0 '"These pretzels are\nmaking me thirsty"\n' -stroke none -fill white -annotate 0 '"These pretzels are\nmaking me thirsty"\n' data/annotate/S03E11/270.gif
var timestampMs = transform.convertTimeToTimestamp(line.endTime) - transform.convertTimeToTimestamp(line.startTime);
line.duration = transform.convertTimestampToTime(timestampMs);