Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# usage: bash /tmp/upstart_fix_pid.sh <pid>
sleep 0.001 &
firstPID=$!
# exhaust the pid space
while (( $! >= $firstPID ))
do
@biinari
biinari / test-kitchen-chef-shell.sh
Last active April 15, 2016 11:39 — forked from mattjbarlow/gist:242b66cdae6938d34419
Chef Shell in Test Kitchen (assuming using chef_solo provisioner)
#!/bin/sh
set -e # fail on errors
set -x # trace on
RUNLIST="$1" # eg 'recipe[example],role[something]'
cd /tmp/kitchen
[ -f client.pem ] || ssh-keygen -P '' -f client.pem
sudo /opt/chef/embedded/bin/gem install chef-zero -v '4.5.0' # last version to not enforce ruby version >= 2.1.0
--- PKGBUILD.orig 2016-06-07 12:22:39.833418761 +0100
+++ PKGBUILD 2016-06-07 13:42:49.653850504 +0100
@@ -3,7 +3,6 @@
# Contributor: Tianjiao Yin <ytj000(at)gmail(dot)(see)(oh)(em)>
# Contributor: Allan McRae <allan@archlinux.org>
-set -u
pkgname='gcc45'
pkgver='4.5.4'
pkgrel='3'
@biinari
biinari / find_misnamed_specs.sh
Last active July 7, 2021 00:33
Find specs that do not follow the necessary conventional file name '*_spec.rb'. These will not be run by RSpec so should be changed.
#!/bin/sh
find */spec -type f \
-name '*.rb' \
-not -name '*_fabricator.rb' \
-not -name '*_spec.rb' \
-not -name 'spec_helper.rb' \
-not -path '*/cassettes/*' \
-not -path '*/dummy/*' \
-not -path '*/expected/*' \
@biinari
biinari / docker_install.sh
Created August 15, 2016 14:19
Install docker on ubuntu trusty, wily, xenial
#!/bin/bash
# Check prerequisites for docker
if [ "$(uname -m)" != "x86_64" ]; then
echo "Docker requires 64 bit host OS"
exit 1
fi
kernel_version=$(uname -r | cut -d '.' -f 1-2)
@biinari
biinari / postgres_queries_and_commands.sql
Last active October 22, 2019 12:10 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (>= 9.2, < 9.6)
SELECT pid,
age(clock_timestamp(), query_start) AS age,
usename, state, query, waiting,
age(clock_timestamp(), xact_start) AS xact_age
FROM pg_stat_activity
WHERE state != 'idle'
AND query NOT ILIKE '%pg_stat_activity%'
ORDER BY age DESC;
@biinari
biinari / extract-123-reg-zonefile.js
Last active February 8, 2023 14:23
Script to extract the DNS entries from 123-reg advanced dns page
// Moved to a new home at https://github.com/biinari/zonefile-extract/tree/master/123-reg
@biinari
biinari / 123-reg transfer email.md
Created April 6, 2017 09:03
Email from 123-reg to request a domain transfer into my account (values changed for anonymity)

Dear Customer,

The user 'fromuser' has requested that the domains listed below be moved to your www.123-reg.co.uk account 'touser':

Please login to the 123-reg control panel at the URL below and select Internal Domain Transfers: https://www.123-reg.co.uk/secure/

Please ensure that the domain transfer is accepted within 24 hours or it will time out.

@biinari
biinari / lpass_askpass_zenity
Created December 18, 2017 16:19
LastPass lpass backend to password_fill
#!/bin/sh
# Optional accompaniment to password_fill_rc (in case no existing graphical password askpass for lpass to use)
# put in ~/.config/qutebrowse/lpass_askpass_zenity
# and enable in password_fill_rc with need_askpass=1
zenity --title "lpass $*" --password
@biinari
biinari / chan_order.go
Created February 8, 2018 14:52
Demonstration of channel ordered receives
package main
import (
"fmt"
"sync"
)
type element struct {
Goroutine int
Index int