Skip to content

Instantly share code, notes, and snippets.

View index_to_array.py
###########################################
# serialization of indexes to byte arrays
###########################################
def serialize_index(index):
""" convert an index to a numpy uint8 array """
writer = faiss.VectorIOWriter()
faiss.write_index(index, writer)
return faiss.vector_to_array(writer.data)
@jpgcc
jpgcc / what_the_heck_is_a_product_manager.md
Last active May 10, 2018
"What the heck is a Product Manager?" #LandingFest #CallForSpeakers
View what_the_heck_is_a_product_manager.md

What the heck is a Product Manager?

Track: Careers

Description

Product Manager: one of the least well-defined roles in the computer industry, although quite popular nowadays. No two companies have the same description for this job title, and it can even vary widely within one company. Are they the CEO of the product (bleargh!)? Are they project managers wearing sneakers and hipster glasses? What do they do all day? Is this a business, marketing or technology role? Is this someone with a degree in engineering, or an MBA? What can make a software engineer want to become a product manager?

@sashaafm
sashaafm / erlang_formats.erl
Created Oct 4, 2016
Example on how to get all Erlang formats from source code to disassembled bytecode
View erlang_formats.erl
% Example on how to get all Erlang formats from source code to disassembled bytecode
% Erlang Source --> Erlang AST --> Erlang Expanded AST --> Core Erlang --> BEAM Bytecode
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% First the original module
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-module(add).
-export([add/2]).
@varyonic
varyonic / Dockerfile
Created Jun 10, 2016
Dockerfile with chromedriver
View Dockerfile
# See https://codeship.com/documentation/docker/browser-testing/
FROM myapp:base
# We need wget to set up the PPA and xvfb to have a virtual screen and unzip to install the Chromedriver
RUN apt-get install -y wget xvfb unzip
# Set up the Chrome PPA
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
RUN echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list
View ffmpeg.md

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

You can get the list of installed codecs with:

@sudara
sudara / puma.monitrc
Last active Jun 19, 2021
Example config needed to use monit with puma, monitoring workers for mem.
View puma.monitrc
# this monit config goes in /etc/monit/conf.d
check process puma_master
with pidfile /data/myapp/current/tmp/puma.pid
start program = "/etc/monit/scripts/puma start"
stop program = "/etc/monit/scripts/puma stop"
group myapp
check process puma_worker_0
with pidfile /data/myapp/current/tmp/puma_worker_0.pid
@piscisaureus
piscisaureus / pr.md
Created Aug 13, 2012
Checkout github pull requests locally
View pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 — forked from jboner/latency.txt
Latency numbers every programmer should know
View latency.markdown

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

@jboner
jboner / latency.txt
Last active Oct 5, 2022
Latency Numbers Every Programmer Should Know
View latency.txt
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
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 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD