Skip to content

Instantly share code, notes, and snippets.

View Echooff3's full-sized avatar

Echooff3 Echooff3

  • South of heaven
View GitHub Profile
// sequence template
#include <iostream>
using namespace std;
/* OMG awesome void_t metafunction will change your life */
template <typename...>
using void_t = void;
typedef std::integral_constant<int, 2> two_t;
typedef std::integral_constant<int, 4> four_t;
@Echooff3
Echooff3 / sample.py
Last active January 3, 2018 20:29
Contrived tf.estimator.DNNClassifier
import tensorflow as tf
import numpy as np
import sys
from tensorflow.python import debug as tf_debug
hooks = [tf_debug.LocalCLIDebugHook()]
tf.logging.set_verbosity(tf.logging.INFO)
trainX = np.array([[1,1,0,1],[0,0,1,0],[1,0,1,1],[0,0,1,1]])
labelX = np.array([[1],[0],[1],[0]])
num_classes = 2
feature_names = ['f1','f2','f3','f4']
@Echooff3
Echooff3 / gist:e149ac7e24f65a54339f5b3a9aafb3a5
Created October 25, 2017 21:04
xargs random folder unzip
head -200 /dev/urandom | cksum | cut -f1 -d " "
find ./ -name "*.zip" -type f -print0 | xargs -0 -I {} sh -c 'unzip {} -d ./$(head -200 /dev/urandom | cksum | cut -f1 -d " ")'
@Echooff3
Echooff3 / index.js
Last active September 8, 2017 22:44
Copy GloVe to redis db
const path = require('path')
const redis = require("redis")
var client = redis.createClient()
const LineByLineReader = require('line-by-line')
const lr = new LineByLineReader(process.argv[2]);
var lineCount = 0
var currentWord = ""
var filename = path.basename(process.argv[2]).replace('.', '')
var status = require('node-status')
var pizzas = status.addItem('pizza', {
@Echooff3
Echooff3 / babyRNN.ipynb
Created September 1, 2017 16:10
RNN LSTM - The next number from 0 - 9
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Echooff3
Echooff3 / email-parse.js
Created August 24, 2017 22:01
Node parsing base64 content of email text
var fs = require('fs');
var eml = fs.readFileSync('./eml.txt').toString('utf8').split('\r\n');
function parseEmailText(eml) {
var sectionFound = false;
var found = [];
var tmp = "";
for (var x in eml) {
var l = eml[x];
@Echooff3
Echooff3 / csvtest.js
Created July 25, 2017 23:01
Parsing CSV with writeable buffer
const request = require('request')
const stream = require('stream')
const buffer = require('buffer')
class CSVStream extends stream.Writable {
constructor() {
super()
this._count = 0
this._buff = ""
this._push = (x) => {
//TODO figure out whether to dedup here or on DB Side
@Echooff3
Echooff3 / sort.js
Created July 6, 2017 20:55
XOR Sort
let x = Array.from(new Array(10), () => {return (Math.random() * (20 - 1) + 1) | 0})
const _xorSort = (x) => {
for( i = 0; i < x.length; i++) {
for( j = 0; j < x.length; j++) {
if(x[i] < x[j]) {
x[i] = x[i] ^ x[j]
x[j] = x[i] ^ x[j]
x[i] = x[i] ^ x[j]
}
/**
* Your utility library for express
*/
var basicAuth = require('basic-auth');
/**
* Simple basic auth middleware for use with Express 4.x.
*
* @example
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="reset.css" type="text/css" media="screen">
<style type="text/css" media="screen">