Skip to content

Instantly share code, notes, and snippets.

View rxw1's full-sized avatar
☠️

rxw1

☠️
  • Upper Silesia, Germany
View GitHub Profile
@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;
};
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
chrome.windows.getAll({populate: true}, function(allWindows)
{
console.log(allWindows);
});
@rxw1
rxw1 / index.html
Created June 28, 2014 22:23 — forked from mbostock/.block
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script>
<style type="text/css">
body {
background: #333;
}
@rxw1
rxw1 / bouree.txt
Created July 13, 2014 16:24
Disassemble guitar tabs
|--0--2--|--3----2--0-------0--2--|-------------0----------|------------------------|--------------------0--2--|--3----2--0-------0--2--|-------------0----------|---------------------------|---------------0--2--|---------------------|------------------3-----|--0---------------------|------------------------|-------------------------|-------3-----0----------|-------5-----2-------0--|----------------------------|-------------------7-----|-------------5-------3--|--2----0-----3-------1--|--0----5--0--2-------0--|-------------------0-----|--------------------------|-------------------------|---------------------------|---------------------|-------------------|
|--------|-------------4----------|--0----2--4-------3--1--|--0---------------------|--0-----------------------|-------------4----------|--0----2--4-------3--1--|--0------------------------|---------------------|---------------0-----|--3-------1--0-------3--|----------3--1----------|----------0--1----0-----|-------------------3-----|--0-------3----------3--
@rxw1
rxw1 / BLOCKLISTS.md
Last active August 29, 2015 14:04
Blocklists w/ cronjob

Use it e.g. in Transmission's options as file:///tmp/blocklist

@rxw1
rxw1 / gist:b6ae6c56d29c18d42fce
Last active August 29, 2015 14:06
PostgreSQL Queries
-- list all tables
SELECT c.relname FROM pg_catalog.pg_class c LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace WHERE c.relkind IN ('r','') AND n.nspname <> 'pg_catalog'AND n.nspname <> 'information_schema'AND n.nspname !~ '^pg_toast'AND pg_catalog.pg_get_userbyid(c.relowner) != 'postgres' AND pg_catalog.pg_table_is_visible(c.oid) ORDER BY 1;
-- list all columns for a table
SELECT attname FROM pg_attribute WHERE attrelid = 'public.sensor_tags'::regclass AND attnum > 0 AND NOT attisdropped ORDER BY attnum;
-- get all column types for a table
SELECT column_name, data_type FROM information_schema.columns WHERE table_name = '___TABLE_NAME___';