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 | |
if ARGV.length < 4 | |
puts "Usage: enc-mp3 artist year album picture" | |
exit | |
end | |
artist = ARGV[0] | |
date = ARGV[1] | |
album = ARGV[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
signature Ordered = | |
sig | |
type T | |
val eq : T * T -> bool | |
val lt : T * T -> bool | |
val leq : T * T -> bool | |
end | |
(* HEAP *) |
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
(declare insert) | |
(declare find-min) | |
(declare delete-min) | |
(declare empty-heap) | |
(declare is-empty?) | |
(declare heap-seq) | |
(deftype LeftistHeap [^Integer rank ^Integer elem left right] | |
clojure.lang.IPersistentStack | |
(peek [this] |
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 sandbox.words | |
(:require [clojure.string :refer [blank? trim join]])) | |
(def split-at-chars #{\newline \space \tab}) | |
(defn cut-single-line [text column-length] | |
(if (> (count text) column-length) | |
(let [line (drop-while (complement split-at-chars) (reverse text)) | |
length (count line)] | |
(cond |
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
-module(dojo2). | |
-import(lists,[nth/2]). | |
-include_lib ("eunit/include/eunit.hrl"). | |
-compile(export_all). | |
lookup(K,[{K,V}|_Tl]) -> | |
V; | |
lookup(K,[{_D,_V}|Tl]) -> | |
lookup(K, Tl); | |
lookup(_K,[]) -> |
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
# AWS Version 4 signing example | |
# This version makes a POST request and passes request parameters | |
# in the body (payload) of the request. Auth information is passed in | |
# an Authorization header. | |
import sys, os, base64, datetime, hashlib, hmac | |
import requests # pip install requests | |
method = 'POST' | |
service = 'execute-api' |
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
-module(dojo4). | |
-import(lists,[nth/2]). | |
-include_lib ("eunit/include/eunit.hrl"). | |
-compile(export_all). | |
rand_list(Size) -> | |
lists:map(fun(X)-> random:uniform(100) end, lists:seq(1,Size)). | |
grid(Size) -> | |
lists:map(fun(X)-> rand_list(Size) end, lists:seq(1,Size)). |
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 dojo.core) | |
(def prices {:A 2.5 | |
:B 3.0}) | |
(def zones-map {"Asterix" :A | |
"Aldgate" :A | |
"Barbican" :B | |
"Balham" :B}) |
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
-module('shake'). | |
-import(lists,[reverse/1]). | |
-define(FILENAME,"/Users/maris/Documents/pg1000.txt"). | |
%% API exports | |
-compile(export_all). | |
insert(Children, [X | Xs]) -> | |
I = maps:get(X, Children, #{}), | |
maps:put(X, insert(I, Xs), Children); |
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
-module(dojo). | |
-import(lists,[nth/2,split/2,delete/2]). | |
-compile([export_all]). | |
deck() -> | |
[ {Rank, Suit} || Suit <- [hearts, spades, clubs, diamonds] , Rank <- [ace, king, queen, jack, 10, 9 ,8 ,7 , 6, 5 ,4 ,3 ,2] ]. | |
shuffle([]) -> | |
[]; | |
shuffle(Xs) -> |