Skip to content

Instantly share code, notes, and snippets.

View lazear's full-sized avatar

Michael Lazear lazear

  • Belharra Therapeutics
View GitHub Profile
@lazear
lazear / binary_search.rs
Last active August 24, 2017 04:31
Binary and Linear search in rust
#![feature(test)]
/// Binary search in log N time. Slightly outperforms native rust binary search
fn binary_search<T: Ord + std::fmt::Debug>(v: &[T], i: T) -> Result<usize, usize> {
let mut first = 0;
let mut last = v.len();
while first < last {
let pivot = (first+last)/2;
if i == v[pivot] {
@lazear
lazear / min-char-rnn.py
Created July 27, 2017 07:13 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
(define (make-order symbol side price amount)
(cons 'pending (list symbol side price amount)))
(define new-conditional-order (lambda (func order)
(if func
`(placed ,order))))
(define get-price 2700)
(define get-balances
import json
import requests
import time
algorithm_id_to_str = [
"Scrypt",
"SHA256",
"ScryptNf",
"X11",
"X13",
Top Movies (in no particular order)
1. Lawrence of Arabia (1962)
2. Children of Men (2006)
3. Seven Samurai (1954)
4. Lord of The Rings Trilogy (2001-2003)
5. One Flew Over the Cuckoo's Nest (1975)
6. True Grit (2010)
7. The Good, the Bad, and the Ugly (1966)
8. Eternal Sunshine of the Spotless Mind (2004)
9. Groundhog Day (1993)
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <string.h>
#include <sys/mman.h>
/**
* Stack layout as proposed in http://www.cs.indiana.edu/~dyb/pubs/stack.pdf
* [rbp + ...] = pointer to base of stack segment?
* [rbp + ...] = pointer to next stack record?
(define (deep-map func list)
"Recursively map function onto sublists"
(map
(lambda (x)
(if (pair? x)
(deep-map func x)
(func x))) list))
(define (free-variable-list func)
(let ((body (caddr func)) (args (cadr func)))
;;; Learning how to use Streaming SIMD Extensions 4.2
[bits 64]
section .text
;===============================
; IMM8 Control Byte Operation
;