Skip to content

Instantly share code, notes, and snippets.

View birkin's full-sized avatar

Birkin James Diana birkin

View GitHub Profile
@birkin
birkin / timeit_lru_cache.py
Created December 19, 2019 21:28
timing an lru_cache decorator.
"""
Run from 'stuff' directory
"""
import timeit
code_setup = '''
import random
from mp_vl_project.mp_vl_app.lib import views_api_entries_helper
'''
{
"fields": [
{
"001": "ocm43034574"
},
{
"003": "OCoLC"
},
{
"005": "20050204165557.0"
{
"response": {
"document": {
"author_addl_display": [
"Takahashi, Yōji.",
"高橋洋二"
],
"author_addl_t": [
"Takahashi, Yōji.",
"高橋洋二"
@birkin
birkin / sierra_check_digit.py
Last active September 6, 2019 20:17
sierra check-digit logic
'''
Usage: $ python3 /path/to/sierra_check_digit.py 15990359
or: $ python3 /path/to/sierra_check_digit.py 15990359 DEBUG
'''
import logging, sys
log = logging.getLogger(__name__)
def build_check_digit( raw_item_id ):
@birkin
birkin / selenium_review_scrape.py
Created July 11, 2019 14:25
scraping reviews via python-selenium
"""
https://selenium-python.readthedocs.io
"""
import logging, pprint, sys
from bs4 import BeautifulSoup
from selenium.webdriver import Firefox
from selenium.webdriver.firefox.options import Options

notes re nypl 2019-June-05 meeting...

@birkin
birkin / 2018-stuff.md
Last active April 13, 2019 20:05
no wonder i'm a little tired!

stuff i did

(april-2018 through march-2019)

code...

  • easyAccess -> hosted-ILLiad migration
  • implemented completely different process for checking-user, creating-new-user, submitting book and article-requests
@birkin
birkin / temp.js
Last active March 11, 2019 21:09
function calcNewDate() {
// helpful: <https://www.htmlgoodies.com/html5/javascript/calculating-the-difference-between-two-dates-in-javascript.html>
var dt = new Date(Date.now());
// pieces...
var yr_num = dt.getFullYear();
var mo_num = dt.getMonth(); // zero index, so March is 2
var dy_num = dt.getDate();
// math
var new_dy_num = dy_num + 14;
var new_dt = new Date(yr_num, mo_num, new_dy_num);
@birkin
birkin / hddm_install_notes.md
Last active April 21, 2020 12:34
hddm install notes

hddm install notes

Issue

Some python package installs these days suggest starting with Anaconda for understandable good reasons.

I'm a software developer working primarily in python, and want to experiment with Anaconda, and learn, in particular, how to best use it with virtual-environments.

However, in the meantime, I like to be able to experiment with packages using my normal dev-architecture: