Skip to content

Instantly share code, notes, and snippets.

@boone
boone / enigma.exs
Created Aug 2, 2016
Enigma Machine Modeled in Elixir
View enigma.exs
# Elixir Enigma Machine Simulator
# August 2016
# Mike Boone
# https://github.com/boone
# https://twitter.com/boonedocks
# Trying to learn Elixir by modeling an Enigma machine, inspired by the Ruby
# code written by @albert_still in:
# http://red-badger.com/blog/2015/02/23/understanding-the-enigma-machine-with-30-lines-of-ruby-star-of-the-2014-film-the-imitation-game
View image.module.php
<?php
// $Id: image.module,v 1.197.2.1 2006/07/13 15:42:33 walkah Exp $
// Modified to use filemanager.module
// by Mike Boone (contact me at: http://boonedocks.net/mailmike.php)
// Version 0.1, 2006-08-27
//
// Version History
// 0.1, 2006-08-27, first working version
//
// I borrowed some ideas from this code:
View bround-bsd.inc.php
<?php
/*
Banker's Rounding v1.01, 2006-08-15
Copyright 2006 Michael Boone
mike@Xboonedocks.net (remove the X)
http://boonedocks.net/
Provided under the a BSD-style License
A GPL licensed version is available at:
http://boonedocks.net/code/bround.inc.phps
View bround.inc.php
<?php
/*
Banker's Rounding v1.01, 2006-08-15
Copyright 2006 Michael Boone
mike@Xboonedocks.net (remove the X)
http://boonedocks.net/
Provided under the GNU General Public License
Contact me for use outside the bounds of that license
View location_parser.inc.php
<?php
/*
Location Parser v1.01, 2005-04-17
Copyright 2005 Michael Boone
mike@Xboonedocks.net (remove the X)
http://boonedocks.net/
Provided under the GNU General Public License
Contact me for use outside the bounds of that license
View antispamquestion.module.php
<?php
// $Id: antispamquestion.module $
//
// Anti-Spam Question Module
// for Drupal 4.7.x
// by Mike Boone (contact me at: http://boonedocks.net/mailmike.php)
// Version 0.1, 2007-05-30
//
// Version History
// 0.1, 2007-05-30, first working version
View advent_day_10.go
// 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"
View advent_day_5.sh
#!/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
View advent_day_4.go
// 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"
View advent_day_3.py
# 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