View Employee.java
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
class Employee { | |
public Money calculatePay() { | |
switch (this.type) { | |
case COMMISSIONED: | |
return this.calculateCommissionedPay(); | |
case HOURLY: | |
return this.calculateHourlyPay(); | |
case SALARIED: | |
return this.calculateSalariedPay(); | |
default: |
View pingPossiblities.sh
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
time ( s=192.168.225 ; for i in $(seq 1 254) ; do ( ping -n -c 1 -w 1 $s.$i 1>/dev/null 2>&1 && printf "%-16s %s\n" $s.$i responded ) & done ; wait ; echo ) |
View sublime-markdown-syntax-highlight.xml
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
<!-- Add this to YOUR_THEME.tmTheme, based on https://gist.github.com/CrazyApi/2354062 --> | |
<!-- For Markdown --> | |
<dict> | |
<key>name</key> | |
<string>diff: deleted</string> | |
<key>scope</key> | |
<string>markup.deleted</string> | |
<key>settings</key> | |
<dict> | |
<key>background</key> |
View constantly-print-subprocess-output-while-process-is-running.py
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
import subprocess | |
def execute(command): | |
process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | |
output = '' | |
# Poll process for new output until finished | |
for line in iter(process.stdout.readline, ""): | |
print line, | |
output += line |
View checkProcessesSwapUsage.sh
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 | |
cd /proc | |
for pid in [0-9]*; do | |
command=$(cat /proc/$pid/cmdline) | |
swap=$( | |
awk ' | |
BEGIN { total = 0 } |
View .inputrc
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
"\e[A": history-search-backward | |
"\e[B": history-search-forward | |
set show-all-if-ambiguous on | |
set completion-ignore-case on |
View git-hook-post-receive.py
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 python | |
LOG_FILENAME = '/var/log/git-hook-post-receive.log' | |
from datetime import datetime | |
if __name__ == '__main__': | |
try: | |
from sys import stdin | |
prev_sha, new_sha, ref = stdin.readline().split() |
View handleCWD.sh
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
CWD=`cd $(dirname $0);pwd` | |
cd $CWD; |