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
require 'private_pub' | |
PrivatePub.load_config('config/private_pub.yml','development') | |
PrivatePub.publish_to('/faye_images/index/JONJ',{}) |
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 'tk' | |
require 'tkextlib/tile' | |
require 'tkextlib/bwidget' | |
require 'cups' | |
$dirname = TkVariable.new | |
root = TkRoot.new {title "Print Folder"} |
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
require 'csv' | |
require 'pry' | |
require 'mysql2' | |
require 'fileutils' | |
class TrackerCopy | |
PMNAS_PATH = '/media/pmnas02' | |
ORB_RUNNER_PROCESSED_PATH = '/home/public/processed' | |
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
require 'geokit' | |
geo = GeoKit::Geocoders::MultiGeocoder.multi_geocoder('34471') | |
if geo.success | |
geo.state # => FL | |
geo.city # => Ocala | |
geo.country # => US | |
end | |
geo = GeoKit::Geocoders::MultiGeocoder.multi_geocoder('Ocala, FL') |
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
def hour_intervals(start_time, stop_time) | |
results = Hash.new {|h,k| h[k] = Hash.new(0)} | |
(start_time.to_i..stop_time.to_i).step(60).collect do |minute| | |
minute_time = Time.at(minute) | |
interval = case minute_time.min | |
when (0..14) then 0 | |
when (15..29) then 15 | |
when (30..44) then 30 | |
when (45..59) then 45 |
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
def format_currency(input, options = {:currency_symbol => '$', :delimiter => ',', :separator => '.', :precision => 2}) | |
input ||= 0 | |
number = "%01.#{options[:precision]}f" % input.to_d.round(options[:precision]).to_s("F") | |
parts = number.to_s.to_str.split('.') | |
parts[0].gsub!(/(\d)(?=(\d\d\d)+(?!\d))/, "\\1#{options[:delimiter]}") | |
options[:currency_symbol] + parts.join(options[:separator]) | |
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
require 'prawn' | |
def cellify(data, default_options = nil) | |
default_options ||= {:borders => []} | |
output = [] | |
row_options = default_options.delete(:rows) || Hash.new {|h,k| h[k] = {}} | |
column_options = default_options.delete(:columns) || Hash.new {|h,k| h[k] = {}} | |
current_row = -1 | |
data.each do |row| |
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 'pathname' | |
old_controller_name = ARGV[0] | |
new_controller_name = ARGV[1] | |
old_routes = `rake routes | grep #{old_controller_name}`.split("\n").map{|str| str.strip.split.first}.uniq.compact - ['GET','PUT','POST','DELETE','root'] | |
routes_file_contents = File.read('config/routes.rb') | |
File.open('config/routes.rb', 'w'){|io| io.write routes_file_contents.gsub(":#{old_controller_name}", ":#{new_controller_name}") } |
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
require 'barby' | |
require 'barby/barcode/code_39' | |
require 'barby/outputter/cairo_outputter' | |
File.open('pp_002.eps', 'w'){|io| io.write Barby::Code39.new('PP 002').to_eps} |
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
sudo su - zimbra | |
# list all accounts and print out account name and aliases | |
for i in `zmprov -l gaa` ; do zmprov ga $i zimbraMailAlias ; done | |
# list all distribution lists and any members and/or aliases | |
for i in `zmprov gadl` ; do zmprov gdl $i zimbraMailAlias zimbraMailForwardingAddress ; done |