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: |
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 ) |
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> |
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 |
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 } |
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 |
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() |
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; |