Skip to content

Instantly share code, notes, and snippets.

View franckverrot's full-sized avatar
📚
🥋

Franck Verrot franckverrot

📚
🥋
View GitHub Profile
@franckverrot
franckverrot / sendRawEth.c
Created March 28, 2020 16:49 — forked from austinmarton/sendRawEth.c
Send a raw Ethernet frame in Linux
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*/
#include <arpa/inet.h>
#include <linux/if_packet.h>
#include <stdio.h>
@franckverrot
franckverrot / Zero_knowledge_db.md
Created March 22, 2019 18:35 — forked from thiloplanz/Zero_knowledge_db.md
Zero-knowledge databases

Zero knowledge databases

The idea

The idea is to provide a database as a service to end users in such a way that no one except the user herself can access the data, not even the hosting provider or the database administrator.

Advantages

  • A privacy- and/or security-conscious user will have more trust in such a setup.
  • The service provider cannot be coerced to release the data they were trusted with, and he cannot be held responsible for the content he is storing.
@franckverrot
franckverrot / latency.markdown
Created September 16, 2018 17:42 — 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

@franckverrot
franckverrot / latency.txt
Created September 16, 2018 17:37 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
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
require 'fiddle'
require 'minitest/autorun'
class RubyVM
class InstructionSequence
address = Fiddle::Handle::DEFAULT['rb_iseq_load']
func = Fiddle::Function.new(address, [Fiddle::TYPE_VOIDP] * 3, Fiddle::TYPE_VOIDP)
define_singleton_method(:load) do |data, parent = nil, opt = nil|
func.call(Fiddle.dlwrap(data), parent, opt).to_value
@franckverrot
franckverrot / gist:dc870fb763b785308bb5ea715185902c
Created January 17, 2018 05:01 — forked from bobzhen/gist:b03329713db40f80b4e70922ede8704b
Phoenix Framework v1.3: Brunch Install Bootstrap 4.0.0-beta with Font-Awesome

Install Dependencies

npm install --save jquery popper.js tether bootstrap@4.0.0-beta font-awesome // popper.js for bootstrap 4 dependency

Copy font-awesome fonts to assets/static/fonts folder

cp -r assets/node_modules/font-awesome/fonts to assets/static
@franckverrot
franckverrot / poolboy_demo.ex
Created January 13, 2018 15:14 — forked from henrik/poolboy_demo.ex
Example of using Poolboy in Elixir to limit concurrency (e.g. of HTTP requests).
defmodule HttpRequester do
use GenServer
def start_link(_) do
GenServer.start_link(__MODULE__, nil, [])
end
def fetch(server, url) do
# Don't use cast: http://blog.elixirsips.com/2014/07/16/errata-dont-use-cast-in-a-poolboy-transaction/
timeout_ms = 10_000
@franckverrot
franckverrot / ladder.md
Created June 20, 2017 03:24 — forked from jamtur01/ladder.md
Kickstarter Engineering Ladder
@franckverrot
franckverrot / lmdb.tcl
Created April 30, 2017 16:14 — forked from antirez/lmdb.tcl
LMDB -- First version of Redis written in Tcl
# LVDB - LLOOGG Memory DB
# Copyriht (C) 2009 Salvatore Sanfilippo <antirez@gmail.com>
# All Rights Reserved
# TODO
# - cron with cleanup of timedout clients, automatic dump
# - the dump should use array startsearch to write it line by line
# and may just use gets to read element by element and load the whole state.
# - 'help','stopserver','saveandstopserver','save','load','reset','keys' commands.
# - ttl with milliseconds resolution 'ttl a 1000'. Check ttl in dump!

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would