Skip to content

Instantly share code, notes, and snippets.

View manchoz's full-sized avatar

Giampaolo Mancini manchoz

View GitHub Profile
@jboner
jboner / latency.txt
Last active November 17, 2024 11:32
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
@willurd
willurd / web-servers.md
Last active November 13, 2024 13:44
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
anonymous
anonymous / .bash_aliases
Created September 12, 2014 14:37
## Modified commands
alias diff='colordiff' # requires colordiff package
alias grep='grep --color=auto'
alias more='less'
alias df='df -h'
alias du='du -c -h'
alias mkdir='mkdir -p -v'
alias nano='nano -w'
alias ping='ping -c 5'
@alexeygrigorev
alexeygrigorev / vimeo-download.py
Created September 17, 2016 09:09
Downloading segmented video from vimeo
import requests
import base64
from tqdm import tqdm
master_json_url = 'https://178skyfiregce-a.akamaihd.net/exp=1474107106~acl=%2F142089577%2F%2A~hmac=0d9becc441fc5385462d53bf59cf019c0184690862f49b414e9a2f1c5bafbe0d/142089577/video/426274424,426274425,426274423,426274422/master.json?base64_init=1'
base_url = master_json_url[:master_json_url.rfind('/', 0, -26) + 1]
resp = requests.get(master_json_url)
content = resp.json()
@vladbabii
vladbabii / build_emqtt.sh
Created October 23, 2016 17:21
Compile EMQTT on Raspberry Pi 3
apt-get update
apt-get install git erlang-base erlang-crypto erlang-eunit erlang-mnesia erlang-runtime-tools erlang-syntax-tools erlang-asn1 erlang-public-key erlang-ssl erlang-inets erlang-snmp erlang-os-mon erlang-webtool erlang-tools erlang-xmerl erlang-dev erlang-edoc erlang-eldap erlang-gs erlang-appmon erlang-wx erlang-et erlang-observer
# then follow instructions from http://emqtt.io/docs/v2/install.html#installing-from-source
git clone https://github.com/emqtt/emqttd-relx.git
cd emqttd-relx
make
# to start cd to bin then run emqttd console
# cd _rel/emqttd/bin/
# ./emqttd console
FreeTypeCache cleanUp.
Clipboard startUp: true.
RubEditingState allInstances do: [ :each | each instVarNamed: #undoManager put:nil].
GTPlayBook reset.
EditorFindReplaceDialogWindow cleanUp.
ActiveHand resetClickState; releaseAllFocus.
UITheme current focusIndicator: nil.
40 timesRepeat: [
1 second wait.
World doOneCycle.
@swlaschin
swlaschin / effective-fsharp.md
Last active October 20, 2024 12:47
Effective F#, tips and tricks

Architecture

  • Use Onion architecture

    • Dependencies go inwards. That is, the Core domain doesn't know about outside layers
  • Use pipeline model to implement workflows/use-cases/stories

    • Business logic makes decisions
    • IO does storage with minimal logic
    • Keep Business logic and IO separate
  • Keep IO at edges

template<typename E>
constexpr typename std::underlying_type<E>::type toBase(E e) noexcept
{
return static_cast<typename std::underlying_type<E>::type>(e);
}
@robonxt
robonxt / Installing the Pebble app on iOS with Sideloadly.md
Last active November 6, 2024 21:32
Installing the Pebble app on iOS with Sideloadly - Rebble (Now)Official Installation Guide by robonxt

NOTICE:

Rebble have an official official guide based on this, so please follow their guide on their website at help.rebble.io/sideload-ios-app.

Please direct your questions and suggestions to the helpful people in the official Rebble Discord Server

This guide is in maintenance mode. I am only keeping this guide up as a archive and for those who stumble upon it through old links.

Thank you for all the support, and long live Pebble and Rebble!

# pkcs11-tool --module /usr/lib/libckteec.so.0 --init-token --label arduino --so-pin 12345678
# pkcs11-tool --module /usr/lib/libckteec.so.0 --init-pin --label arduino --so-pin 12345678 --pin 87654321
# pkcs11-tool --module /usr/lib/libckteec.so.0 --keypairgen --key-type EC:prime256v1 --label testkey --token-label arduino --pin 87654321
Key pair generated:
Private Key Object; EC
label: testkey
Usage: sign, derive
Access: sensitive, always sensitive, never extractable, local