This file contains hidden or 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 | |
SG_ID="sg-xxxxxxxxxxx" | |
print_separator() { | |
printf '%.0s-' {1..80} | |
echo | |
} | |
echo "Checking resources using Security Group $SG_ID..." |
This file contains hidden or 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 java.util.HashMap; | |
import java.util.Map; | |
public class LRUCache<K, V> { | |
private final Map<K, Pair<Node<K>, V>> map = new HashMap<K, Pair<Node<K>,V>>(); | |
private Node<K> head = null; | |
private Node<K> tail = null; | |
private final int maxSize; | |
This file contains hidden or 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 | |
IP=`ifconfig | grep "inet " | grep -v "inet 127.0.0.1" | cut -f 2 -d " "` | |
PORT=$1 | |
if [ -z "$1" ] | |
then | |
PORT=8000 | |
fi | |
# Copy ip and port to pasteboard |
This file contains hidden or 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
https://help.ubuntu.com/community/EC2StartersGuide |
This file contains hidden or 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
git log --committer=tjulien -p --no-prefix --simplify-merges --reverse --since="4 weeks ago" |
This file contains hidden or 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
https://github.com/mongodb/mongo/blob/master/jstests/geo_haystack2.js | |
t = db.geo_haystack2 | |
t.drop() | |
function distance( a , b ){ | |
var x = a[0] - b[0]; | |
var y = a[1] - b[1]; | |
return Math.sqrt( ( x * x ) + ( y * y ) ); | |
} |
This file contains hidden or 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
Command-Shift-3: Take a screenshot of the screen, and save it as a file on the desktop | |
Command-Shift-4, then select an area: Take a screenshot of an area and save it as a file on the desktop | |
Command-Shift-4, then space, then click a window: Take a screenshot of a window and save it as a file on the desktop | |
Command-Control-Shift-3: Take a screenshot of the screen, and save it to the clipboard | |
Command-Control-Shift-4, then select an area: Take a screenshot of an area and save it to the clipboard | |
Command-Control-Shift-4, then space, then click a window: Take a screenshot of a window and save it to the clipboard |
This file contains hidden or 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 | |
# login to an ec2 instance sitting behind an elb | |
if [ -z $1 ] | |
then | |
echo "Usage: ec2_ssh.sh elb-tag-name" | |
exit 1 | |
fi |
This file contains hidden or 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 | |
# pretty-prints json | |
# Usage: curl http://foo.com/foo.json | json.sh | |
python -m json.tool |
This file contains hidden or 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
# print http headers and body | |
tshark -R 'http' -S -V -l | awk '/^[HL]/ {p=30} /^[^ HL]/ {p=0} /^ / {--p} {if (p>0) print}' |
NewerOlder