Posted by admin on June 29, 2010 – 12:09 am
Author: slac3dork
Site: http://snippet.c0de.me
Summary: Generate eight characters random password using Active Support. Active Support is utility classes and standard library extensions from Rails. The preferred method of installing Active Support is through its GEM file. You’ll need to have install RubyGems first (http://docs.rubygems.org/)
#!/usr/bin/env ruby
# _________ .__ .____ _______
# / _____/ ____ |__|_____ | | \ _ \ ____
# \_____ \ / \| \____ \| | / /_\ \ / ___\
# / \ | \ | |_> > |__\ \_/ \/ /_/ >
#/_______ /___| /__| __/|_______ \_____ /\___ /
# \/ \/ |__| \/ \//_____/
# http://snippet.c0de.me
# slac3dork[at]gmail[dot]com
require 'rubygems'
require 'active_support'
passwd = ActiveSupport::SecureRandom.base64(8)
puts "Random Password: " + passwd

Posted by admin on March 30, 2010 – 4:35 am
Author: khelll
Site: http://www.khelll.com/blog/
Summary: Simple script to notify the user when a new question is posted on Stackoverflow, it works on Mac and uses growl. You may need install Nokogiri & Growl.
[sudo] gem install nokogiri
[sudo] gem install growl

Posted by admin on January 16, 2010 – 4:10 pm
Author: slac3dork
Site: http://snippet.c0de.me
Summary: Simple web server using Ruby’s standard library. Tested on Linux and Ruby 1.8.7.
Usage: ruby filename.rb
#!/usr/bin/ruby
# _________ .__ .____ _______
# / _____/ ____ |__|_____ | | \ _ \ ____
# \_____ \ / \| \____ \| | / /_\ \ / ___\
# / \ | \ | |_> > |__\ \_/ \/ /_/ >
#/_______ /___| /__| __/|_______ \_____ /\___ /
# \/ \/ |__| \/ \//_____/
# http://snippet.c0de.me
# slac3dork[at]gmail[dot]com
require 'webrick'
# importing WEBrick module
include WEBrick
# Creating HTTPServer instance on port 2000
server = HTTPServer.new(
:Port => 2000,
:DocumentRoot => "/home/slac3dork/ruby/www/"
)
# To shutdown server if get an interrupt signal (ctrl-c).
trap("INT"){ server.shutdown }
# To run the server
server.start
