Skip to content

Instantly share code, notes, and snippets.

View bluegod's full-sized avatar
🏠
Working from home

James Lopez bluegod

🏠
Working from home
View GitHub Profile
#One line (command line) solution in Ruby to the Lattice paths problem for a configurable 20x20 frame.
echo "r=20;n=r+20; ((0...r).inject(1) do |m,i| (m * (n - i)) / (i + 1) end)" | irb
@bluegod
bluegod / gist:d0a5ce8eeb82475a843f
Created August 11, 2014 11:07
Backron - filesystem/DB backup script. (old)
#!/bin/sh
# Backron - Full and incremental backup script
# Based on a script by Daniel O'Callaghan <danny@freebsd.org>
# Done by James López (BLuEGoD) <bluegod at bluegod.net>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
@bluegod
bluegod / gist:92528d41deaba36bc64b
Created August 11, 2014 11:06
scanline-fill algorithm written in Ruby (non-recursive version)
# Scanline-fill <James.Lopez at bluegod.net>
# GPLv2 License
# I've based this method on:
# http://en.wikipedia.org/wiki/Flood_fill#Scanline_fill
# Seems the most efficient way as alternatives:
# Recursion: Stack overflow problem
# Pixel by pixel: at least 1 order of magnitude less efficient.
#
# https://github.com/bluegod/scanlinefill