Skip to content

Instantly share code, notes, and snippets.

View citizenrich's full-sized avatar

Richard Stanley citizenrich

View GitHub Profile
cd "~/Dropbox/Datasets/DHSbr/archives/"
fsx *.ZIP *.zip
foreach file in `r(files)' {
capture unzipfile `file', replace
fsx *.DTA *.dta
local data `r(files)'
use `data', clear
describe, short
//Clean up the files that were unzipped.
//The shell command should be changed for the operating system, this is Mac/UNIX/Linux.
cd "~/Dropbox/Data/temp/"
sysuse auto, clear
save "~/Dropbox/Data/temp/auto1.dta", replace
sysuse auto, clear
save "~/Dropbox/Data/temp/auto2.dta", replace
foreach file in auto1.dta auto2.dta {
rsource using summary.R, roptions(--vanilla --slave --args `file')
}
args<-commandArgs(TRUE)
setwd("~/Dropbox/Data/temp/")
library(readstata13)
dat <- read.dta13(paste(args,sep = ""))
summary(dat)
save.dta13(dat, file=paste(args, "results.dta",sep = "_"))
from fabric.api import *
#works on centos 6.7 64-bit digitalocean.com droplet
env.hosts = ['XXX.XXX.XXX.XXX']
env.user = 'root'
home = '/opt/kazoo_install'
repo = '/opt/kazoo_install/community-scripts/simple-installer'
def iptables():
run('iptables -F')
run('iptables -X')
@citizenrich
citizenrich / # elasticsearch - 2016-12-02_12-56-58.txt
Created December 2, 2016 18:08
elasticsearch on macOS 10.12.1 - Homebrew build logs
Homebrew build logs for elasticsearch on macOS 10.12.1
Build date: 2016-12-02 12:56:58
#!/usr/bin/env python3
import requests
from datetime import datetime, timedelta
import json
base = 'https://share.osf.io/api/v2/search/creativeworks/_search'
keywords = 'neural networks'
# simple query
simp_query = {"query": {"query_string": {"query": keywords}}}
@citizenrich
citizenrich / census.py
Created April 24, 2017 20:11
So far on census API
#!/usr/bin/env python3
import os
import requests
from bs4 import BeautifulSoup
import pandas as pd
from itertools import zip_longest
census_key = os.environ.get("CENSUS_KEY")
# base = 'http://api.census.gov/data/2011/acs5'

Install Docker for Mac or Linux (or Windows). If Linux, then install docker-compose as well (it's automatically installed with Mac and Windows)

Next, create the testing folder.

mkdir openinfoman-test
cd openinfoman-test/
git clone https://github.com/openhie/openinfoman
@citizenrich
citizenrich / openinfoman-tutorial.md
Created August 14, 2017 12:45
openinfoman tutorial for 'hello, world'

"Hello, world" for openinfoman

openinfoman uses basex. basex is Java-based XML database, XQuery engine, and RestXQ web application framework. Installing openinfoman also installs basex.

Using a fresh Ubuntu 14.x install the openhie repository and then openinfoman. Accept the default options for openinfoman (heap size: default, url: leave blank, database: provider_directory).

@citizenrich
citizenrich / openinfoman-manual.md
Last active August 30, 2017 18:26
Manual Installation on Linux and Mac (draft)

Manual Installation on Linux and Mac

This is a manual installation that follows as closely as possible the packaging in Debian except that it can run under any user and does not require superuser privileges. Requirements are a JRE, PHP, Git, wget, unzip.

# for example, on a fresh Ubuntu Linux
sudo apt-get install git wget unzip default-jre openjdk-7-jre php5

This is written for Bash, particularly the array declarations. So, modify if you need to use another shell.