Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View Protonk's full-sized avatar
🗯️
Before the hinge

Adam Hyland Protonk

🗯️
Before the hinge
View GitHub Profile
@Protonk
Protonk / allergen.R
Last active November 16, 2023 17:57
Allergy example
food.allergy.analysis.Zenodo <- read.csv("~/Downloads/food-allergy-analysis-Zenodo.csv")
allergyDF <- food.allergy.analysis.Zenodo[, c("SUBJECT_ID", "BIRTH_YEAR", "GENDER_FACTOR", "RACE_FACTOR", "ETHNICITY_FACTOR", "PAYER_FACTOR", "AGE_START_YEARS", "AGE_END_YEARS")]
allergyDF[, "SPAN_IN_YEARS"] <- with(food.allergy.analysis.Zenodo, AGE_END_YEARS - AGE_START_YEARS)
allergyDF[, "SOY_SPAN"] <- with(food.allergy.analysis.Zenodo, SOY_ALG_END - SOY_ALG_START)
allergyDF[, "MILK_SPAN"] <- with(food.allergy.analysis.Zenodo, MILK_ALG_END - MILK_ALG_START)
allergyDF[, "FISH_SPAN"] <- with(food.allergy.analysis.Zenodo, FISH_ALG_END - FISH_ALG_START)
allergyDF[, "SHELLFISH_SPAN"] <- with(food.allergy.analysis.Zenodo, SHELLFISH_ALG_END - SHELLFISH_ALG_START)
https://youtu.be/-C-JoyNuQJs?t=39m45s
When I put the reference implementation onto the website I needed to
put a software license on it.
And I looked at all the licenses that were available, and there were a lot
of them. And I decided that the one I liked the best was the MIT License,
which was a notice that you would put on your source and it would say,
"you're allowed to use this for any purpose you want, just leave the
notice in the source and don't sue me."
@Protonk
Protonk / softsqrt.c
Last active February 11, 2023 19:12
Illustrate the core path of Kahan and Ng's SoftSqrt
/* Kahan and Ng's SoftSqrt
See http://www.netlib.org/fdlibm/e_sqrt.c
or https://adampunk.com/documents/softsqrt.pdf (for the original)
specifically section B. 1 of the comment block labeled "other methods"
Method for operating in a logarithmic domain described in
section 2.3 "A Poor Man's Logarithm" of
J. T. COONEN, "CONTRIBUTIONS TO A PROPOSED STANDARD FOR BINARY
FLOATING-POINT ARITHMETIC (COMPUTER ARITHMETIC). PhD Thesis,
University of California Berkeley, 1984.

Evaluate an article

Handout: Evaluating Wikipedia

  • Review pages 4-7 of the Evaluating Wikipedia brochure. This will give you a good, brief overview of what to look for in other articles, and what other people will look for in your own.
  • Evaluate an existing Wikipedia article related to the class, and leave suggestions for improving it on the article's talk page.
    • A few questions to consider (don't feel limited to these):
      • Is each fact referenced with an appropriate, reliable reference?
      • Is everything in the article relevant to the article topic? Is there anything that distracted you?
      • Is the article neutral? Are there any claims, or frames, that appear heavily biased toward a particular position?
      • Where does the information come from? Are these neutral sources? If biased, is that bias noted?
  • Are there viewpoints that are overrepresented, or underrepresented?

"He was a seaman, but he was a wanderer, too, while most seamen lead, if one may so express it, a sedentary life. Their minds are of the stay-at-home order, and their home is always with them—the ship; and so is their country—the sea. One ship is very much like another, and the sea is always the same. In the immutability of their surroundings the foreign shores, the foreign faces, the changing immensity of life, glide past, veiled not by a sense of mystery but by a slightly disdainful ignorance; for there is nothing mysterious to a seaman unless it be the sea itself, which is the mistress of his existence and as inscrutable as Destiny. For the rest, after his hours of work, a casual stroll or a casual spree on shore suffices to unfold for him the secret of a whole continent, and generally he finds the secret not worth knowing. The yarns of seamen have a direct simplicity, the whole meaning of which lies within the shell of a cracked nut."

Heart of Darkness, Joseph Conrad.

@Protonk
Protonk / structure.md
Last active August 29, 2015 14:09
draft ideas

Feminism

Establishing feminist critique as pushing against cultural resentment

"Prominent feminist critique — present in every other relevant medium, but new to games — has elicited massive backlash and threats to women working in the field."

By hylang core devs:
Defining Function Arguments in Hy
http://agentultra.com/2013/04/22/defining-function-arguments-in-hy/
Hy a Lisp on Python
http://agentultra.com/2013/04/19/hy-a-lisp-on-python/
Programming Can Be Fun with Hy
http://www.opensourceforu.com/2014/02/programming-can-fun-hy/
d3.quantile = function(values, p) {
  var H = (values.length - 1) * p + 1,
      h = Math.floor(H),
      v = +values[h - 1],
      e = H - h;
  return e ? v + e * (values[h] - v) : v;
};
@Protonk
Protonk / xorshift.js
Created January 2, 2014 16:59
The below is released under the GPL http://www.gnu.org/licenses/gpl.html
//Webkit2's crazy invertible mapping generator
// Theory is here: http://dl.acm.org/citation.cfm?id=752741
var xorshift = (function(seed) {
// We can't reach the maximal period inside JS because numbers above
// 2^53 aren't 'safe'
seed = seed || Math.round(Math.random() * Math.pow(2, 32));
return {
rand : function() {
// creates randomness...somehow...
@Protonk
Protonk / gbm.R
Last active December 31, 2015 22:49
library(jpeg)
library(plyr)
# Read in Girl before a Mirror from somewhere
# readJPEG only accepts a path, so give it one without much tomfoolery
picasso.path <- tempfile('girl_before_a_mirror.jpg')
download.file('http://bobholt.me/images/girl_before_a_mirror.jpg', picasso.path)
gbm <- readJPEG(picasso.path)