Skip to content

Instantly share code, notes, and snippets.

View willwade's full-sized avatar
🌏
Working on dasher and a lot of Ace hardware projects

will wade willwade

🌏
Working on dasher and a lot of Ace hardware projects
View GitHub Profile
@commadelimited
commadelimited / 2011-01-17-01.js
Created January 19, 2012 20:56
Morse Code Generator
var morse = {
a: '.-', b: '-...', c: '-.-.', d: '-..',
e: '.', f: '..-.', g: '--.', h: '....',
i: '..', j: '.---', k: '-.-', l: '.-..',
m: '--', n: '-.', o: '---', p: '.--.',
q: '--.-', r: '.-.', s: '...', t: '-',
u: '..-', v: '...-', w: '.--', x: '-..-',
y: '-.--', z: '--..', 0: '-----', 1: '.----',
2: '..---', 3: '...--', 4: '....-', 5: '.....',
6: '-....', 7: '--...', 8: '---..', 9: '----.'
@mattzuba
mattzuba / 03_s3fs.config
Created November 24, 2014 16:23
s3fs-fuse on AWS Elastic Beanstalk
packages:
yum:
gcc: []
libstdc++-devel: []
gcc-c++: []
fuse: []
fuse-devel: []
libcurl-devel: []
libxml2-devel: []
openssl-devel: []
@dpapathanasiou
dpapathanasiou / text_grabber.py
Created October 27, 2012 15:18
How to extract just the text from html page articles
"""
A series of functions to extract just the text from html page articles
"""
from lxml import etree
default_encoding = "utf-8"
def newyorker_fp (html_text, page_encoding=default_encoding):
"""For the articles found on the 'Financial Page' section of the New Yorker's website
@t-paul
t-paul / 00info.txt
Last active March 3, 2019 01:51
openscad
Image link:
![My Image](https://gist.github.com/t-paul/7171783#file-openscad-freetype-4-png)
@willwade
willwade / citeusync.py
Last active April 7, 2019 01:48
inspired by the perl version - but not quite the same. Simply use to download your bibtex file and attachments on a regular basis. NB: Only downloads the PDF if not already present so technically only 2 calls at a minimum to CUL (Login and download of bibtex. Obviously a lot more if downloading the PDFs). If more than one attachment - will only …
#!/usr/bin/env python
# Contact: Will Wade willwa.de
# Date: April 2013
# Needs mechanize and pybtex
#
# NB: Little error checking going on in this script
# TO-DO: Check last-download-date of bibtex file later than last-modified date on CUL. ? possible
#
# With thanks to https://pypi.python.org/pypi/citeulike_api/0.1.3dev for the login part
import mechanize
@x-Code-x
x-Code-x / readme_install_node
Created April 30, 2012 20:52
Install npm node.js on Debian Squeeze / Wheezy / Linux Mint Debian Edition
#Quick cp from http://sekati.com/etc/install-nodejs-on-debian-squeeze
#
#Needed to install TileMill from MapBox
#
#Installs node.js which has npm bundled
#
#Build Dependencies
sudo apt-get update && apt-get install git-core curl build-essential openssl libssl-dev
@fnurl
fnurl / docsearch-pageindexer.py
Last active January 15, 2020 07:07
A script that produces a JSON page index file for markdown files (extension `.md`) in a directory and its subdirectories (e.g. a Hugo site's (https://gohugo.io/) `content` directory) for use with Algolia Docsearch (https://github.com/algolia/docsearch).
import os
import sys
import yaml
import json
# base url to use
base_url = "http://localhost:1313"
# The attribute mapping for docsearch.
#
@rodricios
rodricios / summarize.py
Last active November 18, 2020 17:21
Flipboard's summarization algorithm, sort of
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
pip install networkx distance pattern
In Flipboard's article[1], they kindly divulge their interpretation
of the summarization technique called LexRank[2].
file = open("usb_hid_keys.h", "r")
for line in file:
goodline = line[8:].split(" ")
if line.startswith("#define ") and len(goodline)>1:
key = goodline[0]
value = ""
for i in range(1, len(goodline)):
if goodline[i] == "":
continue
@jseabold
jseabold / translate.py
Created December 13, 2011 18:58
Use Google Translate API from Python
# -*- coding: utf-8 -*-
"""
You need to fill in your API key from google below. Note that querying
supported languages is not implemented.
Language Code
-------- ----
Afrikaans af
Albanian sq
Arabic ar