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 inlein | |
'{:dependencies [[org.clojure/clojure "1.8.0"]] | |
:jvm-opts []} | |
;; to run, use inlein: https://github.com/hyPiRion/inlein (or paste into a repl) | |
(defn primes | |
"Generate a lazy infinite sequence of primes, using method from (improved to skip even numbers): | |
https://web.archive.org/web/20150710134640/http://diditwith.net/2009/01/20/YAPESProblemSevenPart2.aspx" |
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
{"+auto switch":{"color":"#99dd99","defaultProfileName":"direct","name":"auto switch","profileType":"SwitchProfile","revision":"155a03f540b","rules":[{"condition":{"conditionType":"HostWildcardCondition","pattern":"*internal.swiftkey.com"},"profileName":"AWS"},{"condition":{"conditionType":"HostWildcardCondition","pattern":"ec2-*"},"profileName":"AWS"},{"condition":{"conditionType":"HostWildcardCondition","pattern":"ip-10-*"},"profileName":"AWS"},{"condition":{"conditionType":"HostWildcardCondition","pattern":"10.*"},"profileName":"AWS"}]},"-confirmDeletion":true,"-downloadInterval":1440,"-enableQuickSwitch":false,"-exportLegacyRuleList":false,"-monitorWebRequests":false,"-quickSwitchProfiles":["system","auto switch"],"-refreshOnProfileChange":true,"-revertProxyChanges":true,"-showInspectMenu":true,"-startupProfileName":"","schemaVersion":2,"+AWS":{"bypassList":[{"conditionType":"BypassCondition","pattern":"<local>"}],"color":"#dd3333","fallbackProxy":{"host":"localhost","port":8157,"scheme":"socks5"},"name": |
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
define :music do |txt, vol_scale=100| | |
octave = 5 | |
length = 4 | |
use_bpm 120 | |
txt = txt.downcase.gsub(/^mml@| |;$/, '').gsub(/#/, '+').gsub(/w/, 'r') | |
while not txt.empty? | |
r = txt.scan(/^(.)([+-]?)(\d*)(\.?)(.*)$/) | |
cmd, opt, num, dot, txt = r[0] | |
#print cmd, opt, num | |
case cmd |
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
use_bpm 94 | |
live_loop :drums do | |
# 1 e & a 2 e & a 3 e & a 4 e & a | |
cymbal = bools(0,0,0,0, 0,1,0,1, 0,0,0,0, 0,1,0,0) | |
hard = bools(0,0,0,0, 1,0,0,0, 0,0,0,0, 1,0,0,0) | |
soft = bools(0,0,0,0, 0,0,0,1, 0,1,0,1, 0,0,0,1) | |
kick = bools(1,0,1,0, 0,0,0,0, 0,0,1,0, 0,1,0,0) | |
with_fx :reverb, room: 0.4, damp: 0.1, amp: 1.5 do | |
16.times do |
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
use_bpm 180 | |
use_random_seed 42 | |
live_loop :drum do | |
a,b = [[:Ab,:major], [:F, :minor], [:C, :minor], [:G, :minor]].choose | |
cue :key, a: a, b: b | |
if true then | |
with_fx :reverb do | |
4.times do | |
sample :drum_tom_mid_hard, amp: ring(4,2,3,2).tick |
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
import os | |
try: | |
sc | |
except NameError: | |
from pyspark import SparkContext, SparkConf | |
sc = SparkContext(conf=SparkConf().setAppName("lol")) | |
dirs = ['/home/hadoop/.versions/spark-1.4.0.b/classpath/emrfs/', | |
'/home/hadoop/.versions/2.4.0-amzn-5/share/hadoop/common/lib/'] |
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
use_bpm 120 | |
use_synth :dsaw | |
p = [[:c4,:M7],[:a4,:m7],[:d4,:m7],[:g4,:dom7],[:e4,:m7],[:a4,:dom7],[:d4,:m7],[:g4,:dom7]] | |
in_thread do | |
sleep 8 | |
12.times do | |
sample :loop_breakbeat, rate: sample_duration(:loop_breakbeat)/4 | |
sleep 4 |
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
use_bpm 130 | |
live_loop :tick do | |
root, type = [[:d4,:m7],[:g4,:dom7],[:c4,:M7],[:f4,:M7],[:b4,:'m7+5'],[:e4,:dom7],[:a4,:m7]].tick(:tick) | |
cue :boom, root: root, type: type | |
with_fx :reverb, amp: 2 do | |
sample :drum_cymbal_closed, amp: 3 | |
sleep 0.5 | |
3.times do | |
sample :drum_cymbal_closed |
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
;; Doesn't work... | |
;; TODO: allow (truncate n (t/minutes 10)): "2014-06-27 12:34:56.789" -> "2014-06-27 12:30:00.000" | |
(defmacro mutator [method val] | |
`(fn [^MutableDateTime mdt#] (~method mdt# val))) | |
(defn truncate [^DateTime dt units] | |
(loop [^MutableDateTime mdt (.toMutableDateTime dt) | |
[[unit method] & more] [[t/years nil] | |
[t/months (mutator .setMonthOfYear 1)] |
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 | |
import sys | |
def get6bits(bytes, offset): | |
"Get 6-bit value from offset in bits in a string" | |
byte_offset = offset // 8 | |
bit_offset = offset % 8 | |
if bit_offset <= 2: | |
# The 6 bits of input are all in the same byte: |