Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

yc skylander86

🎯
Focusing
Block or report user

Report or block skylander86

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@skylander86
skylander86 / fleiss kappa.py
Created Apr 7, 2016
Compute Fleiss' kappa using numpy.
View fleiss kappa.py
def fleiss_kappa(M):
"""
See `Fleiss' Kappa <https://en.wikipedia.org/wiki/Fleiss%27_kappa>`_.
:param M: a matrix of shape (:attr:`N`, :attr:`k`) where `N` is the number of subjects and `k` is the number of categories into which assignments are made. `M[i, j]` represent the number of raters who assigned the `i`th subject to the `j`th category.
:type M: numpy matrix
"""
N, k = M.shape # N is # of items, k is # of categories
n_annotators = float(np.sum(M[0, :])) # # of annotators
@skylander86
skylander86 / GitCryptCheatsheet.md
Last active Mar 5, 2019
Cheatsheet for using git-crypt
View GitCryptCheatsheet.md

Notes on using git-crypt

This file has been moved to Gitlab.

@skylander86
skylander86 / date_regexes.py
Created Dec 25, 2018
Regular expressions for capturing dates
View date_regexes.py
DATE_REGEXES = [
re.compile(r'\b(?P<year>199\d|200\d|201\d)[\-\u2010\u2014\u2013\.\_\/\s]{1,2}(?P<month>1|2|3|4|5|6|7|8|9|01|02|03|04|05|06|07|08|09|10|11|12)[\-\u2010\u2014\u2013\.\_\/\s]{1,2}(?P<day>1|2|3|4|5|6|7|8|9|01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)\b'), # 2017-09-28
re.compile(r'\b(?P<day>1|2|3|4|5|6|7|8|9|01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)[\-\u2010\u2014\u2013\.\_\/\s]{1,2}(?P<month>1|2|3|4|5|6|7|8|9|01|02|03|04|05|06|07|08|09|10|11|12)[\-\u2010\u2014\u2013\.\_\/\s]{1,2}(?P<year>199\d|200\d|201\d)\b'), # 28-9-2017
re.compile(r'\b(?P<month>1|2|3|4|5|6|7|8|9|01|02|03|04|05|06|07|08|09|10|11|12)[\-\u2010\u2014\u2013\.\_\/\s]{1,2}(?P<day>1|2|3|4|5|6|7|8|9|01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)[\-\u2010\u2014\u2013\.\_\/\s]{1,2}(?P<year>199\d|200\d|201\d)\b'), # 9-28-2017
re.compile(r'\b(?P<year>199\d|200\d|201\d)[\-\u2
@skylander86
skylander86 / lambda-ses-forwarder.py
Created Jan 4, 2017
Python port of arithmetric/aws-lambda-ses-forwarder. An AWS Lambda function for forwarding incoming emails through SES.
View lambda-ses-forwarder.py
"""
This code is a Python 2.7 port of [aws-lambda-ses-forwarder](https://github.com/arithmetric/aws-lambda-ses-forwarder). Follow instructions there for setting up SES and AWS Lambda.
"""
from email import message_from_file
import json
import logging
import os
import re
View keybase.md

Keybase proof

I hereby claim:

  • I am skylander86 on github.
  • I am skylander (https://keybase.io/skylander) on keybase.
  • I have a public key ASAIqjDt-DzF3IxVW0ni54X5YLuCoK9o6VQ2RyqQjs7-ywo

To claim this, I am signing this object:

@skylander86
skylander86 / cclr_calculator.js
Created Oct 17, 2017
Creatinine Clearance Calculator Javascript Logic
View cclr_calculator.js
// set up our units of conversions, could be shared between multiple calculators
var units = {
"age": {"yr": 1, "mth": 12.0},
"weight": {"kg": 1, "lb": 2.20462},
"creatinine": {"gm/L": 0.01, "gm/dL": 0.001, "mg%": 1, "mg/dL": 1, "mg/mL": 0.01},
"output": {"mL/min": 1, "L/hr": 0.06}
};
// get the inputs specific to this calculator (irl, this would come from the form fields)
var inputs = {
@skylander86
skylander86 / certbot-route53.py
Created Mar 29, 2017
Get SSL certificates using Certbot and complete challenge automatically using Route 53. A pure Python solution.
View certbot-route53.py
#!/usr/bin/env python
from argparse import ArgumentParser
import logging
import os
import sys
import subprocess
import time
import boto3
@skylander86
skylander86 / FileSystemUtils.scala
Last active Oct 28, 2016
Scala module for I/O on different filesystems
View FileSystemUtils.scala
package nlp.salience.fsutils
/**
* @author yc <https://github.com/skylander86/>
* @version 0.1
*
* This package contains code for transparently reading and writing files to/from supported filesystems.
* This is useful as a drop in replacement that understands filesystem differences.
* Right now, it only supports local file, S3 (either using Hadoop or Amazon AWS SDK) and Hadoop filesystem.
*
* Example usage:
@skylander86
skylander86 / freebase_instances.C
Created Mar 25, 2016
Efficient C code for extracting instances from freebase GZip dump
View freebase_instances.C
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define FALSE 0
#define TRUE 1
#define BUFSIZE 1024
int main(void) {
setvbuf(stdin, (char *) NULL, _IOFBF, 0); /* better performance if we buffer stdin */
@skylander86
skylander86 / bootstrap.html
Last active Mar 23, 2016
Basic quick start bootstrap template
View bootstrap.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>Starter Template for Bootstrap</title>
You can’t perform that action at this time.