Skip to content

Instantly share code, notes, and snippets.

@infertux
infertux / hockeypuck.deb.sh
Created May 28, 2022 04:57
Script to build Hockeypuck .deb package using Docker
#!/bin/bash
set -euxo pipefail
cd "$(dirname "$0")"
target="${1:-hockeypuck}"
interactive="${2:-}"
container=${target}-builder
volume=/root/HOST
@infertux
infertux / rrd-dump.sh
Created December 19, 2016 12:06
Bash scripts to export/import RRD files for Collectd
#!/bin/bash -eu
cd /var/lib/collectd/rrd/$HOST
for f in $(find -name *.rrd); do
echo "rrdtool dump $f"
rrdtool dump $f > ${f%.rrd}.xml
done
rsync -avz --exclude *.rrd /var/lib/collectd/rrd/$HOST/ $COLLECTD_HOST:/var/lib/collectd/rrd/$HOST/
(2 * 2 * 5 * 7 * 37 * 149 * 5417 * 148781 * 51939996061871).to_s(16).scan(/../).map { |x| x.hex.chr }.join
@infertux
infertux / V3.car.diff
Created April 4, 2016 14:07
Turn Stunt Rally CAR game into a JET FIGHTER game ;)
--- V3.car 2015-09-18 09:21:11.000000000 +0000
+++ V3.car 2016-04-01 14:51:17.783726416 +0000
@@ -61,16 +61,16 @@
#---------------------------
[ hover ]
-hAbove = 2.5
+hAbove = 4.0
hRayLen = 4.0
@rauchg
rauchg / README.md
Last active January 6, 2024 07:19
require-from-twitter
@infertux
infertux / axp_pmu
Created February 13, 2016 22:38
Munin plugin to monitor AXP PMU on sunxi SoCs
#!/bin/sh
# -*- sh -*-
# vim: ft=sh
: << =cut
=head1 NAME
axp_pmu - Plugin to monitor power
@infertux
infertux / rubocop.yml
Last active October 12, 2017 01:17
My curated Rubocop config
# See https://github.com/bbatsov/rubocop
# Add this to the top of your .rubocop.yml:
# inherit_from:
# - https://gist.githubusercontent.com/infertux/cdd2ccc6e0a0cd94f458/raw
# AllCops
AllCops:
TargetRubyVersion: 2.3
l={};s=m=[];i=pc=mc=0
alias p proc
h={'>':p{mc+=1},'<':p{mc-=1},'+':p{m[mc]+=1},'-':p{m[mc]-=1},'.':p{putc m[mc]}}
j={'[':->(i){s<<i;->(){pc=l[pc-1]+1 if m[mc]==0}},']':->(i){o=s.pop;l[o]=i;p{pc=o}}}
ins=DATA.each_char.map{|c|c=:"#{c}";x=(j[c]||->(_){h[c]||p{}}).(i);i+=1;x}
while k=ins[pc];pc+=1;m[mc]||=0;k.();end
__END__
[ This program prints "Hello World!" and a newline to the screen, its
length is 106 active command characters. [It is not the shortest.]
@infertux
infertux / unicorn_connections
Created August 11, 2015 12:56
Munin plugin to monitor the number of Unicorn connections on a socket
#!/bin/bash
# -*- sh -*-
# vim: ft=sh
: << =cut
=head1 NAME
unicorn_connections - Plugin to monitor the number of Unicorn connections
@gavinwahl
gavinwahl / example.sql
Last active August 29, 2015 14:19
Temporal foreign key
DROP TABLE IF EXISTS parent;
DROP TABLE IF EXISTS child;
CREATE TABLE parent(
identity_id integer,
valid_range int4range
);
CREATE TABLE child(
valid_range int4range,