Skip to content

Instantly share code, notes, and snippets.

View JGallardo's full-sized avatar

Juan Gallardo JGallardo

View GitHub Profile
@JGallardo
JGallardo / linkValidator.rb
Created December 14, 2012 03:32
Ruby Script that can be used to validate all the links on a web page.
require 'uri'
require 'open-uri'
require 'rubyful_soup'
begin
print "\n\nEnter website to crawl (ex. http://www.google.com): "
url = gets
puts url
uri = URI.parse(url)
html = open(uri).read
@JGallardo
JGallardo / mortgageCalc.rb
Created December 14, 2012 03:06
Very basic script in Ruby to calculate mortgage payments.
print "enter loan amount: "
loan = gets.chomp.to_i
print "Enter length of time in months: "
time = gets.chomp.to_i
print "Enter interest rate: "
rate = gets.chomp.to_f/100
i = (1+rate/12)**(12/12)-1
annuity = (1-(1/(1+i))**time)/i
@JGallardo
JGallardo / decompress.rb
Created December 14, 2012 03:02
Ruby script to decompress files.
require 'zip/zip'
require 'fileutils'
unless ARGV[0]
puts "Usage: ruby decompress.rb <zipfilename.zip>"
puts "Example: ruby decompress.rb myfile.zip"
exit
end
archive = ARGV[0].chomp
@JGallardo
JGallardo / compress.rb
Created December 14, 2012 03:00
Ruby script to compress files.
require 'zip/zip'
unless ARGV[0]
puts "Usage: ruby compress.rb <filename.ext>"
puts "Example: ruby compress.rb myfile.exe"
exit
end
file = ARGV[0].chomp
@JGallardo
JGallardo / fileJoin.rb
Created December 14, 2012 02:52
Ruby script that can join files.
if ARGV.size != 1
puts "Usage: ruby fileJoin.rb <filename.ext>"
puts "Example: ruby fileJoin.rb myfile.txt"
exit
end
file = ARGV[0]
piece = 0
orig_file = "New.#{file}"
@JGallardo
JGallardo / fileSplit.rb
Created December 14, 2012 02:50
Ruby script that can split a file into multiple smaller files
if ARGV.size != 2
puts "Usage: ruby fileSplit.rb <filename.ext> <size_of_pieces_in_bytes>"
puts "Example: ruby fileSplit.rb myfile.txt 10"
exit
end
filename = ARGV[0]
size_of_split = ARGV[1]
if File.exists?(filename)
@JGallardo
JGallardo / decrypt.rb
Created December 13, 2012 03:03
File decryption script written in Ruby
require 'crypt/blowfish'
unless ARGV[0]
puts "Usage: ruby decrypt.rb <Encrypted_filename.ext>"
puts "Example: ruby decrypt.rb" Encrypted_secret.stuff"
exit
end
filename = ARGV[0].chomp
puts "Decrypting #{filename}."
@JGallardo
JGallardo / changedFiles.rb
Created December 13, 2012 02:35
File integrity validation script written in Ruby.
require 'find'
require 'digest/md5'
unless ARGV[0] and File.directory?(ARGV[0])
puts "\n\n\nYou need to specify a root directory: changedFiles.rb
<directory>\n\n\n"
exit
end
root = ARGV[0]
@JGallardo
JGallardo / encrypt.rb
Created December 13, 2012 02:29
File encryption script written in Ruby
require 'crypt/blowfish'
unless ARGV[0]
puts "Usage: ruby encrypt.rb <filename.ext>"
puts "Example: ruby encrypt.rb secret.stuff"
exit
end
#take in the file name to encrypt as an argument
filename = ARGV[0].chomp
@JGallardo
JGallardo / index.html
Created December 2, 2012 09:47
home page for VidTalk landing page (under review)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>VidTalk</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Video Walkie Talkie App">
<meta name="author" content="Juan Gallardo">
<!-- styles -->
<link href="css/bootstrap.css" rel="stylesheet">