Skip to content

Instantly share code, notes, and snippets.

View bwasti's full-sized avatar

Bram Wasti bwasti

View GitHub Profile
var Module=typeof Module!=="undefined"?Module:{};var moduleOverrides={};var key;for(key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var arguments_=[];var thisProgram="./this.program";var quit_=function(status,toThrow){throw toThrow};var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_IS_SHELL=false;ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string";ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(Module["ENVIRONMENT"]){throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -s ENVIRONMENT=web or -s ENVIRONMENT=node)")}var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirect
@bwasti
bwasti / dot_cache.cc
Last active October 19, 2021 02:21
binary activations for fast inference on intel devices
/*
AVX2:
g++ dot_cache.cc -march=native -O3
AVX512:
g++ -DVEC_WIDTH=512 dot_cache.cc -march=native -O3
2x larger cache (P=8 is the sweetspot)
g++ -DP=16 dot_cache.cc -march=native -O3
import compiler_gym
import sys
import time
names = ["toggle_mode", "up", "down", "toggle_thread"]
actions = [3, 0, 1, 3, 0]
base = 1024 * 512
K = int(sys.argv[1]) * base
vectorize = int(sys.argv[2])
@bwasti
bwasti / loop_tool_lowlevel_sweep.ipynb
Created October 10, 2021 00:15
loop_tool_lowlevel_sweep.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bwasti
bwasti / loop_tool_demo.ipynb
Last active October 10, 2021 00:17
loop_tool_demo.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).phe=e()}}((function(){return function e(t,n,r){function i(s,o){if(!n[s]){if(!t[s]){var u="function"==typeof require&&require;if(!o&&u)return u(s,!0);if(a)return a(s,!0);var d=new Error("Cannot find module '"+s+"'");throw d.code="MODULE_NOT_FOUND",d}var f=n[s]={exports:{}};t[s][0].call(f.exports,(function(e){return i(t[s][1][e]||e)}),f,f.exports,e,t,n,r)}return n[s].exports}for(var a="function"==typeof require&&require,s=0;s<r.length;s++)i(r[s]);return i}({1:[function(e,t,n){"use strict";n.binaries_by_id=[1,1,1,1,2,2,2,2,4,4,4,4,8,8,8,8,16,16,16,16,32,32,32,32,64,64,64,64,128,128,128,128,256,256,256,256,512,512,512,512,1024,1024,1024,1024,2048,2048,2048,2048,4096,4096,4096,4096],n.suitbit_by_id=[1,8,64,512,1,8,64,512,1,8,64,512,1,8,64,512,1,8,64,512,1,8,64,5
/*
sim.cc
Compile:
g++ sim.cc -std=c++11 -lpheval -O3 -o sim -IPokerHandEvaluator/cpp/include -LPokerHandEvaluator/cpp/build
./sim
Run: (all arguments are optional, defaults to 9 player full runouts)
./sim [number of other players 1-8] [cards on the board 3-5] [top % highlighted] [number of runouts per hand]
e.g.
import builtins
import plotille
import numpy as np
import time
class Reprint:
def __init__(self):
self.h = 0
self.s = ""
# usage:
# $ python logo.py gme
# https://s3-symbol-logo.tradingview.com/gamestop--big.svg
import requests
import sys
def get_symbol(symbol):
url = "http://d.yimg.com/autoc.finance.yahoo.com/autoc?query={}&region=1&lang=en".format(symbol)
result = requests.get(url).json()
for x in result['ResultSet']['Result']:
# split
for i in range(107):
a[i] = b[i] + c[i]
for i0 in range(10):
for i1 in range(10):
a[i0 * 10 + i1] = b[i0 * 10 + i1] + c[i0 * 10 + i1]
for i0 in range(7):
a[100 + i0] = b[100 + i0] + c[100 + i0]