Skip to content

Instantly share code, notes, and snippets.

View adamvr's full-sized avatar

Adam Rudd adamvr

  • Cologne, Germany
View GitHub Profile
@adamvr
adamvr / README
Created March 1, 2012 04:52
A script for downloading 'This American Life' episodes
tal.sh
A script for downloading 'This American Life' episodes
Requires:
rtmpdump
id3v2
curl

mqtt.js

Introduction

mqtt.js library for the MQTT protocol, written in javascript. It allows the creation of both MQTT clients and MQTT brokers through the createClient and createServer API methods.

Much of this document requires an understanding of the MQTT protocol,

@adamvr
adamvr / range.sh
Created March 28, 2012 03:06
Get a line range from a file
sed -n '30,60p' filename
@adamvr
adamvr / API.md
Created March 29, 2012 23:18
Photonics experiment API description

Location

10.240.132.231:8081

API

GET /WebService/:piezo/:waveform/:amp/:offset/:disc_speed/:laser_current/:focus_point/:filter/:num_avg

where:

  • piezo: piezo in or out. 0 indicates it's out and we're doing a displacement experiment, 1 indicates it's in and that we're doing a velocity experiment.
var rest = require('restler');
var path = require('path');
exports.type = 'photonics';
var template = {
piezo: {
required: true,
allowed: ['in', 'out']
},
@adamvr
adamvr / modulo.sh
Created April 1, 2012 06:51
Bash stuff
echo `expr $RANDOM % $1`
0340 int moves[4][2] = {{-1, 1}, {0, 1}, {1, 0}, {1, 1}};
[BRACES] Closing brace should appear as the first symbol on the next line.
0341 i = ((turnCount+1)%2)+1;
[BRACES] Closing brace should appear as the first symbol on the next line.
0342 j = k = m = n = 0;
[BRACES] Closing brace should appear as the first symbol on the next line.
0343 while(n<4) {
[BRACES] Closing brace should appear as the first symbol on the next line.
0344 int cnt[] = {0, 0};
[BRACES] Closing brace should appear as the first symbol on the next line.
j=$1
echo "Marking $j"
# add line numbers and line-length header, outputs
# to the new '$j.annotated.txt' file
_lines $j
# add tab count footer
grep -cP '\t' $j | gawk '{ if ($1 > 0) print "[INDENTATION] File contained " $1 " tab characters. Indentation should be four spaces per indentation level.\n Each tab was converted to four spaces for style marking. This counts as one style violation." }' >> $j.annotated.txt
#!/bin/sh
style='ls {}/style.txt >/dev/null 2>&1 || echo {}'
errors='ls {}/*.errors.c >/dev/null 2>&1 || echo {}'
number=`find . -maxdepth 1 -mindepth 1 | sort | wc -l`
finished=`find . -maxdepth 1 -mindepth 1 -exec sh -c "$style" \; | sort | wc -l`
started=`find . -maxdepth 1 -mindepth 1 -exec sh -c "$errors" \; | sort | wc -l`
@adamvr
adamvr / konj.sh
Created June 11, 2012 11:52
Script for scraping dict.cc for conjugations
#!/bin/sh
p=$2;
t=$3;
word=$1;
case "$2" in
'ich')
p=1
;;