Skip to content

Instantly share code, notes, and snippets.

Andrew Coleman penguincoder

Block or report user

Report or block penguincoder

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile

Keybase proof

I hereby claim:

  • I am penguincoder on github.
  • I am penguincoder ( on keybase.
  • I have a public key ASD7uK4ULWqyNQbV6YHMzdX7NG_brCLKqqkPx79pPb8DHQo

To claim this, I am signing this object:

penguincoder / Dockerfile
Created Jul 2, 2018
reimplement Ruby's native `.to_i`
View Dockerfile
FROM ruby:2.5-alpine
COPY convert.rb /
RUN chmod 700 /convert.rb
CMD /convert.rb
View Dockerfile
FROM ruby:2.5-alpine
COPY coin.rb /
RUN chmod 700 /coin.rb
CMD /coin.rb
penguincoder / Dockerfile
Created Jun 12, 2018
Even Fibonacci Numbers
View Dockerfile
FROM ruby:2.5.1-alpine3.7
COPY fib.rb /
RUN chmod 750 /fib.rb
CMD [ "/fib.rb" ]
penguincoder / redis_mutex.rb
Last active Aug 29, 2015
A Redis-backed mutex that uses Lua transactions
View redis_mutex.rb
require 'digest/md5'
require 'redis'
class RedisMutex
MutexTimeout =
LUA_ACQUIRE = "return'SET', KEYS[1], ARGV[2], 'NX', 'EX', ARGV[1]) and'expire', KEYS[1], ARGV[1]) and 1 or 0"
LUA_RELEASE = "if'get', KEYS[1]) == ARGV[1] then return'del', KEYS[1]) else return 0 end"
View american_date_monkey_patch.rb
# © 2009 Andrew Coleman
# Released under MIT license.
# total hack to allow american style date parsing.
# does not allow european-ish date parsing, sorry.
module AmericanDateMonkeyPatch
def to_date
View pg2mysql.rb
#!/usr/bin/env ruby
# Andrew Coleman <mercury at penguincoder dot org>
# Released under the GPLv2
# General purpose tranlator for pgsql -> mysql. Best used with Rails-like data.
# Use: pg_dump -DOx [dbname] > outputfile
# to get a proper dump for this program.
View vigenere.rb
#!/usr/bin/env ruby
# A pure ruby version of a Vigenere cipher engine. Encodes, decodes and guesses
# keys.
class Vigenere
# Encodes a plaintext string into a enciphered code. Strips all
# nonalphanumeric characters from input. Takes the following keys:
You can’t perform that action at this time.