2013/03/20
- Taxim - Greek
- Cumin - Indian
- Piece - Pizza
- Antique Taco - Tacos
- Neon Wilderness - drinks
| def timed(logger): | |
| def timed_inner(func): | |
| @wraps(func) | |
| def with_timing(*args, **kwargs): | |
| start_time = datetime.now() | |
| logger.debug(f"Executing {func.__name__}") | |
| result = func(*args, **kwargs) | |
| end_time = datetime.now() | |
| td = end_time - start_time |
| #!/bin/sh | |
| # | |
| # usage: invoke.sh <method name> <input file> | |
| # | |
| tmpfile=$(mktemp /tmp/invoke.XXXXXX) | |
| foo=$(jq -c -M . $2) | |
| aws lambda invoke --function-name $1 --payload $(printf "%s" $foo) $tmpfile 1>&2 | |
| cat $tmpfile | |
| rm $tmpfile |
| aws ec2 describe-instances --filters "Name=tag-key,Values=Name" --query 'Reservations[*].Instances[*].{Instance:InstanceId,Instance:PrivateIpAddress,AZ:Placement.AvailabilityZone,Name:Tags[?Key==`Name`]|[0].Value}' --output table |
| public abstract class BaseObject | |
| { | |
| public override int GetHashCode() | |
| { | |
| return SignificantAttributes() | |
| .Aggregate(17, (current, obj) => current + (13 * obj.GetHashCode())); | |
| } | |
| public override bool Equals(object obj) |
| alias outgoing='git log @{u}.. --pretty=oneline' |
| import org.junit.*; | |
| import org.junit.runner.*; | |
| import java.util.*; | |
| public class Solution { | |
| public static void main(String[] args) { | |
| JUnitCore.main("Solution"); | |
| } | |
| #Just some stuff for the old bashrc | |
| function parse_git_dirty { | |
| [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working tree clean" ]] && echo "*" | |
| } | |
| function parse_git_branch { | |
| git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/" | |
| } | |
| var assert = require('assert'); | |
| function angleAt(hour, minute) { | |
| hour = hour > 11 ? 12 - hour : hour; | |
| var minute_hand = 6 * minute, | |
| // 720 minutes in one 12 hour period. 360 degrees / 720 minutes = 0.5 degrees per minute | |
| hour_hand = 0.5 * (60 * hour + minute); | |
| var solution = Math.abs(hour_hand - minute_hand); | |
| return solution > 180 ? 360 - solution : solution; | |
| } |