Skip to content

Instantly share code, notes, and snippets.

View rxw1's full-sized avatar
☠️

rxw1

☠️
  • Upper Silesia, Germany
View GitHub Profile
@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) [email protected]
# plays frequencies
f=${1:=440}
pids=()
freq() {
@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) [email protected]
# 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 / 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 <[email protected]>
#
# jq '.publisher + ": " + .name + " (" + .author + ")"' it-books.json
# Todo: Exit condition
@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 / 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 / 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 / countTabs.js
Last active December 30, 2015 07:49 — forked from jlewin/countTabs.js
Count open tabs in Google Chrome.
chrome.windows.getAll({populate: true}, function(a) {
var n=0;
for (var x in a) {
n+=a[x].tabs.length;
}
console.log(n);
});
// => undefined (?)
// => 154 :D
@rxw1
rxw1 / gmail-download.rb
Created November 15, 2013 03:04
Downloads Gmail attachments of e-mails where the sender matches the given string.
#!/usr/bin/env ruby
# -*- encoding: utf-8 -*-
require 'gmail'
require 'fileutils'
require 'pry'
username = 'YOUR_MAIL_ADDRESS_HERE'
password = 'YOUR_PASSWORD_HERE'
@rxw1
rxw1 / domian.rb
Last active December 28, 2015 09:19
Download some files from some website… Note: Don't use it. It's a little bit evil.
#!/usr/bin/env ruby
# -*- encoding: utf-8 -*-
#
# Fri Nov 15 03:21:26 CET 2013
#
require 'nokogiri'
require 'open-uri'
require 'fileutils'
/* See LICENSE file for copyright and license details. */
/* appearance */
static const char font[] = "Envy Code R:pixelsize=14:antialias=true:autohint=true";
static const char dmenufont[] = "Envy Code R:pixelsize=18:antialias=true:autohint=true";
/*
static const char normbordercolor[] = "#f4edda"; // light grey
static const char normbgcolor[] = "#f4edda";
static const char normfgcolor[] = "#000000";