Skip to content

Instantly share code, notes, and snippets.

View diginc's full-sized avatar
🐳

Adam B Hill diginc

🐳
View GitHub Profile
@diginc
diginc / CPAN_module_installer.sh
Last active August 29, 2015 14:00
Script to install local lib CPAN modules, just tell it what to install in the MODULES variable and the rc file to setup for perl local lib environment variables so it can find the locally installed modules
#!/bin/bash
# Customize variables:
RCFILE=~/.bashrc
MODULES=(
"XML::Simple"
"DateTime::Event::Cron"
"Switch"
"LWP::Simple"
)
@diginc
diginc / fight_code_game_navigation.js
Last active August 29, 2015 14:01
[SAI] Nav System
// Custom functions list:
// Also see var Robot for variables that tie into some of these custom functions:
/*
Robot.prototype.gridSetup = function(ev) // Ran once
Robot.prototype.updateCurrentCoords = function(ev) // Ran every idle
Robot.prototype.navigation = function(ev) {
Robot.prototype.navigateCorner = function(ev) {
Robot.prototype.navigateWall = function(ev) {
@diginc
diginc / .bash_aliases
Created May 14, 2014 18:49
tmux session start / resume function
function tm {
TMUXNAME=${1:-"default"}
if tmux ls | grep "^$TMUXNAME:"; then
tmux attach -d -t $TMUXNAME
else
tmux new -s $TMUXNAME
fi
}
@diginc
diginc / my_puppet.pp
Created July 15, 2014 00:17
puppet workshop
# Requires modules: puppetlabs-apache, puppetlabs-mysql
exec { 'apt_get_update':
command => '/usr/bin/apt-get update',
}
->
Package <| |>
# Default
Exec {
@diginc
diginc / .bash_aliases
Last active August 29, 2015 14:04
docker bash aliases
alias sdo='sudo docker'
function dockinfo {
if [ -z "$1" ] ; then
echo "dockinfo usage: dockinfo <container> [inspect format string]"
echo -e """ Example inspection elements:\n "Args"\n "Config"\n "Created"\n "Driver"\n "ExecDriver"\n "HostConfig"\n "HostnamePath"\n "HostsPath"\n "Id"\n "Image"\n "MountLabel"\n "Name"\n "NetworkSettings"\n "Path"\n "ProcessLabel"\n "ResolvConfPath"\n "State"\n "Volumes"\n "VolumesRW"\n"""
# Generated list with: sudo docker inspect test_jenkins | grep -Po '^ {4}"\w+"'
kill -INT $$
else
CONTAINER="$1"
@diginc
diginc / .bashrc-history
Last active August 29, 2015 14:15
History options in bashrc ubuntu default file
$ grep -ri hist ~/.bashrc | grep -v alias
# don't put duplicate lines or lines starting with space in the history.
#HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
#HISTSIZE=1000
#HISTFILESIZE=2000
export HISTSIZE=100000
export HISTFILESIZE=50000
# Postfix stuff based on https://gist.github.com/jbrownsc/4694374:
QUEUEID (?:[A-F0-9]+|NOQUEUE)
EMAILADDRESSPART [a-zA-Z0-9_.+-=:]+
EMAILADDRESS %{EMAILADDRESSPART:local}@%{EMAILADDRESSPART:remote}
RELAY (?:%{HOSTNAME:relayhost}(?:\[%{IP:relayip}\](?::[0-9]+(.[0-9]+)?)?)?)
POSREAL [0-9]+(.[0-9]+)?
DELAYS (%{POSREAL}[/]*)+
DSN %{NONNEGINT}.%{NONNEGINT}.%{NONNEGINT}
STATUS sent|deferred|bounced|expired
@diginc
diginc / get-java.sh
Created June 7, 2013 21:17
Based off of https://github.com/flexiondotorg/oab-java6/, but just downloads the .bin or .tar.gz for you. RUN: wget -O ./get-java.sh https://gist.github.com/diginc/5732479/raw/d23f9c35844fde9be8e1d05855ae7044a07ec771/get-java.sh; chmod +x get-java.sh;
#!/bin/bash
function usage() { echo "Allows scriptable downloading of official Java packages.";
echo -e "Options:\n -7: use latest java 7 version\n -v: specify version 6/7\n -u: specify the update version #\n -a: specify x64 or i586";
exit 1;
}
# Defaults Opts
DESTINATION="./"
JAVA_VER=6
Use git for all steps of the process.
Write a server that knows how handle a TODO list. Preferably test driven. Initially the server can use a very simple in-memory collection of items. If time permits, we can have it backed with a database living in another docker container.
Server:
GET /todos
PUT /todos {"title": "<TITLE>", "message": "<MESSAGE"}. Returns the location in the header
GET /todos/ID Returns single note.
POST /todos/ID {"id": "<ID>", "title": "<TITLE>", "message": "<MESSAGE"}. Updates a note
POST /search {"title": "<TITLE_SEARCH_STRING>", , "message": "<MESSAGE_SEARCH_STRING"}. Returns all the todos with a title or message that matches the search. Maybe the search string could be a regex.
#!/bin/bash
RELEASE=`lsb_release --codename | cut -f2`;
DLDEST="/opt/puppetlabs-release-$RELEASE.deb";
if [[ `dpkg -l | grep -c 'puppetlabs-release'` -gt 0 ]] ; then
echo "$DLDEST already installed"
else
sudo wget http://apt.puppetlabs.com/puppetlabs-release-$RELEASE.deb -O $DLDEST;
sudo dpkg -i $DLDEST;
sudo apt-get update;
sudo apt-get install -o Dpkg::Options::="--force-confold" --force-yes -y puppet;