Skip to content

Instantly share code, notes, and snippets.

View kyle-johnson's full-sized avatar

Kyle Johnson kyle-johnson

View GitHub Profile

Keybase proof

I hereby claim:

  • I am kyle-johnson on github.
  • I am kylej (https://keybase.io/kylej) on keybase.
  • I have a public key ASDSQ7VEbnBLKjS4GJD17yBmkH2WNmR2Fu849sPPHa15qwo

To claim this, I am signing this object:

@kyle-johnson
kyle-johnson / output.txt
Created May 27, 2016 23:42
Examining how nodejs does blocking / async / promises
1
2
3
5
Async timeout queued to fire in 3 seconds...
BLOCK for 10 seconds...
sleep 1
sleep 2
sleep 3
sleep 4
@kyle-johnson
kyle-johnson / prompt.sh
Created September 9, 2015 22:32
Pretty bash command prompt that supports GIT and Python virtual environments. Screenshot: http://i.imgur.com/qP6VFgh.png Copy/paste into your ~/.bashrc
# colorize some commands
export CLICOLOR=1
export LSCOLORS=gxBxhxDxfxhxhxhxhxcxcx
# defs for prompt...
RED="\[\033[0;31m\]"
PINK="\[\033[1;31m\]"
YELLOW="\[\033[1;33m\]"
GREEN="\[\033[0;32m\]"
LT_GREEN="\[\033[1;32m\]"
require 'formula'
class Darner < Formula
homepage 'https://github.com/wavii/darner'
url 'https://github.com/wavii/darner/archive/v0.2.0.tar.gz'
sha1 '40858750ac82cd24dbb5ba77f409152feb6c2582'
head 'https://github.com/wavii/darner.git'
depends_on 'cmake' => :build
@kyle-johnson
kyle-johnson / private.xml
Created April 7, 2014 18:02
keyremap4macbook
<?xml version="1.0"?>
<root>
<appdef>
<appname>CHROME</appname>
<equal>com.google.Chrome</equal>
</appdef>
<appdef>
<appname>NAVICAT</appname>
<equal>com.prect.NavicatPG</equal>
</appdef>
@kyle-johnson
kyle-johnson / interfaces
Created July 3, 2013 16:51
Amazon EC2 VPC multiple IP setup under Ubuntu Linux (With multiple virtual interfaces on the same subnet) Put vpc.sh into your ip-up.d directory and then update your /etc/network/interfaces to have all virtual adapters. Then it's a matter of sudo /etc/init.d/networking restart
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
auto eth1
iface eth1 inet dhcp
# etc
@kyle-johnson
kyle-johnson / gist:3855067
Created October 8, 2012 21:23
Munin PostgreSQL db size (Bash + psql)
#!/bin/bash
dbserver='localhost'
dbuser='postgres'
psql='/usr/local/pgsql/bin/psql'
if [ "$1" = "config" ]; then
echo 'graph_args --base 1024 --lower-limit 0'
echo 'graph_category Postgresql'
echo 'graph_info Shows each database size on the PostgreSQL Server.'
echo 'graph_title PostgreSQL Database Sizes'
@kyle-johnson
kyle-johnson / gist:3855064
Created October 8, 2012 21:22
Munin PostgreSQL connections (Bash + psql)
#!/bin/bash
dbserver='localhost'
dbuser='postgres'
psql='/usr/local/pgsql/bin/psql'
if [ "$1" = "config" ]; then
echo 'graph_args --base 1000 --lower-limit 0'
echo 'graph_category Postgresql'
echo 'graph_info Shows active Postgresql connections'
@kyle-johnson
kyle-johnson / gist:3855058
Created October 8, 2012 21:21
Munin DNSMasq Stats
#!/bin/sh
case $1 in
config)
cat <<'EOM'
graph_title DHCP Leases
graph_vlabel leases
graph_args -l 0
graph_category DNSMasq
graph_scale no