Skip to content

Instantly share code, notes, and snippets.

Avatar

Bertrand Fan bertrandom

View GitHub Profile
View mkvinfo example
$ 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
View annotate.sh
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
View convert.js
var timestampMs = transform.convertTimeToTimestamp(line.endTime) - transform.convertTimeToTimestamp(line.startTime);
line.duration = transform.convertTimestampToTime(timestampMs);
View transform.js
var moment = require('moment');
module.exports = {
convertTimeToTimestamp: function (time) {
return moment.utc(time, "HH:mm:ss,SSS").set({'year':1970, 'month':0, 'date':1}).valueOf();
},
View gifenc.sh
#!/bin/bash
start_time=$3
duration=$4
palette="/tmp/palette.png"
filters="fps=15,scale=320:-1:flags=lanczos"
ffmpeg -v warning -ss $start_time -t $duration -i $1 -vf "$filters,palettegen" -y $palette
View S01E01.srt
1
00:00:01,266 --> 00:00:03,366
Do you know what this is all
about? Why we're here?
2
00:00:03,400 --> 00:00:06,366
To be out. This is out.
[AUDIENCE LAUGHS]
View mkvinfo
$ 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
View mass.pde
void setup() {
background(255, 255, 255);
size(1120, 860);
translate(50, height - 15);
scale(0.1,-0.1);
frameRate(30);
View uber.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bertrandom
bertrandom / gist:7508762
Created Nov 17, 2013
Resize a bunch of images to exactly 640x480 with black borders if they don't fit the dimensions
View gist:7508762
ls *.jpg | xargs -n1 sh -c 'convert $0 -resize 640x480 -background "#000000" -gravity center -extent 640x480 fixed/$0'