Skip to content

Instantly share code, notes, and snippets.

@koaning
koaning / bionic.py
Last active August 11, 2022 14:05
A custom recipe for Prodigy that mimics Bionic Reading.
import pyphen
import prodigy
from prodigy.components.loaders import JSONL
from prodigy.components.db import connect
hyphenator = pyphen.Pyphen(lang="en_US")
def construct_html(text):
hyphend = hyphenator.inserted(text)
@ericdfields
ericdfields / gist:3d4ed9c7f7b559289a102207facd61a7
Created February 3, 2017 15:30
Add multiple items to an Amazon Cart with a single button
I've seen links around the web for a list of items and a single 'add to amazon cart' button.
I don't know how to do this more easily through an amazon-provided UI, but it seems that you can hack it together through URL params easy enough, like so:
https://www.amazon.com/gp/aws/cart/add.html?AssociateTag=your_tag&tag=your_tagQ&ASIN.1=B012NH05UW&Quantity.1=1&ASIN.2=B012M8LXQW&Quantity.2=1
* ASINs are the string after /dp/ in amazon URLs. (amazon.com/dp/string_is_here)
* Add as URL params w/ incrementing identifiers and quantity couplets (ASIN.1, Quantity.1, ASIN.2, Quantity.2…)
@mcfrank
mcfrank / pubmed.py
Created October 7, 2015 22:08
Example of using the Entrez API to get pubmed citations
## this little script shows off the use of the pubmed API through bioconductor
## requires installing Biopython (using pip)
## also requires installing the DTD files for each of the Entrez API calls,
## but the instructions for this are given when you run the script
## useful list of Entrez databases that can be queried through API
# pmc_pubmed PubMed citations for these articles
# pmc_refs_pubmed PubMed article citing PMC article
# pmc_pmc_cites PMC articles that given PMC article cites
# pmc_pmc_citedby PMC article citing given PMC article
@Moving-Electrons
Moving-Electrons / tweet_schedule.py
Created December 15, 2014 02:37
This script reads pre-formatted tweets from a text file and posts them at defined intervals. It uses the Twython library (wrapper for Twitter API). More information at www.movingelectrons.net
#!/usr/local/bin/python2.7
import datetime
import time
import re
import os
from twython import Twython
import sys
import traceback
import httplib, urllib #used in the Pushover code