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
@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
@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
http://www.workingnomads.co/
http://www.reddit.com/r/remotejs/
https://www.reddit.com/r/Jobs4Bitcoins/
https://jobs.github.com/positions?description=&location=remote
https://authenticjobs.com/#types=7,1,3,5&category=2&onlyremote=1
https://authenticjobs.com/#types=7,1,3,5&category=4&onlyremote=1
https://remotecoder.io/
https://weworkremotely.com/
https://remoteok.io/
http://careers.stackoverflow.com/jobs?allowsremote=true
@infertux
infertux / bootstrap_ruby.sh
Last active August 29, 2015 14:06
Download, configure and install Ruby and Bundler on a Debian-family or Redhat-family fresh system
#!/bin/bash -eu
# Download, configure and install Ruby and Bundler on a Debian-family or Redhat-family fresh system
# https://gist.github.com/infertux/a5252bf8023f0a0e9380
RUBY="2.2.2"
SHA256="5ffc0f317e429e6b29d4a98ac521c3ce65481bfd22a8cf845fa02a7b113d9b44"
# This runs as root on the server
[ $UID -eq 0 ]
@infertux
infertux / extract_sub_repo.sh
Created August 28, 2014 15:42
Extract part of a Git repository while keeping the history
# create a list of files to NOT keep
create_black_list > blacklist
# add old files which have been renamed
for f in $(cat blacklist); do
git log --pretty=oneline --follow --name-only $f | grep -v ' ' | sort -u >> blacklist
done
# remove files and commits from the Git history (may take a while...)
for f in $(cat blacklist); do