Skip to content

Instantly share code, notes, and snippets.

View andersonfreitas's full-sized avatar

Anderson Freitas andersonfreitas

View GitHub Profile
data:text/html,<html onclick="javascript:requestFullscreen()"><head><title>Black full screen</title></head><div class="container"> <div class="child">Click to enter full screen</div> </div><style>html {background: black; color: darkgray} :fullscreen{color: black} .container { display: flex; justify-content: center; align-items: center; height: 100%; font-family: Google sans; }</style>
import numpy as np
import time
N = 6000
M = 10000
k_list = [64, 80, 96, 104, 112, 120, 128, 144, 160, 176, 192, 200, 208, 224, 240, 256, 384]
def get_gflops(M, N, K):
return M*N*(2.0*K-1.0) / 1000**3

Keybase proof

I hereby claim:

  • I am andersonfreitas on github.
  • I am andersonfreitas (https://keybase.io/andersonfreitas) on keybase.
  • I have a public key ASAvqhkzCsBbvaamyFsr0WkiSggd-7ZO637bKLU70-Ht2go

To claim this, I am signing this object:

@andersonfreitas
andersonfreitas / strip_comments.py
Created November 18, 2015 00:24 — forked from amerberg/strip_comments.py
A script to remove comments from LaTeX source
import ply.lex, argparse, io
#Usage
# python stripcomments.py input.tex > output.tex
# python stripcomments.py input.tex -e encoding > output.tex
def strip_comments(source):
tokens = (
'PERCENT', 'BEGINCOMMENT', 'ENDCOMMENT', 'BACKSLASH',
'CHAR', 'BEGINVERBATIM', 'ENDVERBATIM', 'NEWLINE', 'ESCPCT',
set(CMAKE_CXX_COMPILER icpc)
SET(CMAKE_CXX_VERBOSE_FLAG "-v")
SET(CMAKE_CXX_FLAGS_INIT "-std=c++0x")
SET(CMAKE_CXX_FLAGS_DEBUG_INIT "-g")
SET(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG")
SET(CMAKE_CXX_FLAGS_RELEASE_INIT "-O3 -DNDEBUG -ipo")
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2 -g")
SET(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
# Check style:
proof:
echo "weasel words: "
sh bin/weasel *.tex
echo
echo "passive voice: "
sh bin/passive *.tex
echo
echo "duplicates: "
perl bin/dups *.tex

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns                     on recent CPU
L2 cache reference ........................... 7 ns                     14x L1 cache
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns                     20x L2 cache, 200x L1 cache
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 4X memory

@andersonfreitas
andersonfreitas / .gitignore
Last active August 29, 2015 14:01 — forked from wrobstory/.gitignore
Up and Down the Python Data and Web Visualization Stack
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
# C extensions
*.so
# Distribution / packaging
.Python
env/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.