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 | |
# | |
# Based on this post that also gives an example on how to verify the certificate: | |
# http://stackoverflow.com/questions/2507902/how-to-validate-ssl-certificate-chain-in-ruby-with-net-http | |
# | |
require 'net/http' | |
require 'openssl' | |
uri = URI('https://username:password@example.com/myresource') |
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
$:.unshift File.expand_path(File.join(File.dirname(File.join(__FILE__)), '../lib')) |
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
cd ~/Downloads | |
wget http://support.apple.com/downloads/DL1359/en_US/JavaForMacOSX10.5Update10.dmg \ | |
-O ~/Downloads/JavaForMacOSX10.5Update10.dmg | |
hdiutil attach ~/Downloads/JavaForMacOSX10.5Update10.dmg | |
pkgutil --expand /Volumes/Java\ For\ Mac\ OS\ X\ 10.5\ Update\ 10/JavaForMacOSX10.5Update10.pkg \ | |
~/Downloads/JavaForMacOSX10.5Update10 | |
cd ~/Downloads/JavaForMacOSX10.5Update10/JavaForMacOSX10.5Update10.pkg/ |
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
%_topdir %(echo ${HOME}/redhat) | |
%_tmppath %{_topdir}/tmp | |
%packager Marcos Hack <marcos.hack@abril.com.br> |
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
#making .irbrc posted at http://www.tech-angels.fr/post/963080350/improve-irb-and-fix-it-on-mac-os-x | |
#work with rails3 | |
require 'rubygems' | |
#rails3: be sure to include wirble and hirb in your Gemfile | |
require 'wirble' | |
require 'hirb' | |
Wirble.init | |
Wirble.colorize | |
# hirb (active record output format in table) |
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 | |
CLASS_NAME=$1 | |
if [[ $CLASS_NAME == "" ]]; then | |
echo -e "\nUsage: $0 CLASS_NAME\n" | |
exit 1 | |
fi | |
for i in `find . -name *.jar`; do |
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
mvn deploy:deploy-file \ | |
-DgroupId=<JAR_GROUP> \ | |
-DartifactId=<JAR_NAME> \ | |
-Dversion=<JAR_VERSION> \ | |
-Dpackaging=jar \ | |
-Dfile=</path/to/file> | |
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 'rake/testtask' | |
task :default => [:test] | |
task :test do | |
Rake::TestTask.new do |t| | |
t.libs << "test" | |
t.options = "-v" | |
t.test_files = FileList['test/tc*.rb'] | |
t.verbose = true |
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 | |
=begin | |
backshot.rb is a Ruby program driving | |
Amazon EBS <http://aws.amazon.com/ebs/> | |
to generate snapshots for backup purposes. | |
Hourly, daily, weekly, and monthly snapshots | |
are generated by default. |
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
/** | |
* Read a file line by line in Java using FileReader and BufferedReader. | |
* @author Marcos Hack <marcoshack@gmail.com> | |
*/ | |
public class FileReader { | |
String fileName = "/path/to/your/file"; | |
try { | |
fileReader = new FileReader(fileName); | |
bufferedReader = new BufferedReader(fileReader); |