Skip to content

Instantly share code, notes, and snippets.

Select e.EncounterNo, e.EncntrStartDate, EncntrType, EncntrClass, IpOpInd
From Encounters as e
Left Outer Join #valid_encounters as ve on e.EncntrOwnerId = ve.EncntrOwnerId
Where e.EncntrStartDate >= '1/1/2000' and e.EncntrStartDate < '1/1/2010'
AND ve.EncntrOwnerId is null
#!/usr/bin/ruby
require 'net/smtp'
def send_mail(options = {})
begin
puts "Assembling mail..."
options = {
:smtp_server => '555.55.55.555',
:from => '[email protected]',
:to => '[email protected]',
#!/usr/bin/env ruby -wKU
require "rexml/document"
require 'FileUtils'
include REXML
# Update the xml
Dir.glob( "./*.bafxml" ) do |batch_file|
puts batch_file.to_s
doc = REXML::Document.new File.new( batch_file, 'r' )
@ebot
ebot / ruby_switcher.bat
Created February 9, 2010 20:14
Switches windows ruby environment between 1.8 and 1.9.
@echo off
IF EXIST c:\ruby18 GOTO switch_19
IF EXIST c:\ruby19 GOTO switch_18
echo No alternate ruby environment found.
GOTO print_version
:switch_19
echo Switching to Ruby 1.8...
rename c:\ruby ruby19
@ebot
ebot / get_processed_files.rb
Created February 15, 2010 18:26
Reads through specified log files to get the list of files that were processed.
#!/usr/bin/env ruby -wKU
output = File.new( 'processed.yml', 'w' )
(1..85).each do |number|
file_name = "batch_acquire_results_#{number}.log"
puts "Reading #{file_name}"
input = File.new( file_name, 'r' )
output << "#{file_name}\n"
input.each_line do |line|
@ebot
ebot / read_server_log.rb
Created February 23, 2010 14:56
Reads the apache server log to gather statistics on the web site.
#!/usr/bin/env ruby
require 'rubygems'
require 'RedCloth'
require 'net/ssh'
require 'net/scp'
host_name = 'host_name'
username = 'user_name'
password = 'password'
#!/usr/bin/env ruby
require 'rubygems'
require 'coderay'
require 'win32/clipboard'
require 'htmlclipboard.rb'
include Win32
# gather the file information
code_file_name = ARGV[0]
@ebot
ebot / gist:374311
Created April 21, 2010 19:44
Find documents that were not uploaded..
#!/usr/bin/env ruby -wKU
require "FileUtils"
puts "#{Time.now} - Getting documents that were proccessd."
docs = File.new 'document_list.txt', 'w'
Dir.glob( '*.log' ) do |log_file|
puts " Reading #{log_file}"
docs << "#{log_file}\n"
@ebot
ebot / rename.rake
Created October 21, 2010 14:45
A Rails 3 rake task for renaming the application
namespace 'rails' do
desc 'Renames the current app'
task 'rename' do
# Get the new name
new_name = ENV["NEW_NAME"].capitalize || nil
if new_name.nil?
puts "\nYou must pass in a new name"
exit
end