This file contains hidden or 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
from blinkstick import blinkstick | |
from matplotlib import cm, colors | |
from time import sleep | |
cmap = cm.get_cmap('coolwarm') | |
def getColor(n): | |
colr = cmap(n)[0:3] | |
outp = [x * .15 for x in colr] | |
adj = [x * .25 if x == max(colr) else x*.15 for x in colr] |
This file contains hidden or 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
// ==UserScript== | |
// @name Ocrify | |
// @namespace http://library.brown.edu/ | |
// @version 0.1 | |
// @description Try to reserve an item on Josiah. | |
// @author Adam Bradley <[email protected]> | |
// @match https://search.library.brown.edu/catalog/* | |
// @grant none | |
// ==/UserScript== |
This file contains hidden or 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
<?php | |
/** | |
* Functions for treating (blacklight-based) Josiah as an API. | |
*/ | |
namespace ocra\josiah; | |
/** | |
* Find a field (and optionally subfield) in the JSONified MaRCXML record. | |
* |
This file contains hidden or 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
USER_TOKEN = 'pinboard:ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890' | |
import re | |
import requests | |
import sys | |
import time | |
links = requests.get('https://api.pinboard.in/v1/posts/all?auth_token='+USER_TOKEN+'&format=json')#&count=100') | |
if links.status_code != 200: |
This file contains hidden or 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
library(readxl) | |
sheet_list <- lapply(excel_sheets('workbook.xlsx'), read_excel, path='workbook.xlsx') |
This file contains hidden or 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
smode <- function(x) { | |
which(tabulate(x)==max(tabulate(x))) | |
} |
This file contains hidden or 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
c = StateChoropleth$new(df_state_demographics) | |
c$title = "Population by State, Percent Black" | |
c$set_num_colors(7) | |
c$show_labels = F | |
df_state_labels = data.frame(long = state.center$x, lat = | |
state.center$y, name=tolower(state.name), label = state.abb) | |
df_state_labels = df_state_labels[!df_state_labels$name %in% c("alaska", | |
"hawaii"), ] |
This file contains hidden or 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
lp <- function(givenName, givenQuantity, resources, needsChart) { | |
if ( !all.equal(names(resources), colnames(needsChart)[2:length(colnames(needsChart))]) ) { | |
warning("constraints and needsChart don't match.") | |
return(NA) | |
} else if ( dim(needsChart)[1] != 2 ) { | |
warning("Can only handle two products.") | |
return(NA) | |
} | |
sapply(givenQuantity, function(x) { |
This file contains hidden or 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
//NOTE: Depends on paper.js. | |
if ('undefined' == typeof unset) function isset(x) { return !('undefined' == typeof x) } | |
if ( !isset(ifunset) ) function ifunset(x, def) { return ('undefined' == typeof x) ? def : x; } | |
//These are defaults; config variables can be set before loading this script. | |
var LOGGING = ifunset(LOGGING, false); | |
var CANVAS_SELECTOR = ifunset(CANVAS_SELECTOR, 'canvas.sparkler'); | |
var XMARGIN = ifunset(XMARGIN, 2); | |
var YMARGIN = ifunset(YMARGIN, 2); |
This file contains hidden or 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
#! /usr/bin/python | |
import feedparser | |
import yaml | |
import pinboard | |
from time import mktime | |
import os | |
class RssToPinboard(object): | |
def __init__(self, settings): |