Skip to content

Instantly share code, notes, and snippets.

View btotr's full-sized avatar

Colin Meerveld btotr

View GitHub Profile
@btotr
btotr / cornerstone_to_basecamp.sh
Created August 6, 2010 10:29
cornerstone to basecamp
#!/bin/bash
/usr/bin/svn log "$1" --username foo --password foo --limit 1 -r HEAD --verbose --xml > /tmp/last.log
LOG=`xsltproc /Users/foo/log.xsl /tmp/last.log`
curl -H 'Accept: application/xml' -H 'Content-Type: application/xml' \
-u foo:X \
-d "<request><post><category-id>45606922</category-id><title>svn commit</title><body>$LOG</body><extended-body>dit bericht is automatisch gegenereerd vanuit cornerstone</extended-body></post></request>" \
https://foo.basecamphq.com/projects/foo/posts.xml
@btotr
btotr / cpu-snapshot
Created July 7, 2011 07:36
CPU snapshot
for i in {1..10}; do ps -e -o pcpu -o pid | grep 91422 | grep -v grep | awk '{print $1}'; sleep 1; done | awk '{sum+=$1} END {print sum/10}'
@btotr
btotr / gist:1510214
Created December 22, 2011 12:52
John Cage 4.33 generator
ffmpeg -ar 44100 -acodec pcm_s16le -f s16le -ac 2 -i <(dd if=/dev/zero bs=$((44100 * 2 * 2)) count=273) 433.mp3
@btotr
btotr / .vimrc
Last active February 10, 2024 10:14
vi config
syntax on
set fileformat=unix
set encoding=UTF-8
au BufNewFile,BufRead *.py
\ set tabstop=4 |
\ set softtabstop=4 |
\ set shiftwidth=4 |
set tabstop=2
@btotr
btotr / gist:3497713
Created August 28, 2012 12:42
ffmpeg ts
#!/bin/bash
BITRATE=3500k
ffmpeg -i $1 \
-vcodec mpeg2video -r 25 -s 1280x720 -g 15 \
-vb ${BITRATE} -minrate ${BITRATE} -maxrate ${BITRATE} -bufsize ${BITRATE}/2 \
-acodec ac3 -ab 256k -ar 48000 -ac 2 \
-packetsize 188 -f mpegts -y \
$1.ts
@btotr
btotr / framegrapper.php
Created April 19, 2013 10:47
get a frame out of a video
<?php
header("Content-type: image/png");
$url = $_GET["url"];
$pos = $_GET["pos"];
$hashtag = md5($url);
$transcoder_info = shell_exec("./transcoder.sh -vframes 1 -ss $pos -i $url /tmp/$hashtag.png 2>&1");
$data = file_get_contents("/tmp/$hashtag.png");
header("Content-type: image/png");
echo $data;
?>
@btotr
btotr / index.html
Created June 20, 2013 13:46
A CodePen by Colin Meerveld. list
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
<ul>
@btotr
btotr / index.html
Created June 20, 2013 14:17
A CodePen by Colin Meerveld. blur
<svg xmlns="http://www.w3.org/2000/svg"
width="400"
height="400"
xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<filter id="blur">
<feGaussianBlur stdDeviation="10 2"/>
</filter>
</defs>
<rect x="10" y="10"
@btotr
btotr / transcodeXwindow
Last active January 2, 2016 11:38
transcode x window
var http = require('http')
var express = require('express')
var child = require('child_process');
var url = require('url');
var app = express();
var avconv;
app.get('/', function(req, res) {
res.writeHead(200, {
@btotr
btotr / player.html
Last active March 23, 2021 05:34
media source with range
<html>
<head>
<title>ms test</title>
</head>
<body>
<video autoplay></video>
<script>
var video = document.getElementsByTagName("video")[0],
start = 0,
length = 15477531,