Skip to content

Instantly share code, notes, and snippets.

View ajmazurie's full-sized avatar

Aurélien Mazurie ajmazurie

  • Bozeman, MT
View GitHub Profile
@taylordelehanty
taylordelehanty / postgres_v5_drug_era_nonstockpile.sql
Created July 13, 2015 15:36
PostgreSQL v5 CDM drug_era builder that uses the non-stockpile method to populate
/* THIS CODE IS NOT FULLY TESTED YET. It still needs to be verified, but it uses the same
* algorithm found in Chris_Knoll's script: https://gist.github.com/chrisknoll/c820cc12d833db2e3d1e
*/
---TRUNCATE omop.v5drug_era;
WITH
ctePreDrugTarget(drug_exposure_id, person_id, ingredient_concept_id, drug_exposure_start_date, days_supply, drug_exposure_end_date) AS
(-- Normalize DRUG_EXPOSURE_END_DATE to either the existing drug exposure end date, or add days supply, or add 1 day to the start date
SELECT
@taylordelehanty
taylordelehanty / postgres_v5_drug_era_stockpile.sql
Last active December 5, 2017 17:21
PostgreSQL v5 CDM drug_era builder that uses stockpile method for gap_days
--------------------------------------------------------------------------------------------------------------
---Adapted to PostgreSQL drug_era from Pure SQL drug_era written by Chris_Knoll: https://gist.github.com/chrisknoll/c820cc12d833db2e3d1e
---Upgraded to v5
---Uses STOCKPILE method to populate gap_days field
---INTERVAL set to 30 days
---Chris Knoll's comments are after two dashes
---Taylor Delehanty's comments are after three dashes
---proper schema for "<schema>" needs to be replaced in the code
---proper schema for "<vocabulary_and_concept_schema>" needs to be replaced in the code
@akiatoji
akiatoji / Clojure_on_RaspberryPi_OSX.md
Last active December 3, 2022 21:15
Running Clojure on Raspberry Pi with OS X

Clojure on Raspberry Pi with OS X

"Clojure running on Raspberry Pi" sounded so cool that I just had to give it a try.

Install JDK

  • Download ARM JDK from Oracle and instlal on Raspberry Pi
  • Change visudo to contain the following
@jjongsma
jjongsma / packer-config
Last active December 18, 2023 15:15
Process YAML and write Packer JSON to STDOUT
#!/usr/bin/python
#
# Usage: packer-config my-template.yaml | packer build -
#
# Constructs a Packer JSON configuration file from the specified YAML
# template file and writes it to STDOUT.
#
# The YAML template format adds some flexibility and readability by
# adding comments and an !include directive, allowing for the
# following template syntax:
@gorbiz
gorbiz / trello-card-title-markdown.user.js
Last active September 12, 2023 05:50
Add support for bold and emphasized Markdown in Trello card titles using a User Script.
// ==UserScript==
// @name Trello card title Markdown
// @version 0.4.0
// @homepage https://gist.github.com/gorbiz/6062481
// @description Add support for bold and emphasized Markdown in card titles
// @match https://trello.com/b/*
// @match http://trello.com/b/*
// ==/UserScript==
function markdownAll() {
@nicerobot
nicerobot / canonical.sh
Created May 14, 2012 02:53
Canonicalize a file's path i.e. a cross platform readlink
#!/bin/sh
# eg. dir=$(canonical $0)
canonical() {
local d="$(\dirname ${1})"
local f="$(\basename ${1})"
(
\cd ${d} >/dev/null 2>&1
while [ -h "${f}" ] ; do
\cd $(\dirname $(\readlink ${f})) >/dev/null 2>&1
@RedBeard0531
RedBeard0531 / functions.js
Created February 22, 2012 20:13
Min, Max, Sum, Count, Avg, and Std deviation using MongoDB MapReduce
// derived from http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Parallel_algorithm
function map() {
emit(1, // Or put a GROUP BY key here
{sum: this.value, // the field you want stats for
min: this.value,
max: this.value,
count:1,
diff: 0, // M2,n: sum((val-mean)^2)
});