Skip to content

Instantly share code, notes, and snippets.

View cryon's full-sized avatar
👽

John Olsson cryon

👽
View GitHub Profile
private static Optional<String> ipHash(String string) {
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(string.getBytes());
byte[] digest = md5.digest();
return Optional.of(
Stream.iterate(0, i -> i + 1)
.map(i -> digest[i])
.map(Byte::toUnsignedInt)
.map(Object::toString)
def log(prefix):
def w1(function):
def w2(*arg, **kwarg):
print(prefix + " Before")
result = function(*arg, **kwarg)
print(prefix + " After")
return result
return w2
return w1
@cryon
cryon / slack.css
Created November 18, 2016 08:50
slack.css
@-moz-document domain(slack.com) { @keyframes highlight_fade { from { background-color: #373b41; }
to { background-color: #282a2e; } }
body { background: #282a2e; color: #e0e0e0; }
a { color: #ffffff; }
a:link, a:visited { color: #ffffff; }

Keybase proof

I hereby claim:

  • I am cryon on github.
  • I am cryon (https://keybase.io/cryon) on keybase.
  • I have a public key whose fingerprint is CC52 998C 93A0 0D7B 5F7A 31A3 DEDA E6DE 0B09 4ED6

To claim this, I am signing this object:

-- find tables cointaining column
select distinct table_name from information_schema.columns where column_name like 'column' and table_schema='database';
(defun get-or-prompt (symbol &optional is-password prompt)
"Returns value of SYMBOL if it's bound, otherwise prompts user.
IS-PASSWORD Optional. Non-nil value causes user input to be hidden.
PROMPT Optional. Custom prompt for user input. Defaults to SYMBOL
name."
(if (boundp symbol) (symbol-value symbol)
(let ((prompt-string (concat (if prompt prompt (symbol-name symbol)) ": ")))
(if is-password
@cryon
cryon / gist:11244129
Last active August 29, 2015 14:00
ghc-mod issue #230 Log
% ghc-mod root
/Users/john/code/private/lambdablock
% boot
("Annotations" "Array" "AsmCodeGen" "Avail" "Bag" "BasicTypes" "BinIface" "Binary" "Bindings.GLFW" "Bindings.Utilities" "Bitmap" "Bits" "BlockId" "BooleanFormula" "BreakArray" "BufWrite" "BuildTyCl" "ByteCodeAsm" "ByteCodeGen" "ByteCodeInstr" "ByteCodeItbls" "ByteCodeLink" "CError" "CForeign" "CLabel" "CPUTime" "CPrim" "CSE" "CString" "CTypes" "CgUtils" "Char" "Check" "Class" "CmdLineParser" "Cmm" "CmmBuildInfoTables" "CmmCallConv" "CmmCommonBlockElim" "CmmContFlowOpt" "CmmExpr" "CmmInfo" "CmmLayoutStack" "CmmLex" "CmmLint" "CmmLive" "CmmMachOp" "CmmNode" "CmmOpt" "CmmParse" "CmmPipeline" "CmmProcPoint" "CmmRewriteAssignments" "CmmSink" "CmmType" "CmmUtils" "CoAxiom" "CodeGen.Platform" "CodeGen.Platform.ARM" "CodeGen.Platform.NoRegs" "CodeGen.Platform.PPC" "CodeGen.Platform.PPC_Darwin" "CodeGen.Platform.SPARC" "CodeGen.Platform.X86" "CodeGen.Platform.X86_64" "CodeOutput" "Coercion" "Compiler.Hoopl" "Compiler.Hoopl.Internals" "Compiler.Hoopl.Passes.DLi