Skip to content

Instantly share code, notes, and snippets.

View johnwalker's full-sized avatar
💭
what is this status for

John Walker johnwalker

💭
what is this status for
View GitHub Profile
一 二 三 四 五 六 七 八 九 十 口 日 月 田 目 古 吾 冒 朋 明 唱 晶 品 呂 昌 早 旭 世 胃 旦 胆 亘 凹 凸 旧 自 白 百 中 千 舌 升 昇 丸 寸 肘 専 博 占 上 下 卓 朝 嘲 只 貝 唄 貞 員 貼 見 児 元 頁 頑 凡 負 万 句 肌 旬 勺 的 首 乙 乱 直 具 真 工 左 右 有 賄 貢 項 刀 刃 切 召 昭 則 副 別 丁 町 可 頂 子 孔 了 女 好 如 母 貫 兄 呪 克 小 少 大 多 夕 汐 外 名 石 肖 硝 砕 砂 妬 削 光 太 器 臭 嗅 妙 省 厚 奇 川 州 順 水 氷 永 泉 腺 原 願 泳 沼 沖 汎 江 汰 汁 沙 潮 源 活 消 況 河 泊 湖 測 土 吐 圧 埼 垣 填 圭 封 涯 寺 時 均 火 炎 煩 淡 灯 畑 災 灰 点 照 魚 漁 里 黒 墨 鯉 量 厘 埋 同 洞 胴 向 尚 字 守 完 宣 宵 安 宴 寄 富 貯 木 林 森 桂 柏 枠 梢 棚 杏 桐 植 椅 枯 朴 村 相 机 本 札 暦 案 燥 未 末 昧 沫 味 妹 朱 株 若 草 苦 苛 寛 薄 葉 模 漠 墓 暮 膜 苗 兆 桃 眺 犬 状 黙 然 荻 狩 猫 牛 特 告 先 洗 介 界 茶 脊 合 塔 王 玉 宝 珠 現 玩 狂 旺 皇 呈 全 栓 理 主 注 柱 金 銑 鉢 銅 釣 針 銘 鎮 道 導 辻 迅 造 迫 逃 辺 巡 車 連 軌 輸 喩 前 煎 各 格 賂 略 客 額 夏 処 条 落 冗 冥 軍 輝 運 冠 夢 坑 高 享 塾 熟 亭 京 涼 景 鯨 舎 周 週 士 吉 壮 荘 売 学 覚 栄 書 津 牧 攻 敗 枚 故 敬 言 警 計 詮 獄 訂 訃 討 訓 詔 詰 話 詠 詩 語 読 調 談 諾 諭 式 試 弐 域 賊 栽 載 茂 戚 成 城 誠 威 滅 減 蔑 桟 銭 浅 止 歩 渉 頻 肯 企 歴 武 賦 正 証 政 定 錠 走 超 赴 越 是 題 堤 建 鍵 延 誕 礎 婿 衣 裁 装 裏 壊 哀 遠 猿 初 巾 布 帆 幅 帽 幕 幌 錦 市 柿 姉 肺 帯 滞 刺 制 製 転 芸 雨 雲 曇 雷 霜 冬 天 妖 沃 橋 嬌 立 泣 章 競 帝 諦 童 瞳 鐘 商 嫡 適 滴 敵 匕 叱 匂 頃 北 背 比 昆 皆 楷 諧 混 渇 謁 褐 喝 葛 旨 脂 詣 壱 毎 敏 梅 海 乞 乾 腹 複 欠 吹 炊 歌 軟 次 茨 資
from base64 import b16decode, b16encode, b64encode
import operator
from math import sqrt
from collections import namedtuple
def parse_hex(s):
return b16decode(s, casefold=True)
def problem_1():
hx = "49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d"
@johnwalker
johnwalker / README.md
Last active September 30, 2015 20:07
Add boggle eyes to pictures

Boggle.py

This is a script for adding boggle eyes to pictures using Haar Cascades. You have to tweak the imgname var to the name of your filename (png, jpg, whatever). You may also have to tweak parameters if the eyes aren't recognized. Here is an example output. The boggle eyes always look down, but it wouldn't be too hard to rotate them. The jpgs for the boggle eyes aren't included.

You have permission to do whatever you want with it, I really don't care it's a script that puts boggle eyes on things. Example project is making a twitter bot that replies with boggle eyes on profile pictures.

Example output

Keybase proof

I hereby claim:

  • I am johnwalker on github.
  • I am johnwalker (https://keybase.io/johnwalker) on keybase.
  • I have a public key whose fingerprint is E3DC 4D7C 5841 1A13 C6B0 113A A466 D810 6D80 FCE1

To claim this, I am signing this object:

@johnwalker
johnwalker / vigenere.clj
Last active May 23, 2018 04:44
vigenere
(ns ^:figwheel-always vigenere.core
(:require-macros [cljs.core.async.macros :refer [go]])
(:require [om.core :as om :include-macros true]
[om.dom :as dom :include-macros true]
[clojure.string :as str]
[cljs.core.async :refer [put! chan <! alts!]]))
(enable-console-print!)
(defonce app-state (atom {}))
(ns experimental-clojure.congeal-consecutives)
(def v [1 3 4 5 7 9 10 11 12])
(defn congeal-consecutives [coll]
(->> coll
(map-indexed (fn [i x] [(- x i) x]))
(partition-by first)
(mapv (fn [pairs]
(mapv second pairs)))))
(ns triangle.puzzle)
;; In part 1, we discussed the relationship between Ring Ideals and
;; the triangle peg puzzle, and showed that there was an isomorphism
;; between F4 and Z_2[x][y].
;; So, we should define our board like this:
(def board [:o
:l :l
@johnwalker
johnwalker / Golf.hs
Created October 2, 2014 17:54
CIS193 Exercise
module Golf where
import Data.List.Split
skips :: [a] -> [[a]]
skips a = map (\x -> (map head $ chunksOf x $ drop (x-1) a)) [1..length a]
@johnwalker
johnwalker / core.clj
Last active August 29, 2015 14:07
Fails for me on typed-clojure 2.7.69, 2.7.70
(ns experimental-clojure.core
(:require [clojure.core.typed :as t]))
(t/ann add-two (t/IFn [Number -> Number]))
(defn add-two [n]
(+ 2 n))
;; (t/cf add-two)
;; (t/check-ns)
(ns say-hello)
(defn say-hello
([names] (say-hello names #{}))
([names saluted]
(reduce (fn [saluted name]
(if-not (saluted name)
(do (println "Hello" name "!")
(conj saluted name))
(do (println "Welcome Back" name "!")