Skip to content

Instantly share code, notes, and snippets.

View feynman0825's full-sized avatar

Xiaobin Xu feynman0825

View GitHub Profile
@feynman0825
feynman0825 / tf-experiment-template.py
Created June 18, 2019 11:09 — forked from damienpontifex/tf-experiment-template.py
A template for a custom tensorflow estimator and experiment with python3 typings for desired parameter types
import argparse
import psutil
import tensorflow as tf
from typing import Dict, Any, Callable, Tuple
## Data Input Function
def data_input_fn(data_param,
batch_size:int=None,
shuffle=False) -> Callable[[], Tuple]:
"""Return the input function to get the test data.
@feynman0825
feynman0825 / ek.coffee
Last active August 29, 2015 14:10 — forked from mcbuddha/ek.coffee
[___,_] = [((x) -> console.log x), require 'lodash']
str_from_hex = (hex) -> (_.reduce '??'+hex, (a,b,c,d) -> a += String.fromCharCode parseInt b+d[c+1], 16 if c%2 is 0;a)[1..-1]
xorter = (a,b,i) -> a.charCodeAt(i) ^ b.charCodeAt(i)
masker = (a,b,i) -> _.size _.filter a, (c) -> c isnt b and (xorter b,c,i) in [65..90]
get_best = (a,i) -> _.last _.sortBy (_.collect a, (b) -> e:b, f:masker a,b,i), 'f'
crack = (a,c,t) -> _.collect c, (x,i) -> if (g=get_best a, i).f > t then String.fromCharCode 32 ^ xorter g.e,c,i else '_'
magic = (h_target, h_ciphers) ->
ciphers = _.collect h_ciphers, str_from_hex