Lecture 1: Introduction to Research — [📝Lecture Notebooks] [
Lecture 2: Introduction to Python — [📝Lecture Notebooks] [
Lecture 3: Introduction to NumPy — [📝Lecture Notebooks] [
Lecture 4: Introduction to pandas — [📝Lecture Notebooks] [
Lecture 5: Plotting Data — [📝Lecture Notebooks] [[
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
import requests | |
import psutil | |
def get_notebooks(host, port, token = None): | |
sessions_url = f'http://{host}:{port}/api/sessions/?token={token}' if token else f'http://{host}:{port}/api/sessions' | |
response = requests.get(sessions_url).json() | |
notebooks = [{'kernel_id': notebook['kernel']['id'], | |
'path': notebook['notebook']['path']} for notebook in response] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function concat_with_header() { | |
# Quoted suffix to pattern match for concatenation (e.g. '*.csv') | |
local suffix="${1}" | |
# Name of the output file | |
local output="${2:-combined.out}" | |
# Number of lines to use for the header | |
local header_length="${3:-1}" | |
# Grab the header from the first file | |
local header=`echo -e "$(ls -b *$suffix | head -n$header_length)"` | |
head -1 $header_file > $output; tail -n +"`expr $header_length + 1`" -q *$suffix >> $output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package greenlight.etc | |
import java.security.SecureRandom | |
import kotlin.math.abs | |
val BASE58_ALPHABET = "23456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" | |
fun randomBase58(length: Int): String { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=AutoSSH tunnel service | |
After=network-online.target sshd.service | |
[Service] | |
Environment="AUTOSSH_GATETIME=0" | |
Environment="AUTOSSH_PORT=0" | |
ExecStart=/usr/bin/autossh -o "ServerAliveInterval 10" -o "ServerAliveCountMax 3" -N -R 2222:localhost:22 -R 8888:localhost:8888 [email protected] | |
[Install] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def shrink_df(df, categorize=False, verbose=False): | |
"""Reduces the memory use of a data frame by using more compact types. | |
Args: | |
df (pandas.DataFrame): The dataframe | |
categorize (bool): Whether strings should be converted to categorical values. | |
Note this may cause memory use to increase slightly. | |
verbose (bool): Whether to print memory savings to stdout. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# icd10_map_charlson from https://github.com/jackwasey/icd/blob/master/data/icd10_map_charlson.RData | |
df = data.frame("comorbidity" = character(0), "icd10" = character(0), "score" = numeric(0), stringsAsFactors = FALSE) | |
scores = data.frame( | |
MI = 1, | |
CHF = 1, | |
PVD = 1, | |
Stroke = 1, | |
Dementia = 1, |
I hereby claim:
- I am fny on github.
- I am fny (https://keybase.io/fny) on keybase.
- I have a public key whose fingerprint is 477B 6E2F 415F 02BC AA6C 44E0 1E9C CF9B 131E 417C
To claim this, I am signing this object:
NewerOlder