This file contains 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/env python | |
# -*- coding: utf-8 -*- | |
BARS = u'▁▂▃▅▆▇' | |
import sys | |
data = sys.argv[1:] or sys.stdin.read().split() | |
data = (x.strip() for x in data) | |
data = [float(x) for x in data if x] |
This file contains 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
# United States of America Python Dictionary to translate States, | |
# Districts & Territories to Two-Letter codes and vice versa. | |
# | |
# Canonical URL: https://gist.github.com/rogerallen/1583593 | |
# | |
# Dedicated to the public domain. To the extent possible under law, | |
# Roger Allen has waived all copyright and related or neighboring | |
# rights to this code. Data originally from Wikipedia at the url: | |
# https://en.wikipedia.org/wiki/ISO_3166-2:US | |
# |
This file contains 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
# Python Dictionary to translate Countries to Two-Letter codes and vice versa. | |
# | |
# https://gist.github.com/rogerallen/1583606 | |
# | |
# Dedicated to the public domain. To the extent possible under law, | |
# Roger Allen has waived all copyright and related or neighboring | |
# rights to this code. Data originally from Wikipedia at the url: | |
# https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 | |
# | |
# Automatically Generated 2024-10-08 07:45:05 via Jupyter Notebook from |
This file contains 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
# Roger's Utility Functions for R | |
# | |
# source("Documents/Devel/R/utils.R") | |
# | |
isMac <- function() | |
{ | |
x <- Sys.info()[1]=="Darwin" | |
x | |
} |
This file contains 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
;; providing this for https://github.com/clojurebook/ClojureProgramming/issues/7 | |
;; I just copy-pasted the relevant code from | |
;; https://github.com/clojurebook/ClojureProgramming/blob/master/ch03-collections-repl-interactions.clj | |
;; there were a couple changes. see comments below... | |
(defn maze | |
"Returns a random maze carved out of walls; walls is a set of | |
2-item sets #{a b} where a and b are locations. |
This file contains 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/env python3 | |
# | |
# http://www.pangloss.com/seidel/shake_rule.html | |
# Shakespeare Insult Kit | |
# | |
# Combine one word from each of the three columns below, prefaced with "Thou": | |
# | |
import random | |
Column_1 ="""artless bawdy beslubbering bootless churlish cockered |
This file contains 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
;; | |
;; http://www.pangloss.com/seidel/shake_rule.html | |
;; Shakespeare Insult Kit | |
;; | |
;; Combine one word from each of the three columns below, prefaced with "Thou": | |
;; | |
(defn split [s] | |
(.split s "[ \t\r\n]+")) |
This file contains 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
(ns explore_overtone.diffeq) | |
;; we start with a differential equation: | |
;; | |
;; tempo = f(beat) or dx/dt = bps-fn(x) | |
;; | |
;; Solving the diff eq via separable eq. gives: (thanks to Tony Grabowski for his help) | |
;; | |
;; dt = dx/bps-fn(x) so t = Integrate 1/bps-fn(x) dt or Integrate spb-fn(x) dt | |
;; t = log(b + mx) / m - log(b) (since we set t = 0 at x = 0) |
This file contains 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
;; one chord progression to rule them all | |
;; The I - V - vi - IV (or C - G - Am - F) | |
;; iii? | |
;; Am F C G | |
;; C G Am F | |
;; G D Em C | |
;; D A Bm G | |
;; A E F#m D | |
;; E B C#m A | |
(ctl g :pre-amp 4.0 :distort 0.2 |
This file contains 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
(comment | |
Using ♯ and ♭ in clojure code and emacs. | |
1. To enter these glyphs in emacs, use M-x set-input-method which is | |
bound to C-x RET C-\. Enter "TeX" (Note, there are other options you | |
can use. See the docs.) | |
2. Turn this input mode on/off with C-\. | |
3. Type \sharp for ♯ and \flat for ♭. Other options include greek |
OlderNewer