Skip to content

Instantly share code, notes, and snippets.

View rxw1's full-sized avatar
☠️

rxw1

☠️
  • Upper Silesia, Germany
View GitHub Profile
@rxw1
rxw1 / arte.sh
Last active December 30, 2015 07:59
Oneliner to download videos from Arte+7. There are many ways to do this and language or quality coud be set up as options. Requires urldecode.awk.
#!/usr/bin/env zsh
# 03/2013
curl -s $1 |\
awk '/embed src/' |\
urldecode.awk |\
grep -o 'http[a-zA-Z0-9.,:/_?=-]+asPlayerXml.xml' |\
xargs curl -s |\
grep -o 'http[a-zA-Z0-9.,:/_?=-]+xml' |\
@rxw1
rxw1 / hello.sh
Created December 5, 2013 03:55
Hello from all your voices…
~ % for i in $(say -v\? | cut -f1 -d\ ); do echo -n "$i "; say -v $i hello; done
~ % say -v\? | awk '{print $1}' | while read -r l; do echo -n "$l "; say -v $l hello; done
~ % say -v\? | while read -r l; do l=(${=l}); echo -n "$l[1] "; [1]; say -v $l[1] $l[4,-1]; done # littl bit broken
@rxw1
rxw1 / multiplyArray.coffee
Last active December 30, 2015 18:09
Multiply arrays in an array
multiply: (a, n) ->
i = 0
while i < a.length
j = 0
while j < n - 1
a[i] = a[i].concat(a[i])
j++
i++
a
@rxw1
rxw1 / it-ebooks.rb
Last active December 30, 2015 20:49
Create JSON of all books from it-ebooks.info.
#!/usr/bin/env ruby
# -*- encoding: utf-8 -*-
#
# Thu Nov 28 15:47:21 CET 2013
# 2013 (c) René Wilhelm <rene.wilhelm@gmail.com>
#
# jq '.publisher + ": " + .name + " (" + .author + ")"' it-books.json
# Todo: Exit condition
@rxw1
rxw1 / psqlDump.sh
Last active December 31, 2015 02:29
Dump tables and schema from a PostgreSQL database (nicely).
#!/usr/bin/env zsh -e
# Thu Dec 12 00:04:47 CET 2013
# 2013 (c) rene.wilhelm@gmail.com
# Dump tables and schema from a PostgreSQL database.
# Usage: $0 [database_name] [num_records]
d=${1:=$USER} # database, defaults to current username
n=${2:=1000} # number of records to export, defaults to 1000
@rxw1
rxw1 / freq.sh
Created December 23, 2013 04:52
Fun with frequencies
#!/usr/bin/env zsh
# Mon Dec 23 05:48:33 CET 2013
# 2013 (c) rene.wilhelm@gmail.com
# plays frequencies
f=${1:=440}
pids=()
freq() {
@rxw1
rxw1 / -
Created February 8, 2014 14:57
{
"features": [
{
"properties": {
"ts": 1387554909603,
"id": 177
},
"geometry": {
"coordinates": [
[
@rxw1
rxw1 / node.service
Created February 15, 2014 16:28 — forked from Dianoga/node.service
[Unit]
Description=Start Herir Node.js Service
Requires=network.target
After=network.target
[Service]
Type=forking
WorkingDirectory=/srv/hereir/node
ExecStart=/usr/bin/forever start --pidFile /var/run/hereir.pid HereIR.js
ExecStop=/usr/bin/forever stop HereIR.js
@rxw1
rxw1 / wu.sh
Last active August 29, 2015 13:56
Wrapper script for wu to switch to different locations
#!/usr/bin/env zsh
# https://github.com/sramsay/wu/issues/28
# array containing our ~/.condrc suffixes (e.g. ~/.condrc.tokyo)
a=($(ls -1 ~/.condrc.* | awk -F. '{print $NF}'))
# check if our array contains the first given argument
if [[ ${a[(r)$1]} == $1 ]]; then
loc=$1; shift
@rxw1
rxw1 / gist:10252749
Created April 9, 2014 10:34
Find array index by object property
// find trip array index by trip id
var findById = function (source, trip_id) {
var length = source.length;
for (var i = length - 1; i >= 0; --i) {
if (source[i].trip_id === trip_id) {
return i;
}
}
throw "Couldn't find trip with id: " + trip_id;
};