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
tasks_ready() { | |
which task >/dev/null || return | |
tasks_ready=$(task ready 2>/dev/null | grep -E '[0-9]+ tasks?') | |
if [[ -n "$tasks_ready" ]]; then | |
echo " ($tasks_ready ready)" | |
fi | |
} | |
PS1='\u@\h:\w$(tasks_ready) \$ ' |
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
; ex. 1: | |
(repeat 5 "Odelay!") | |
; ex. 2: | |
(when-not (re-find #"aura" "restaurant") (System/exit 0)) | |
; ex. 3: | |
(map clojure.string/capitalize ["toast" "cheese" "wine"]) | |
; ex. 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
(defn random-bongos | |
[ticks vol-min vol-max] | |
[(octave 4) | |
(set-duration 0.25) ; 16th notes | |
(let [notes (-> #{[:c] [:c :sharp] [:d] [:d :sharp] [:e]} | |
(->> (map #(note (apply pitch %)))) | |
(conj (pause))) | |
rand-note #(rand-nth notes) | |
rand-vol #(vol (+ vol-min (rand-int (- vol-max vol-min)))) | |
tick #(vector (rand-vol) (rand-note))] |
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 ruby | |
template = <<~HEREDOC | |
{{plural noun}} are {{color}}, | |
{{plural noun}} are {{color}}, | |
{{food}} is {{adjective}}, | |
and so are you. | |
HEREDOC | |
def prompt(type) |
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
$ alda repl | |
Nov 14, 2016 8:12:00 AM com.jsyn.engine.SynthesisEngine start | |
INFO: Pure Java JSyn from www.softsynth.com, rate = 44100, RT, V16.7.3 (build 457, 2014-12-25) | |
Preparing MIDI system... done. | |
█████╗ ██╗ ██████╗ █████╗ | |
██╔══██╗██║ ██╔══██╗██╔══██╗ | |
███████║██║ ██║ ██║███████║ | |
██╔══██║██║ ██║ ██║██╔══██║ | |
██║ ██║███████╗██████╔╝██║ ██║ |
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
$ boot -d clj-image2ascii repl | |
boot.user=> (require '[clj-image2ascii.core :refer :all]) | |
nil | |
boot.user=> (convert-image | |
#_=> (get-image-by-url (java.net.URL. "http://evansheline.com/wp-content/uploads/2011/06/cute-cat.jpg (40KB) ")) | |
#_=> 60 false) | |
{:width 60, :height 58, :color? false, :image <long-ass string here>} |
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
#TITLE Pixel Rain | |
#COMPOSER Quitasol | |
#PROGRAMER 2005 Dave Yarwood | |
#BANK-CHANGE 0,1 | |
#BANK-CHANGE 2,2 | |
@v2 = { 15 12 10 8 6 3 2 1 0 } | |
@v3 = { 15 15 14 14 13 13 12 12 11 11 10 10 9 9 8 8 7 7 6 6 5 } | |
@v0 = { 11 8 6 4 2 1 0 } | |
@v1 = { 11 11 10 10 9 9 8 8 7 7 6 6 5 5 4 4 3 3 2 2 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
(defn fizz-buzz [n] | |
(let [s (str (when (zero? (rem n 3)) "Fizz") | |
(when (zero? (rem n 5)) "Buzz"))] | |
(if (empty? s) n s))) | |
(doseq [x (map fizz-buzz (range 1 101))] | |
(println 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
(def fizz-buzz | |
(->> (map vector (range 1 101) (repeat 100 "")) | |
(map (fn [[i s]] [i (if (zero? (rem i 3)) (str s "Fizz") s)])) | |
(map (fn [[i s]] [i (if (zero? (rem i 5)) (str s "Buzz") s)])) | |
(map (fn [[i s]] (if (= "" s) i s))))) | |
(doseq [x fizz-buzz] (println 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
(defn fizz-buzz [n] | |
(cond | |
(zero? (rem n 15)) "FizzBuzz" | |
(zero? (rem n 3)) "Fizz" | |
(zero? (rem n 5)) "Buzz" | |
:else n)) | |
(doseq [x (map fizz-buzz (range 1 101))] | |
(println x)) |