Skip to content

Instantly share code, notes, and snippets.

View dwilkins's full-sized avatar

David H. Wilkins dwilkins

View GitHub Profile
@dwilkins
dwilkins / branchinprompt.sh
Created July 25, 2012 15:33
Changes to .bashrc to get the branch into your prompt
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
function proml {
local BLUE="\[\033[0;34m\]"
local RED="\[\033[0;31m\]"
local LIGHT_RED="\[\033[1;31m\]"
local GREEN="\[\033[0;32m\]"
local LIGHT_GREEN="\[\033[1;32m\]"
@dwilkins
dwilkins / gist:3859998
Created October 9, 2012 16:49
My Jenkins solution for multiple builds that want the same postgres db name
sed "s/learning_earning_test/le_test_db_${EXECUTOR_NUMBER}/" config/database.yml.example > config/database.yml
@dwilkins
dwilkins / nginx.service
Created April 5, 2013 21:13
nginx.service file from Fedora
# /etc/systemd/system/multi-user.target.wants/nginx.service
[Unit]
Description=The nginx HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t
ExecStart=/usr/sbin/nginx
@dwilkins
dwilkins / blink_led.sh
Created April 17, 2013 20:40
Shell Script that blinks an LED on pcDuino
@dwilkins
dwilkins / crawler.script
Created April 22, 2013 04:27
Script for running the crawler
print "dir forward"
send "dir fwd\n"
print "speed .50"
send "speed .50\n"
sleep 10
print "speed 1"
send "speed 1\n"
sleep 10
print "dir rev ; speed 1"
send "dir rev ; speed 1\n"
@dwilkins
dwilkins / index.html.haml
Created April 28, 2013 16:03
Trouble using microevent.js with virtualjoystick.js
#crawler-js-container
#crawler-js
:coffeescript
window.joystick = {};
($ document).ready ->
MicroEvent.mixin VirtualJoystick
window.joystick = new VirtualJoystick({
container : document.getElementById('crawler-js-container'),
mouseSupport : true
})
@dwilkins
dwilkins / pi-muncher
Created June 6, 2013 15:18
pi-blaster ate my sd card (at least some of it)
[dwilkins@alarmpi source]$ ls -l
ls: cannot access pi-blaster: Input/output error
total 0
d????????? ? ? ? ? ? pi-blaster
[dwilkins@alarmpi source]$
@dwilkins
dwilkins / expanded_output.md
Last active December 20, 2015 12:49
Expanded output for MySQL and Postgres

Without \x

Normal Postgres Output - off the right hand side of the page or wrapped and unreadable

db_development=# select * from users;
 id |        email         |                      encrypted_password                      | reset_password_token | reset_password_sent_at | remember_created_at | sign_in_count |     current_sign_in_at     |      last_sign_in_at       | current_sign_in_ip | last_sign_in_ip |         created_at         |         updated_at         | admin 
----+----------------------+--------------------------------------------------------------+----------------------+------------------------+---------------------+---------------+----------------------------+----------------------------+--------------------+-----------------+----------------------------+----------------------------+-------
 1 | [email protected] | $2a$10$hHZ4XhiTgXY62slgpsXd3u2Nd0pC3Ejl0IbsNZK1t2r5aPlxyl3QO | | | | 1 | 2013-08-01 16:23:4
@dwilkins
dwilkins / btscript.sh
Created August 5, 2013 03:46
My Nintendo Wii pairing script. Won't work on Fedora 19 for some reason...
#!/bin/bash
on_die()
{
STATUS=`${DISCONNECT_COMMAND}`
exit 0
}
# Execute function on_die() receiving TERM signal
@dwilkins
dwilkins / resizeit.sh
Last active December 20, 2015 23:18
Resize images and use the tileup gem to slice them up for a slippy map
imagename=$1
imagebasename=${imagename%.*}
size=512
for size in 512 1024 2048 4096 8192 16384
do
echo "Resizing to ${size}x${size}"
convert -size ${size}x${size} xc:transparent canvas.png
time composite -resize ${size}x${size} $1 -gravity center canvas.png -size ${size}x${size} "${imagebasename}-${size}.png"