Skip to content

Instantly share code, notes, and snippets.

@AALEKH
AALEKH / label2mat.m
Created August 10, 2020 19:45 — forked from hunan-rostomyan/label2mat.m
One Hot Encoder/Decoder in Octave/Matlab
function mat = label2mat(label, size)
if ~exist('size', 'var') || isempty(size)
size = 10;
end
if label > size
error('Label (%d) should be < size (%d).', label, size);
end
@AALEKH
AALEKH / latency.markdown
Created November 14, 2019 02:39 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@AALEKH
AALEKH / game-theory-books.markdown
Created August 7, 2018 00:32 — forked from matthewmccullough/game-theory-books.markdown
Game Theory Book list by Matthew McCullough

Economics & Software Development - Book List

The following books are ordered in descending order of Matthew's preference.

by Avinash K. Dixit

Recommended by Ted Neward. A different perspective and writing style from the other volumes listed.

“I am hard pressed to think of another book that can match the combination of practical insights and reading enjoyment.”—Steven Levitt

@AALEKH
AALEKH / The Technical Interview Cheat Sheet.md
Created December 7, 2017 16:15 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@AALEKH
AALEKH / plank_notes
Created August 8, 2017 20:06 — forked from erogol/plank_notes
Kaggle Plankton Classification winner's approach notes
FROM: http://benanne.github.io/2015/03/17/plankton.html
Meta-Tricks:
- Use %10 for validation with STRATIFIED SAMPLING (my mistake)
- Cyclic Pooling
- Leaky ReLU = max(x, a*x) learned a
- reduces overfitting with a ~= 1/3
- Orthogonal initialization http://arxiv.org/pdf/1312.6120v3.pdf
- Use larger weight decay for larger models since otherwise some layers might diverge
@AALEKH
AALEKH / tmux-cheatsheet.markdown
Created July 6, 2017 15:10 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@AALEKH
AALEKH / hello_daemon_plugin.c
Created January 9, 2016 14:17 — forked from tom-lpsd/hello_daemon_plugin.c
MySQL daemon plugin sample.
#include <stdio.h>
#include <mysql_version.h>
#include <mysql/plugin.h>
struct st_mysql_daemon hello_daemon_plugin =
{ MYSQL_DAEMON_INTERFACE_VERSION };
static FILE *fp;
int hello_daemon_plugin_init(void *p)
@AALEKH
AALEKH / StreamToString.go
Created October 14, 2015 20:46 — forked from tejainece/StreamToString.go
Golang: io.Reader stream to string or byte slice
import "bytes"
func StreamToByte(stream io.Reader) []byte {
buf := new(bytes.Buffer)
buf.ReadFrom(stream)
return buf.Bytes()
}
func StreamToString(stream io.Reader) string {
buf := new(bytes.Buffer)
@AALEKH
AALEKH / libwebsockets-webserver.c
Created September 24, 2015 23:09 — forked from martinsik/libwebsockets-webserver.c
Simple webserver based on libwebsockets library. Read full description at http://martinsikora.com/libwebsockets-simple-http-server
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <libwebsockets.h>
static int callback_http(struct libwebsocket_context *context,
struct libwebsocket *wsi,
enum libwebsocket_callback_reasons reason, void *user,
@AALEKH
AALEKH / countries.sql
Last active August 29, 2015 14:24 — forked from adhipg/countries.sql
CREATE TABLE IF NOT EXISTS `country` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`iso` char(2) NOT NULL,
`name` varchar(80) NOT NULL,
`nicename` varchar(80) NOT NULL,
`iso3` char(3) DEFAULT NULL,
`numcode` smallint(6) DEFAULT NULL,
`phonecode` int(5) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;