Skip to content

Instantly share code, notes, and snippets.

Russell Jurney rjurney

Block or report user

Report or block rjurney

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
@rjurney
rjurney / forms.js
Created Feb 27, 2020
How to make a Google Form from a Google Sheet using Google Apps Script that nobody will be able to load to label Amazon open source projects because Forms doesn't scale to 50 questions...
View forms.js
//
// Google Apps Script that reads a Google Sheet based on the Github data and creates a form to classify projects
//
function createForm() {
// Create a new form, then add a checkbox question, a multiple choice question,
// a page break, then a date question and a grid of questions.
var form = FormApp.create('Amazon Open Source Project Classification');
form.setDescription("This form is for labeling open source projects using the project url and description with the following 4 categories:\n\n1) \
API - this is an API library that can only be used to access an Amazon Web Services (AWS) API\n2) EDUCATION - this is an educational project or example \
@rjurney
rjurney / show_error_labels.py
Last active Feb 21, 2020
Code to show the true/predicted labels for gold labeled data in a Snorkel LabelModel
View show_error_labels.py
from snorkel.analysis import get_label_buckets
# Trim the fields for figuring out problems
df_viz = df_test[['full_name', 'description', 'label']]
# Display all errors for debugging purposes
pd.set_option('display.max_rows', len(df_viz.index))
@rjurney
rjurney / snorkel.py
Last active Feb 13, 2020
Utilities for making Snorkel display all LabelFunction errors
View snorkel.py
from snorkel.analysis import get_label_buckets
ABSTAIN = -1
GENERAL = 0
API = 1
EDUCATION = 2
DATASET = 3
names = ['GENERAL', 'API', 'EDUCATION', 'DATASET']
@rjurney
rjurney / README.md
Last active Feb 13, 2020
Pot is physically addictive and kills young adults by causing arrhythmia and strokes
View README.md

Pot is not harmless. It is physically addictive and causes strokes in young people more than any other risk factor including smoking cigarettes.

  • Pot is physically addictive. This isn’t reefer madness and has been known for 20 years. Cannabinoid withdrawal work just like any other drug withdrawal: cannabinoid receptors down regulate when heavily and repeatedly activated and then you feel like shit when they are under stimulated. Every adult reading this has seen someone in withdrawal freaking out back when pot was illegal. This is why.
  • Pot is a depressant until you exceed a certain dose, then it causes severe anxiety, racing heart, etc. Every adult reading this has watched this happen to someone.

For 18-49 year olds, according to the American Heart Association:

  • Smoking cigarettes and pot raises your stroke risk 300%
  • Smoking pot 10 or more times a month without smoking cigarettes raises your stroke risk 250%
View keybase.md

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@rjurney
rjurney / remove_all_security_groups_boto3.py
Created Jan 7, 2020
A script that removes all non-default security group rules and groups in a single REGION using boto3
View remove_all_security_groups_boto3.py
import boto3
from botocore.exceptions import ClientError
REGION = 'us-east-1'
ec2 = boto3.client('ec2', region_name=REGION)
# Keep removing until all are gone
while True:
groups = ec2.describe_security_groups()['SecurityGroups']
@rjurney
rjurney / github.sh
Created Dec 19, 2019
How to fetch the README of any Github repository in one line of bash
View github.sh
curl "https://api.github.com/repos/<user>/<repo>/readme" | jq -r .content | base64 -D
@rjurney
rjurney / pre.py
Last active Dec 4, 2019
How do you chain a preprocessor for an LF to occur AFTER SpacyPreprocessor?
View pre.py
spacy = SpacyPreprocessor(
text_field='body',
doc_field='spacy',
memoize=True,
language='en_core_web_lg',
disable=['vectors']
)
@preprocessor(memoize=True, pre=[spacy])
def restore_entity(x):
@rjurney
rjurney / matcher_lf.py
Created Dec 2, 2019
Example of spaCy object Labeling Function
View matcher_lf.py
from spacy.matcher import Matcher
matcher = Matcher(nlp.vocab)
pattern = [{'POS': 'VERB'}, {'POS': 'ADP'}, {'POS': 'PROPN'}]
matcher.add("VERB_ADP_PROPN", None, pattern)
@labeling_function()
def lf_verb_in_noun(x):
"""Return positive if the pattern"""
sp = x['spacy']
matches = matcher(sp)
View candidates.py
window = 5
candidates = []
for index, row in df.iterrows():
doc = nlp(row['_Body'])
for ent in doc.ents:
rec = {}
rec['body'] = doc.text
rec['entity'] = ent
rec['entity_text'] = ent.text
rec['entity_start'] = ent.start
You can’t perform that action at this time.