Skip to content

Instantly share code, notes, and snippets.

Kazunori Kajihiro k2nr

Block or report user

Report or block k2nr

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
View core.clj
(ns md5.core
(:require [clojure.core.reducers :as r]
[clojure.string :as s])
(:import [ MessageDigest]
[javax.xml.bind DatatypeConverter]))
(defn ^String hexdigest [^String s]
(let [digester (MessageDigest/getInstance "MD5")]
(. digester update (.getBytes s))
(DatatypeConverter/printHexBinary (.digest digester))))
k2nr / gist:1631321
Created Jan 18, 2012
come back wikipedia!
View gist:1631321
k2nr / gist:2025857
Created Mar 13, 2012
[Vichrome]twitter sharing
View gist:2025857
nmap s :Open javascript:(function()%7Bwindow.twttr=window.twttr%7C%7C%7B%7D;var%20D=550,A=450,C=screen.height,B=screen.width,H=Math.round((B/2)-(D/2)),G=0,F=document,E;if(C%3EA)%7BG=Math.round((C/2)-(A/2))'','','left='+H+',top='+G+',width='+D+',height='+A+',personalbar=0,toolbar=0,scrollbars=1,resizable=1');E=F.createElement('script');E.src='';F.getElementsByTagName('head')%5B0%5D.appendChild(E)%7D());
alias share Open javascript:(function()%7Bwindow.twttr=window.twttr%7C%7C%7B%7D;var%20D=550,A=450,C=screen.height,B=screen.width,H=Math.round((B/2)-(D/2)),G=0,F=document,E;if(C%3EA)%7BG=Math.round((C/2)-(A/2))'','','left='+H+',top='+G+',width='+D+',height='+A+',personalbar=0,toolbar=0,scrollbars=1,resizable=1');E=F.createElement('script');E.src='';F.getElementsByTagName('head')%5B0%5D.a
k2nr /
Created Apr 1, 2012 — forked from erikh/
OSX For Hackers
#!/usr/bin/env sh
# This is script with usefull tips taken from:
# install it:
# curl -sL | sh
k2nr / gist:3092157
Created Jul 11, 2012
remove duplicates in javascript
View gist:3092157
function removeDups(array) {
var obj = {},
len = array.length,
res = [],
for(i=0; i < len; i++) {
obj[JSON.stringify(array[i])] = array[i];
k2nr / gist:4276794
Created Dec 13, 2012
define memoized function. It's useful for memoized recursion.
View gist:4276794
(defmacro defmemo
[name & fdecl]
`(def ~name
(memoize (fn ~fdecl))))
k2nr / gist:8052100
Created Dec 20, 2013
ramdisk mysql macOS hombrew
View gist:8052100
diskutil erasevolume HFS+ "ramdisk" `hdiutil attach -nomount ram://$RAMDISK_BLOCKS` &> /dev/null
mkdir $RAMDISK_ROOT/mysql
unset TMPDIR
View .i3.config
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
# Should you change your keyboard layout some time, delete # this file and re-run i3-config-wizard(1). #
# i3 config file (v4)
# Please see for a complete reference!
set $mod Mod4

Keybase proof

I hereby claim:

  • I am k2nr on github.
  • I am k2nr ( on keybase.
  • I have a public key ASCYfKJsYFkLAe0Ur2o4xFZ9kfk3uYkwFmt0d2h8wunqKAo

To claim this, I am signing this object:

k2nr / wa
Created Apr 8, 2019
window arrangement
View wa
#!/usr/bin/env python3
import subprocess
import os
import argparse
wdir = os.environ["HOME"]+"/.wa"
def get(command):
return subprocess.check_output(["/bin/bash", "-c", command]).decode("utf-8")
You can’t perform that action at this time.