Skip to content

Instantly share code, notes, and snippets.

View endolith's full-sized avatar
🤨

endolith

🤨
View GitHub Profile
# Python implementation of the Gibbons-Lester-Bird algorithm[1] for enumerating
# the positive rationals.
#
# James Tauber 2004-07-01
# http://jtauber.com/
#
# [1] http://web.comlab.ox.ac.uk/oucl/work/jeremy.gibbons/publications/rationals.pdf
def rationals():
"""
#
# This file is the units database for use with GNU units, a units conversion
# program by Adrian Mariano adrian@cam.cornell.edu
#
# 24 September 2007 Version 1.49
#
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006
# 2007
# Free Software Foundation, Inc
#
@NelsonMinar
NelsonMinar / google.ahk
Created December 11, 2010 17:15
AutoHotkey script to make CapsLock open URLs and search Google
; AutoHotkey script to make CapsLock open URLs and search Google with Clipboard contents.
; By Nelson Minar <nelson@monkey.org> Inspired by code at http://www.autohotkey.com/forum/topic14656.html
CapsLock::
url := RegExReplace(Clipboard, "^\s+|\s+$") ; Trim whitespace
if RegExMatch(url, "^(http|ftp|telnet)") {
; Do nothing if it already looks like a URL
} else {
; Escape the query string. Could escape more, but this seems sufficient for Chrome
StringReplace, url, url, `%, `%25, All
@rwilcox
rwilcox / installing_python_packages_programatically.py
Created December 26, 2010 17:32
How to use PIP to install Python packages programmatically.py
#!/usr/bin/env python
"""
PIP can stand for PIP Installs packages Programmatically, too!
(and here's how)
Requires:
* Python 2.6 or higher (for print-as-a-function)
* PIP 0.8.2
"""
import pyaudio
import wave
import numpy as np
from contextlib import contextmanager
import math
p = pyaudio.PyAudio()
chunk = 1024*4
FORMAT = pyaudio.paInt16
@dsosby
dsosby / config-highlight.cfg
Created August 3, 2011 15:24
A dark highlighting theme for Python's IDLE IDE based on Notepad++'s Obsidian color scheme
[Obsidian]
definition-foreground = #678CB1
error-foreground = #FF0000
string-background = #293134
keyword-foreground = #93C763
normal-foreground = #E0E2E4
comment-background = #293134
hit-foreground = #E0E2E4
builtin-background = #293134
stdout-foreground = #678CB1
@sixtenbe
sixtenbe / analytic_wfm.py
Last active February 24, 2024 23:45 — forked from endolith/peakdet.m
Peak detection in Python
#!/usr/bin/python2
# Copyright (C) 2016 Sixten Bergman
# License WTFPL
#
# This program is free software. It comes without any warranty, to the extent
# permitted by applicable law.
# You can redistribute it and/or modify it under the terms of the Do What The
# Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See
@tkf
tkf / mplonflask.py
Created October 19, 2011 21:04
matplotlib on Flask
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot
import numpy
from flask import Flask, send_file
from cStringIO import StringIO
app = Flask(__name__)
@spudbean
spudbean / gist:1558257
Last active August 25, 2023 19:26
Look of disapproval and other emoticons
ಠ_ಠ
( ͡° ͜ʖ ͡°)
¯\_(ツ)_/¯
(╯°□°)╯︵ ┻━┻
http://www.fileformat.info/convert/text/upside-down.htm
WRTTN http://wrttn.me/30dbfd/
Unicode Emoticons
@XP1
XP1 / Disable Google Search rewrite 1.01.js
Created February 9, 2012 14:05
Disable Google Search rewrite: Disables the rewrite of links in Google Search results.
// ==UserScript==
// @name Disable Google Search rewrite
// @version 1.01
// @description Disables the rewrite of links in Google Search results.
// @author XP1 (https://github.com/XP1/)
// @namespace https://gist.github.com/1780197/
// @include http*://google.*/search?*
// @include http*://*.google.*/search?*
// ==/UserScript==