This file contains hidden or 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
# FSM Simulation | |
edges = { | |
[1, 'a'] => 2, | |
[2, 'a'] => 2, | |
[2, '1'] => 3, | |
[3, '1'] => 3 | |
} | |
accepting = [3] |
This file contains hidden or 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 | |
############################################################################### | |
# Required Application Libraries # | |
############################################################################### | |
%w{ rubygems optparse ostruct socket yaml }.each { |lib| require lib } | |
############################################################################### | |
This file contains hidden or 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 | |
USER="$1" | |
PASS="$2" | |
DB="$3" | |
if [ $# -ne 3 ] | |
then | |
echo "Usage: $0 {MySQL-User-Name} {MySQL-User-Password} {MySQL-Database-Name}" | |
echo "Drops all tables from a MySQL" | |
exit 1 |
This file contains hidden or 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
<?php | |
$field = "field"; | |
$hasField = false; | |
$table = "table"; | |
$connect = @mysql_connect("host","username","password"); | |
if (!$connect) echo "Server error: CONN"; | |
$select_db = mysql_select_db("database"); | |
if (!$select_db) echo "Server error: DB"; | |
$result = mysql_query("SHOW COLUMNS FROM $table"); | |
while ($row = mysql_fetch_array($result)) |
This file contains hidden or 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 'anemone' | |
urls = [] | |
Anemone.crawl("http://liveclippings.interdev.biz/") do |anemone| | |
anemone.on_every_page do |page| | |
# puts "#{page.url}" | |
urls.push page.url |
This file contains hidden or 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 | |
%w{fileutils}.each { |lib| require lib } | |
Dir.glob((ARGV[0][-1] == '/') ? ARGV[0] + '**/*' : ARGV[0] + '/**/*', File::FNM_DOTMATCH) { |node| FileUtils.rm_rf node if File.directory?(node) && File.basename(node) =~ /\.svn$/ } |
This file contains hidden or 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' | |
Dir.glob('/Volumes/Share/Media/Videos/Software\ Training/video/*').each do |file| | |
fn = File.basename file, File.extname(file) | |
sd = File.dirname(file) + '/../' + 'source/' | |
sf = sd + fn + '.zip' | |
nd = File.dirname(file) + '/../' + fn | |
(File.exists? nd) ? next : Dir.mkdir(nd) |
This file contains hidden or 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
# http://ruby-doc.org/stdlib-1.9.3/libdoc/net/smtp/rdoc/Net/SMTP.html | |
require 'digest/md5' | |
require 'mime/types' | |
require 'net/smtp' | |
require 'optparse' | |
require 'ostruct' | |
require 'yaml' | |
class Emailer |
This file contains hidden or 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
module FlatFileProperties | |
def properties(*attributes) | |
@file_properties = attributes | |
end | |
def file_properties | |
@file_properties | |
end | |
end |
This file contains hidden or 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 'open-uri' | |
require 'nokogiri' | |
def get_anchors_from_html_doc html_doc | |
# Returns a Nokogiri::XML::NodeSet | |
html_doc.css('a') | |
end |