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 | |
# Watch a running process and notify by email when it's done | |
# usage ./pcomplete.sh pid email | |
# or nohup ./pcomplete.sh pid email & to background it | |
# TODO verify args | |
# TODO timeout option | |
# TODO include abiity to detach and run in the background |
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
# http://adventofcode.com/day/1 - part 1 | |
# | |
# instructions - String containing coded instructions for moving up a floor with | |
# "(" and down a floor with ")" | |
# Starting ground floor numbered zero is assumed. | |
# | |
# Returns an integer value for the expected floor. | |
def ups_and_downs(instructions) | |
instructions.count("(") - instructions.count(")") | |
end |
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
# http://adventofcode.com/day/2 - part 1 | |
# | |
# present_dimensions - String a list of present dimensions, each in the format of | |
# 1x2x3 where 1 is the length, 2 is the width and 3 is the height, | |
# in feet. | |
# | |
# Returns an integer of the area of wrapping paper required, in square feet. | |
def required_wrapping_paper(present_dimensions) | |
total_area = 0 |
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
# http://adventofcode.com/day/3 - part 1 | |
# | |
# instructions - String with sequentials commands for which direction to take. | |
# ^ north, v south, > east, < west | |
# | |
# Returns an integer of the area of wrapping paper required, in square feet. | |
def houses_visited(instructions) | |
visited = [[0, 0]] | |
x = 0 |
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
// http://adventofcode.com/day/1 - part 1 | |
// | |
// instructions - String containing coded instructions for moving up a floor with | |
// "(" and down a floor with ")" | |
// Starting ground floor numbered zero is assumed. | |
// Returns an integer value for the expected floor. | |
func upsAndDowns(instructions: String) -> Int { | |
var floor: Int = 0 | |
for character in instructions.characters { |
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
# http://adventofcode.com/day/2 | |
defmodule AdventDay2 do | |
# Part 1 | |
# | |
# present_dimensions - String a list of present dimensions, each in the format of | |
# 1x2x3 where 1 is the length, 2 is the width and 3 is the height, | |
# in feet. | |
# | |
# Returns an integer of the area of wrapping paper required, in square feet. | |
def required_wrapping_paper(present_dimensions) do |
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
# http://adventofcode.com/day/3 - part 1 | |
# | |
# instructions - String with sequentials commands for which direction to take. | |
# ^ north, v south, > east, < west | |
# | |
# Returns an integer of the area of wrapping paper required, in square feet. | |
def houses_visited_by_santa(instructions): | |
visited = [[0, 0]] | |
x = y = 0 |
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
// http://adventofcode.com/day/4 | |
// key should be passed on the command line as the first argument | |
// number of leading zeroes is the second argument | |
package main | |
import "crypto/md5" | |
import "fmt" | |
import "os" | |
import "strconv" | |
import "strings" |
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 | |
# http://adventofcode.com/day/5 | |
# Part 1 | |
grep ".*[aeiou].*[aeiou].*[aeiou].*" day5_input.txt | grep -E "([a-z])\1" | grep -v -E "(ab|cd|pq|xy)" | wc -l | |
# Part 2 | |
grep -E "([a-z]).{1}\1" day5_input.txt | grep -E "([a-z]{2}).*\1" | wc -l |
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
// http://adventofcode.com/day/10 | |
// run with "./advent_day_10 input iterations" | |
// e.g. ./advent_day_10 1113122113 40 | |
package main | |
import "fmt" | |
import "os" | |
import "strconv" |