Skip to content

Instantly share code, notes, and snippets.

@jboner
jboner / latency.txt
Last active April 30, 2024 07:56
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
@fabrizioc1
fabrizioc1 / http-proxy.go
Last active October 27, 2020 12:32
Http proxy server in Go
package main
import (
"fmt"
"io"
"log"
"net/http"
)
type HttpConnection struct {
@rxaviers
rxaviers / gist:7360908
Last active April 29, 2024 19:31
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
KEYBINDINGS
byobu keybindings can be user defined in /usr/share/byobu/keybindings/ (or within .screenrc if byobu-export was used). The common key bindings
are:
F2 - Create a new window
F3 - Move to previous window
F4 - Move to next window
@axic
axic / ecverify.sol
Last active April 13, 2024 09:01
Ethereum ECVerify
//
// The new assembly support in Solidity makes writing helpers easy.
// Many have complained how complex it is to use `ecrecover`, especially in conjunction
// with the `eth_sign` RPC call. Here is a helper, which makes that a matter of a single call.
//
// Sample input parameters:
// (with v=0)
// "0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad",
// "0xaca7da997ad177f040240cdccf6905b71ab16b74434388c3a72f34fd25d6439346b2bac274ff29b48b3ea6e2d04c1336eaceafda3c53ab483fc3ff12fac3ebf200",
// "0x0e5cb767cce09a7f3ca594df118aa519be5e2b5a"
@raineorshine
raineorshine / ArrayUtil.sol
Created June 29, 2016 18:23
A Solidity library to remove elements from an array.
library ArrayUtil {
/** Finds the index of a given value in an array. */
function IndexOf(uint[] values, uint value) returns(uint) {
uint i = 0;
while (values[i] != value) {
i++;
}
return i;
}
@bitgord
bitgord / Escrow-Smart-Contract
Created December 5, 2016 04:13
Example of an escrow smart contract
// package.json
{
"dependencies": {
"web3": "0.17.0-alpha",
"solc": "^0.4.4"
}
}
//Create file Ecrow.sol and create 3 variables: a buyer, a seller, and an arbiter
contract Escrow {
@abhishekkr
abhishekkr / go-versions
Last active November 12, 2019 14:13
easy version manager for golang, default at `~/bin` for `v1.13.4`
#!/usr/bin/env bash
### usage example:$ go-versions 1.13.4
set -e
export GOVERSION="$1"
[[ ! -z "$2" ]] && export LOCAL_BIN="$2"
[[ -z "${LOCAL_BIN}" ]] && export LOCAL_BIN="${HOME}/bin"
[[ ! -d "${LOCAL_BIN}" ]] && mkdir -p "${LOCAL_BIN}"
@jmarroyave
jmarroyave / myappindicator_v5.py
Last active January 11, 2019 22:34 — forked from candidtim/myappindicator_v5.py
Ubuntu AppIndicator to show Chuck Norris jokes - Updated to python 3
# This code is an example for a tutorial on Ubuntu Unity/Gnome AppIndicators:
# http://candidtim.github.io/appindicator/2014/09/13/ubuntu-appindicator-step-by-step.html
import os
import signal
import json
from urllib import request
from urllib.error import URLError
from urllib.request import urlopen
@novalagung
novalagung / go-soap-wsdl-using-http.go
Last active April 20, 2023 19:16
Example implementation of making SOAP call on WSDL web service using go with only net/http package. The full tutorial avaiable on https://medium.com/eaciit-engineering/soap-wsdl-request-in-go-language-3861cfb5949e
package main
import (
"bytes"
"crypto/tls"
"encoding/base64"
"encoding/xml"
"fmt"
"log"
"net/http"