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
// hah silly human # is for Python comments! | |
// created in Google Apps Script and scheduled to run every minute | |
function processInboxEmailSubjects() { | |
var threads = GmailApp.search("is:unread newer_than:1d -label:spam") | |
Logger.log("Examining " + threads.length + " threads for spam by checking the subject line") | |
for (var i = 0; i < threads.length; i++) { | |
var subject = threads[i].getFirstMessageSubject() | |
const regex = /confirmation#/i | |
let isSpam = regex.test(subject) | |
// TODO other tests as necessary for your particular spam hell |
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
#!/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
#!/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
/* 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
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
# 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
# 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
# place in ~/.oh-my-zsh/custom | |
[ -f ~/.ssh/config ] && : ${(A)ssh_config_hosts:=${${${${(@M)${(f)"$(<~/.ssh/config)"}:#Host *}#Host }:#*\**}:#*\?*}} | |
[ -f ~/.ssh/known_hosts ] && : ${(A)ssh_known_hosts:=${${${(f)"$(<$HOME/.ssh/known_hosts)"}%%\ *}%%,*}} | |
zstyle ':completion:*:hosts' hosts $ssh_config_hosts $ssh_known_hosts |
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 | |
# derived from http://www.mactrast.com/2011/07/how-to-enable-trim-support-for-all-ssds-in-os-x-lion/ | |
# requires that you run with sudo | |
cp /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage /IOAHCIBlockStorage.original | |
perl -pi -e 's|(\x52\x6F\x74\x61\x74\x69\x6F\x6E\x61\x6C\x00).{9}(\x00\x51)|$1\x00\x00\x00\x00\x00\x00\x00\x00\x00$2|sg' \ | |
/System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage | |
sudo kextcache -system-prelinked-kernel | |
sudo kextcache -system-caches |
NewerOlder