Skip to content

Instantly share code, notes, and snippets.

View mikeymckay's full-sized avatar

Mike McKay mikeymckay

View GitHub Profile
#!/usr/bin/ruby
#
#You will need ruby and a hpricot to make it work (depending on your setup):
#sudo apt-get install ruby1.8 libhpricot-ruby
#or
#sudo gem install hpricot
#
#Then you will need to add the following to your /etc/aliases file:
#weather: |/path/to/weather_email.rb
#And then run the following to load the new email alias:
#!/usr/bin/env ruby
require 'rubygems'
require 'id3lib'
require 'earworm'
require 'yaml'
CONFIG = File.join(File.expand_path(ENV['HOME']), '.earworm')
begin
config = YAML.load_file(CONFIG)
class String
def change_case
self.gsub(/([A-Z]*)([a-z]*)/){"#{$1}".downcase + "#{$2}".upcase}
end
end
"UPUPdowndownLeftrIGHTlEFTrightBABAstart".change_case
#!/bin/sh
# the command= trick gets screwed up with quotes so be careful
echo "Hostname is currently `hostname`"
# TODO setup hostname
# TODO setup LibertyNet/connectivity
#todo insert gerbo alex and dave's public key
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAyUvMIvhJUYs7nIaiLBnUcs03XuOeHiw1JGh1M/ovbKc9YO4SJsl9CYxpyDeh9jSyvdNhNdeUSg7PBSSyAYpVXeK6WXN9LnqKOWRu8n5rXGNSycM2tenaADiS/xtMkHmIFYOE/QFQF+Amg5lKR1DjsfZXzscdtYsmAT09j6GFYfgY/KIP/gxSsEDzOGSIxYqJwpCzV+/nwub72ElzVcW9EJu2HpSD8jhKF6XrZ3VExsCk9v86qrTGWeVOyFubRb7+V6Db4xc+x2HirdyMW7hZceDfTpB0xX1GXd4PYZ023gfvNkGbIj/aOSDeJtDIJyQhzCbIXY+CiLkU556e0rg2Nw== njero@alexandria.local
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAzFtSLwtu0GoHLWG8X5ScMBX0xYtxjlWiEhEJRPWoIq+e4MQg34mtSEUtVt9lyeiAx9PfrmFhcbFeL72Y1bRi7bxEy+9Nu72bEPicVibukTuiFz1M0snoHVCtr6FnHd8q29+hcfeaqFwn2lIyE11DiH5aHOd2hAPNAVQ/p1CPY5HCmIerIuuE+QgEQTE6Zm3Lp8L4LvyFhZl4kZ5CLx8mOQWIj8ZVh3HUvCCh2b3AZdZzOE4E2Jk0ST4QJ7IlenRQ+9E6RKQ6pVOYgYunfhD0IIaXrd9UiGTGm+G/3YfKHhIznF3QyBv5lW06A5BKz37v8rXil7zu0jKLh5Kf41BiAQ== ace@lalanje
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAzb5cQe46LoJB5PQou+Rc+BNyRLC5iMILS8/KddZUJGdQobzzx6pxyvS6Wq9i6EGj6X8WzGTa9FLgFUNI1EGg0wLMANTpDwiMYyBLZQ8oLwbUkTrQaDKw8Bf/FwLQiaUjx0DB7U7YNJlGMZ
DELETE FROM schema_migrations;
Query OK, 10 rows affected (0.03 sec)
mysql> exit
Bye
crazy@paiute:/var/www/bart$ rake db:migrate RAILS_ENV=development
(in /var/www/bart)
== 20080405175950 LoadBaseLegacySchema: migrating =============================
== 20080405175950 LoadBaseLegacySchema: migrated (0.0000s) ====================
@cohort_patient_ids[:all] = PatientRegistrationDate.find(:all,
# :joins => 'LEFT JOIN patient_identifier ON
# patient_identifier.patient_id = patient_registration_dates.patient_id
# AND identifier_type = 18 AND voided = 0',
:conditions => ["DATE(registration_date) >= ? AND DATE(registration_date) <= ?",
@quarter_start, @quarter_end]
# :order => 'CONVERT(RIGHT(identifier, LENGTH(identifier)-3), UNSIGNED)').map(&:patient_id)
).map(&:patient_id)
# @cohort_patient_ids[:start_reasons] = start_reasons[1]
echo 'DELETE FROM schema_migrations; DROP TABLE sessions; DROP TABLE weight_for_heights;' | mysql -u {username} tablename
RAILS_ENV=production rake db:migrate
RAILS_ENV=production rake openmrs:bootstrap:load:defaults
RAILS_ENV=production script/runner 'PatientAdherenceDate.reset;PatientPrescriptionTotal.reset;PatientWholeTabletsRemainingAndBrought.reset;PatientHistoricalOutcome.reset'
#!/usr/bin/ruby
require 'fastercsv'
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
def prescribe_drug(patient, drug, dose, frequency, encounter, date = nil)
encounter ||= patient.encounters.create(:encounter_datetime => date, :encounter_type => EncounterType.find_by_type("ART Visit").encounter_type_id)
encounter.observations.create(:value_drug => drug.drug_id, :value_text => frequency, :value_numeric => dose, :concept_id => Concept.find_by_name("Prescribed Dose").concept_id, :obs_datetime => encounter.encounter_datetime)
encounter
end
<html>
<body>
<style>
.image {
position:relative;
}
.image .text {
position:absolute;
top:10px; /* in conjunction with left property, decides the text position */
left:10px;