This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
ambiguous_characters = %w{ O 0 l I 1 |} | |
special_characters = %w{ ! @ # $ % ^ & * ( ) - _ + = [ ] | ; : " , < . > / ? ~ } | |
character_set = [('a'..'z'), ('A'..'Z'), (0..9), special_characters].map do |item| | |
item.to_a | |
end | |
character_set.flatten!.map(&:to_s) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
SOURCE_PAGE="http://google.com/" | |
DEST_FILE="formatted-google-homepage.html" | |
require "nokogiri" | |
require "open-uri" | |
pretty_print_xsl = <<-EOS | |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
require 'fileutils' | |
fswebcam_path = `which fswebcam`.strip | |
exit 0 if fswebcam_path.empty? | |
print "Snapshotting your pretty mug..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'json' | |
unsafe_json = <<-EOS | |
{ | |
"json_class": "DangerousClass", | |
"command": "sudo rm -rf /" | |
} | |
EOS | |
# OH GOD WHERE DID MY SYSTEM GO!? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra_app' | |
# This comes from the sinatra-contrib gem | |
require 'sinatra/decompile' | |
# This will print all of the configured routes for the sinatra application in | |
# the order that the route was first specified. All of the methods will be | |
# combined together and it will format the output into neat columns. Very useful | |
# for debugging when an incorrect route is being hit. | |
desc "List all of the routes configured" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'singleton' | |
Config = Struct.new(:a, :b) | |
class Config | |
include Singleton | |
def self.[](arg) | |
instance.public_send(arg.to_sym) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'socket' | |
# cc.cc, cu.cc, cz.cc, co.nr, dot.tk -> Free domain services | |
# Pity can't do .ie, .it as they're common word endings | |
# This is a list of the ASCII internationalized TLDs that allow second level | |
# domain registrations and do not require any form of physical presence of | |
# citizenship within their country as reported by Wikipedia. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ "$1" == "" ]]; then | |
echo "You need to provide the device to operate on" | |
exit 1 | |
fi | |
echo 'Blowing away any partition tables...' | |
#dd if=/dev/zero of=$1 bs=1k count=1024 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Anonymous+Pro:400,700|Droid+Sans+Mono|Open+Sans:400,700|Linden+Hill|Quattrocento:400,700|News+Cycle:400,700|Antic+Slab|Cabin+Condensed:400,700"> | |
<style> | |
body { | |
font-family: 'Open Sans', Helvetica, Arial, FreeSans; | |
font-size: 12pt; | |
color: #666; | |
margin-top: 40px; | |
text-align: center; |
OlderNewer