Skip to content

Instantly share code, notes, and snippets.

@jaytaylor
jaytaylor / .psqlrc
Created January 6, 2015 17:37
My .psqlrc file.
-- Found at:
-- http://www.if-not-true-then-false.com/2009/postgresql-psql-psqlrc-tips-and-tricks/
-- http://opensourcedbms.com/dbms/psqlrc-psql-startup-file-for-postgres/
\set QUIET ON
\pset pager always
\pset null 'NULL'
@jaytaylor
jaytaylor / mesos-20150120.md
Last active August 29, 2015 14:13
Mesos notes regarding: Recovery failed: Failed to recover registrar: Failed to perform fetch within 1mins

Mesos versions 0.20.1 and 0.21.0

Master/Primary log:

==> /var/log/mesos/mesos-master.node1.invalid-user.log.WARNING.20150120-204548.12107 <==
Log file created at: 2015/01/20 20:45:48
Running on machine: node1
Log line format: [IWEF]mmdd hh:mm:ss.uuuuuu threadid file:line] msg
F0120 20:45:48.025610 12116 master.cpp:1083] Recovery failed: Failed to recover registrar: Failed to perform fetch within 1mins
@jaytaylor
jaytaylor / virtualbox_inaccessible_recovery.sh
Last active April 22, 2016 00:17
Automated Vagrant VirtualBox recovery & repair tool.
#!/usr/bin/env bash
##
# @author Jay Taylor [@jtaylor]
#
# @date 2015-01-21
#
# @description
# Automated Vagrant VirtualBox recovery & repair tool.
#
@jaytaylor
jaytaylor / portable-machine-id-integer.sh
Created March 5, 2015 22:56
Obtains a (relatively, maximally) consistent integer id for a linux or OS X machine.
python -c 'import sys; sys.stdout.write(("%s" % int("'$(test -e /var/lib/dbus/machine-id && cat /var/lib/dbus/machine-id || ifconfig | grep --ignore-case --only-matching --max 1 '\([0-9a-f]\{2\}:\)\{5\}[0-9a-f]\{2\}' | tr -d ':')'", 16))[0:9])'
@jaytaylor
jaytaylor / resolve-related-pids.sh
Last active August 29, 2015 14:16
Resolve related pids and wait for them to stop.
#!upstart
description "gitbucket"
env USER=ubuntu
env PID=/var/run/gitbucket.pid
env STDOUT=/var/log/gitbucket/gitbucket.log
env STDERR=/var/log/gitbucket/gitbucket.err
start on (local-filesystems and net-device-up IFACE!=lo)
stop on [!12345]
@jaytaylor
jaytaylor / etc-init-gitbucket.conf
Created March 16, 2015 17:48
Gitbucket (for JAR releases from: https://github.com/takezoe/gitbucket, located in /home/ubuntu/gitbucket/gitbucker.war).
#!upstart
description "gitbucket"
env USER=ubuntu
env PID=/var/run/gitbucket.pid
env STDOUT=/var/log/gitbucket/gitbucket.log
env STDERR=/var/log/gitbucket/gitbucket.err
start on (local-filesystems and net-device-up IFACE!=lo)
stop on [!12345]
@jaytaylor
jaytaylor / mac_bash_forever_notes_and_output.md
Created April 10, 2015 18:25
Save your bash history forever on OS X with timestamps included.

Stackexchange question: Bash history with timestamps

Seems to work like a charm on OS X 10.9.5:

$ echo "export HISTTIMEFORMAT='%F %T '" >> ~/.bashrc
$ source ~/.bashrc
$ echo hi
$ history | tail -n 2
8862 2015-04-10 11:04:44 source ~/.bashrc
@jaytaylor
jaytaylor / Makefile
Last active March 27, 2020 16:16
Golang automatic Makefile.
################################################################################
# Golang automatic Makefile #
################################################################################
##
#
# @author Jay Taylor <[email protected]>
#
# @date 2015-05-20
#
@jaytaylor
jaytaylor / json-deser-tst.go
Created June 19, 2015 19:13
JSON deserialization technique performance experiments in Go
package main
import (
"encoding/json"
"errors"
"fmt"
"github.com/jmoiron/jsonq"
"time"
)