Skip to content

Instantly share code, notes, and snippets.

@jblakeman
jblakeman / html_boilerplate.bash
Last active February 20, 2016 17:55
HTML Boilerplate Generator
# Output HTML boilerplate code to a file name specified by the first argument
# If no arguments are provided, outputs to index.html
# example:
# html_boilerplate example.html
html_boilerplate() {
[[ $1 ]] || {
echo "usage: $FUNCNAME outfile"
return 1;
@jblakeman
jblakeman / vignere.rb
Last active March 16, 2016 01:20
Vignere Cipher Encryption
def vignere(message, keyword)
min_byte = 97
max_index = 26
cipher = ""
message.downcase.split("").each_with_index do |char, i|
cipher_i = (char.ord - min_byte) + (keyword[i].ord - min_byte)
cipher_i -= max_index if cipher_i > max_index
cipher += (cipher_i + min_byte).chr
end