Skip to content

Instantly share code, notes, and snippets.

@tfogo
tfogo / .zshrc
Last active August 29, 2015 14:15
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Alt+s inserts sudo at the start of the line
insert_sudo () { zle beginning-of-line; zle -U "sudo " }
zle -N insert-sudo insert_sudo
bindkey '^[\' insert-sudo
if [ "$TMUX" = "" ]; then tmux; fi
##################
# tmux conf file #
##################
# set C-a as command sequence
unbind C-b
set-option -g prefix C-a
set -g history-limit 10000
#set -g terminal-overrides 'xterm*:smcup@:rmcup@'
@tfogo
tfogo / index.py
Created November 16, 2014 13:30
twiliopython
from flask import Flask, request
app = Flask(__name__)
@app.route('/message', methods=['POST'])
def message():
return '''
<Response>
<Message>
Hey WIT!
</Message>
@tfogo
tfogo / token
Last active August 29, 2015 14:09
Token for a workshop
CAACEdEose0cBABbKafdNZAlu0128di7GsT02ejHvBn4WX0gB1HnnKroA0D9L3z2ewPfqoWG2pqUsfk6eqkZAWUZBe8J4EdKn11nXF81gnd8gXEcCXeGcSTQxFPbVRUUV0RCK6h7SwjlmLtlY4jHM3AwGHFt5WPo1K61LWjdsFUNUQM8zqq4sIr8wZCAaFqJqbVf3y971r5poiHIwpzqy
009945e5-6cd4-455d-a2f4-8a93d7b3b401
00f473c8-40ac-4221-9d0c-a014159829c1
013f8085-0407-4e4b-a3dd-f45afc0d1ed6
01dc0ef3-314f-4424-b7cd-31189408ef0f
03902a72-9b9d-4594-8aa7-b450e6f8f5b9
039692c4-6922-4e4b-a43c-5bbf5a0d2e1f
03a24d64-9461-43b7-b3cf-4654362ebbae
04ab72bd-294f-47dc-86ba-3307712147a4
06c14e7c-abe1-4a60-8835-bf283482cc57
071b247d-b238-4b08-98ff-c2f275fa7456
#!/bin/bash
FILES=/home/tim/marathon/output/*.mp4
printf "{\n\t" >> /home/tim/p/video-annotator/offsets.json
for f in $FILES
do
time="$(ffprobe "$f" 2>&1 >/dev/null | grep -Po '(?<=Duration:\s)\d{2}:\d{2}:\d{2}')"
hrs="$(echo "$time" | grep -Po '\d{2}(?=:\d{2}:\d{2})')"
mins="$(echo "$time" | grep -Po '(?<=\d{2}:)\d{2}(?=:\d{2})')"
secs="$(echo "$time" | grep -Po '(?<=\d{2}:\d{2}:)\d{2}')"
filename="$(echo "$f" | grep -Po '(?<=/home/tim/marathon/output/).*(?=\.mp4)')"
@tfogo
tfogo / video-annotator-instructions.md
Last active August 29, 2015 14:06
Video annotator setup instructions

The videos are on the machine at the end of the hotdesk area in the MRL. The machine should be on and an ubuntu VM should be running. If not, please start the VM using VirtualBox.

Check that /media/sf_marathon/videos/ exists and contains all the marathon videos. If this isn't the case, you'll have to share C:\marathon with the guest OS using VirtualBox. Make sure the directory /media/sf_marathon/videos/output exists. If it does not, create it.

Change to the video annotator's directory.

$ cd ~/p/video-annotator

Pull the branch origin/server from https://github.com/tfogo/video-annotator.git

var mongoose = require('mongoose');
// config
var config = require('./config');
// mongodb URI
var uristring = config.db;
// connect to db
mongoose.connect(uristring);
@tfogo
tfogo / videosplit.sh
Created July 25, 2014 08:03
Split long videos into 2 minute segments
#!/bin/bash
FILES=/home/tim/Videos/marathon-vids/*.mp4
for f in $FILES
do
time="$(avprobe "$f" 2>&1 >/dev/null | grep -Po '(?<=Duration:\s)\d{2}:\d{2}:\d{2}')"
hrs="$(echo "$time" | grep -Po '\d{2}(?=:\d{2}:\d{2})')"
mins="$(echo "$time" | grep -Po '(?<=\d{2}:)\d{2}(?=:\d{2})')"
secs="$(echo "$time" | grep -Po '(?<=\d{2}:\d{2}:)\d{2}')"
filename="$(echo "$f" | grep -Po '(?<=/home/tim/Videos/marathon-vids/).*(?=\.mp4)')"
let time=$hrs*3600+$mins*60+$secs
@tfogo
tfogo / howtogif
Created April 8, 2014 13:19
How to convert videos to gif using ffmpeg and gifsicle
How to convert a video file to an animated GIF on Linux:
Install required software:
apt-get install ffmpeg gifsicle imagemagick:
Convert the video file to a series of small images:
mkdir /tmp/gif/
ffmpeg -i YOURVIDEOFILE.mp4 -r 10 /tmp/gif/out%04d.gif
Combine these images together into a GIF animation:
gifsicle –delay=10 –loop /tmp/gif/*.gif > animation.gif
Optimise the GIF animation so the file size is smaller: