Skip to content

Instantly share code, notes, and snippets.

<?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
@boone
boone / enigma.exs
Created August 2, 2016 02:46
Enigma Machine Modeled in Elixir
# 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
<?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:
<?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
<?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
<?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
// 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"
@boone
boone / fix_sql_injection_2.rb
Last active December 10, 2015 13:18
Monkey patch for CVE-2012-5664 on Rails 2.3.14
# Monkey patch for CVE-2012-5664 on Rails 2.3.14
# put this file in your config/initializers directory
# comments/corrections: https://gist.github.com/2921706
# Ruby on Rails SQL Injection
# based on a patch from @tenderlove
# https://rubyonrails-security.googlegroups.com/attach/23daa048baf28b64/2-3-dynamic_finder_injection.patch?view=1&part=2
module ActiveRecord
class Base
#!/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
// 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"