This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# var is set to CLI parameter 1 or "value" if not passed | |
VAR=${1-value} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# the directory where the shell script physically resides | |
SCRIPT_HOME_DIR="$( cd "$( dirname "$0" )" && pwd )" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -name pom.xml -print0 | xargs -0 sed -i "" "s/{artifactId}/{project.artifactId}/g" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* get around scala-stm 2.10.0 vs. 2.10 in play vs. reactive mongo */ | |
someDependency exclude("org.scala-stm", "scala-stm_2.10.0") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
LOG_DIR=/var/log/trafficland | |
find $LOG_DIR -type d -print0 | while IFS= read -r -d '' dir | |
do | |
rm $dir/*.log > /dev/null 2>&1 | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
HOSTNAME=`hostname` | |
ETC_HOSTS=/etc/hosts | |
if ! grep $HOSTNAME $ETC_HOSTS > /dev/null ; then | |
if grep "127.0.0.1" $ETC_HOSTS > /dev/null ; then | |
sed -i "s/127\.0\.0\.1.*$/& $HOSTNAME/" $ETC_HOSTS | |
else | |
echo "127.0.0.1 localhost $HOSTNAME" >> $ETC_HOSTS | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Joy of Clojure pp85-86 | |
(defn neighbors | |
([size yx] (neighbors [[-1 0] [1 0] [0 -1] [0 1]] size yx)) | |
([deltas size yx] | |
(filter (fn [new-yx] | |
(every? #(< -1 % size) new-yx)) | |
(map #(map + yx %) deltas)))) | |
; usage | |
(def matrix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Next Time Someone Claims To Be | |
An 'Engineer,' Give Them This Test. | |
Engineering is so trendy these days that everybody | |
wants to be one. The word "engineer" is greatly | |
overused. If there's somebody in your life who you | |
think is trying to pass as an engineer, give him this | |
test to discern the truth. | |
ENGINEER IDENTIFICATION TEST | |
You walk into a room and notice that a picture is | |
hanging crooked. You... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# from https://gist.github.com/JonRowe/8f128cbfca40d61547bc with comments for 2nd patch | |
# original script author JonRow, 2nd patch script: rwebler | |
# recommend running these commands manually from Terminal, requires sudo for install | |
# you can: | |
# curl -L _this-url_ | sh | |
# if you are lazy | |
mkdir /tmp/bash-fix | |
cd cd /tmp/bash-fix | |
curl https://opensource.apple.com/tarballs/bash/bash-92.tar.gz | tar zxf - | |
cd bash-92/bash-3.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Prints out the Windows netsh command necessary to port forward on localhost to another | |
# IP address. Especially useful when testing IE11 with APIs like Google Maps that only | |
# permit localhost connectivity but the actual server is on your local OSX host machine | |
# usage: | |
# netsh [interface] [port] | |
# | |
# e.g., |