Skip to content

Instantly share code, notes, and snippets.

View jeffrafter's full-sized avatar
You are amazing

Jeff Rafter (he/him) jeffrafter

You are amazing
View GitHub Profile
@jeffrafter
jeffrafter / sql_views
Created July 25, 2008 08:13
Trying to understand how to use mysql query profiling to win
SELECT count(*)
FROM drug_order
INNER JOIN drug ON drug_order.drug_inventory_id = drug.drug_id
INNER JOIN concept_set as arv_drug_concepts ON
arv_drug_concepts.concept_set = 460 AND
arv_drug_concepts.concept_id = drug.concept_id
WHERE drug.concept_id IS NOT NULL;
=>
+----------+
| count(*) |
I want to JOIN only the last item
table_1
------------
id | Name |
============
1 Bob |
============
table_2
DROP TABLE IF EXISTS patient_prescription_totals;
CREATE TABLE patient_prescription_totals (
`id` int(11) NOT NULL auto_increment,
`patient_id` int(11) NOT NULL,
`drug_id` int(11) NOT NULL,
`prescription_date` DATE NOT NULL,
`daily_consumption` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `patient_id_drug_id_presciption_date` (`patient_id`, `drug_id`, `prescription_date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
<html>
<head>
<title>This is a test</title>
</head>
<body onload="doit()">
<h1>You are my favorite person, okay?</h1>
<script type="text/javascript">
function window_click(x, y) {
try {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
class AddPrescriptions < ActiveRecord::Migration
def self.up
# Good chance this should be in the fixtures
ActiveRecord::Base.connection.execute <<EOF
DROP TABLE IF EXISTS prescription_time_periods;
EOF
ActiveRecord::Base.connection.execute <<EOF
CREATE TABLE prescription_time_periods (
`id` int(11) NOT NULL auto_increment,
njero@alexandria:/var/www/bart$ rake db:migrate:reset RAILS_ENV=test
(in /private/var/www/bart)
== 20080711115602 CreateSessions: migrating ===================================
-- create_table(:sessions)
-> 0.0022s
-- add_index(:sessions, :session_id)
-> 0.0087s
-- add_index(:sessions, :updated_at)
-> 0.0048s
== 20080711115602 CreateSessions: migrated (0.0171s) ==========================
#!/usr/bin/env ruby
require File.expand_path(File.dirname(__FILE__)) + '/../lib/patatat'
PATATAT_ROOT = File.expand_path(File.dirname(__FILE__)) + "/.."
# Only execute this code if it was launched from the command line
if __FILE__ == $0
pid = fork do
Signal.trap('HUP', 'IGNORE') # Don't die upon logout - this doesn't seem to work I use monit instead
puts "Starting Daemon"

How I got Zephyr to work on Sapele and the Touchscreen

on your local, download the zephyr zip

unzip < zephyr zip > rsync --progress --partial --recursive zephyr deploy@sapele:/tmp ssh deploy@sapele

on sapele

cd /tmp sudo mv zephyr /var/www

# QUESTION: Should double letters at the beginning of the word be removed? For example: LLAMA. Is there a Chichewa example of this?
# QUESTION: Should prefixes be dropped, for example "wa" in Bingu wa Mutharinka, "ma" in Maganga
# This soundex algorithm uses the modified soundex from http://www.creativyst.com/Doc/Articles/SoundEx1/SoundEx1.htm
# We also modified it further to support common chichewa word beginnings and match 'L' and 'R'
class String
def soundex
# Grab a temporary copy of the word
word = "#{self}"
# Handle blanks
return nil if word.blank?
@jeffrafter
jeffrafter / SERVER_INSTALLS
Created September 13, 2008 13:18
Installing and Setting up a Baobab Server
## Install
## See also (http://codeplot.com/documents/3186/edit)
I Installed Ubuntu 8.04 Server
US Keyboard Layout
Zimbabwe region
If this machine was using an SSD drive configure the paritions so that it has no swap
I did a single partition marked as bootable and setup for the root on EXT3+Journaling
I marked the OpenSSH server as an additional option
I did not set it as a DNS server or Mail Server