Skip to content

Instantly share code, notes, and snippets.

let blacklists = ["*://example.com/stuff/*", "*://mail.google.com/*", "http://localhost:*/notebooks/*"]
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
class MixinOne(object):
def print_name(self):
print("{} is using MixinOne.".format(self.name))
class MixinTwo(object):
def print_name(self):
print("{} is using MixinTwo.".format(self.name))
@docsteveharris
docsteveharris / Antibiotic spec.yaml
Created June 30, 2017 10:17
CCHIC antibiotic classification including detail on ranking
# Specify antibiotic characteristics
# Sepsis3 valid
# dosing interval (period) - assume less than 24 hourly unless otherwise specified
# rank as per Braykov NP, Morgan DJ, Schweizer ML, Uslan DZ, Kelesidis T, Weisenberg SA, et al. Assessment of empirical antibiotic therapy optimisation in six hospitals: an observational cohort study. Lancet Infect Dis. 2014;14: 1220–1227. doi:10.1016/S1473-3099(14)70952-1
NIHR_HIC_ICU_0414:
Classification3: Aminoglycosides
dataItem: Amikacin
sepsis3_abx: TRUE
rank_abx: 4
period_abx: ~
@docsteveharris
docsteveharris / cchic-common1d.R
Created June 16, 2017 15:45
generic 1d variable definitions for cchic (depends on ccfun library)
# ==================================
# = Define generic study variables =
# ==================================
find_NHIC("shortName", "dead")
# Mortality
gen_mortality(wdt, "mort.icu", "NIHR_HIC_ICU_0097")
table(unique(wdt[,.(id,mort.icu)])$mort.icu)
gen_mortality(wdt, "mort.hosp", "NIHR_HIC_ICU_0095")
@docsteveharris
docsteveharris / ANALYSIS_REF.yaml
Created June 16, 2017 15:39
example field spec with options for some of the classification levels
# # apply response after field specification allows two possibilities
# # apply: drop_entry - just replace field with NA
# # apply: drop_episode - drop entire episode
# # range checks for continuous data *must* use traffic light terms
# # - red
# # - amber
# # - green
# # also concept of nodata check which will drop episode if data is missing
# # e.g. for something crucial like date of birth (age)
# # nodata:
@docsteveharris
docsteveharris / icnarc score.R
Created June 15, 2017 13:04
skeleton for working out ICNARC acute physiology score
-
fname: icnarc_score
sqltype: tinyint
varlab: ICNARC acute physiology score
derived: True
derived_missing_ok: True
primaryfields:
- hrate
- bpsys
- temperature
@docsteveharris
docsteveharris / gist:64c2a87a414190d97d41ea613781f4c6
Last active April 30, 2017 10:29 — forked from saetia/gist:1623487
mac os set-up and install

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat
@docsteveharris
docsteveharris / cochrane_citation_parser.py
Created April 25, 2017 07:50
Parse Cochrane library citations export to tabular format
# coding: utf-8
# Load up the citation text file as per this link
#
# http://onlinelibrary.wiley.com/cochranelibrary/search/advanced?hiddenFields.strategySortBy=last-modified-date;desc&hiddenFields.showStrategies=true&hiddenFields.containerId=12670271652807976185&hiddenFields.originalContainerId=15960432450033216107&hiddenFields.etag=8064622093550521747
#
# And saved here as `citation-export.txt`
# Test example
testData = """
# Check all have same length
list.of.lists.2df <- function(l) {
'
Convert a list of lists to a data.frame
via http://stackoverflow.com/a/4227504/992999
'
# Check that all nested lists are of the same lenght
library(assertthat)
assert_that(sum(sapply(l, function(x) length(x)!=length(l[[1]])))==0)
d <- data.frame(t(sapply(l, c)))