Skip to content

Instantly share code, notes, and snippets.

Mitchell Szczepanczyk msszczep

Block or report user

Report or block msszczep

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@msszczep
msszczep / redis_cheatsheet_notes.txt
Created May 16, 2019
Quick cheatsheet notes on redis
View redis_cheatsheet_notes.txt
heroku redis:cli -a [APP]
dbsize
keys *
get [KEY]
@msszczep
msszczep / subanagram_sorted_points.erl
Created Apr 13, 2019
Subanagram script in Erlang (from May 11, 2008)
View subanagram_sorted_points.erl
#!/usr/bin/env escript
% This is an Erlang version of the subanagram generator.
% It works far faster and the code is far shorter.
% It takes a word at the command line as an argument.
% e.g.: `./subanagram_prototype.erl representative`
% It delivers as output the words that are eligible subanagrams, ordered in length from shortest to longest,
% along with the number of points from each word, assuming no double or triple letter or word squares.
@msszczep
msszczep / subanagram_prototype.erl
Created Apr 13, 2019
Subanagram prototype in Erlang (dated May 3, 2008)
View subanagram_prototype.erl
#!/usr/bin/env escript
% This is an Erlang version of the subanagram generator.
% It works far faster and the code is far shorter.
% It takes a word at the command line as an argument.
% e.g.: `./subanagram_prototype.erl representative`
% Note: You need a file of words, one word per line, in the same directory as
% the script.
@msszczep
msszczep / get-json-data.clj
Created Jun 26, 2018
Get JSON Data via InLein script
View get-json-data.clj
'{:dependencies [[org.clojure/clojure "1.8.0"]
[cheshire "5.8.0"]]}
(require '[cheshire.core :as json])
(def j (cheshire.core/parse-string (slurp "j.json") true))
(def file-names (->> j
:definitions
(map (comp last #(clojure.string/split #"\.") :file))
@msszczep
msszczep / wqc.clj
Last active Jun 2, 2018
WQC Score Calculator
View wqc.clj
; #wqc #clojure
; For the World Quizzing Championships
; http://www.worldquizzingchampionships.com/
(def sample-scores
[["joshua Kreitzer" 1 2 3 4 5 6 7 8]
["Sreeradh RP" 9 10 11 12 13 14 15]
["david striasny" 3 8 8 7 20 4 14 11]])
(defn get-wqc-scores [s]
@msszczep
msszczep / lton2.clj
Created May 15, 2018
letters->numbers in Clojure, Take 2
View lton2.clj
(defn l->n [input]
"Given a string and the sequence a = 1, b = 2, ... z = 26, compute the total for the string.
Get a bonus point if the sequence 'zachary' appears in the string."
(let [point-values (zipmap (map char "abcdefghijklmnopqrstuvwxyz")
(range 1 27))
bonus-point (if (re-find #"zachary" (clojure.string/lower-case input)) 1 0)]
(->> input
(map char)
(map point-values)
(cons bonus-point)
@msszczep
msszczep / wordbox.clj
Created May 13, 2018
Wordbox in Clojure
View wordbox.clj
(defn get-wordboxes [word]
"Given a word like 'cat', make all possible wordboxes in English. Here's an example wordbox:
CAT
O*E
GUN
Note that the words 'cog', 'ten' and 'gun' come from the word 'cat'.
The code below is too slow for words of four-letters-long or longer. I was hoping to make a full-fledged
@msszczep
msszczep / lton.clj
Created May 4, 2018
letters->numbers in Clojure
View lton.clj
(defn letters->numbers [letters]
(let [letter-map (zipmap (map char "abcdefghijklmnopqrstuvwxyz")
(range 1 27))]
(->> letters
(map char)
(map letter-map)
(reduce +))))
@msszczep
msszczep / p112.clj
Created Apr 8, 2018
In progress solutions for 4Clojure problem #112
View p112.clj
(defn p112-take1 [n d]
(letfn [(recast-to-vec [acc]
(let [num-left (count (re-seq #"\[" (apply str acc)))
num-right (count (re-seq #"\]" (apply str acc)))
updated-seq (concat acc (repeat (- num-left num-right) "]"))]
(read-string (apply str (interpose " " updated-seq)))))
(recast-to-int [s]
(Integer. (clojure.string/replace s #"[\]\[]" "")))]
(loop [acc-value 0
acc-structure []
@msszczep
msszczep / command_line_arguments.py
Last active Feb 1, 2018
Python Toolbox files (with some shell and Perl as well)
View command_line_arguments.py
import sys
text = sys.argv[1]
print text
You can’t perform that action at this time.