Skip to content

Instantly share code, notes, and snippets.

View Gazler's full-sized avatar

Gary Rennie Gazler

View GitHub Profile
@potatosalad
potatosalad / jws-payload-example.ex
Created September 22, 2015 15:53
Example of extracting the payload from a JWS signature
jwk_map = %{ "kty" => "oct", "k" => :base64url.encode("secret")}
jws_map = %{ "alg" => "HS256" }
jwt_map = %{ "test" => true }
signature = JOSE.JWT.sign(jwk_map, jws_map, jwt_map)
signature_compacted = JOSE.JWS.compact(signature)
{_, signature_map} = JOSE.JWS.expand(signature_compacted)
payload = JOSE.JWT.from(:base64url.decode(Map.get(signature_map, "payload")))
# one-liner version:
@pnc
pnc / observer.md
Last active September 9, 2023 23:32
Using Erlang observer/appmon remotely

Using OTP's observer (appmon replacement) remotely

$ ssh remote-host "epmd -names"
epmd: up and running on port 4369 with data:
name some_node at port 58769

Note the running on port for epmd itself and the port of the node you're interested in debugging. Reconnect to the remote host with these ports forwarded:

$ ssh -L 4369:localhost:4369 -L 58769:localhost:58769 remote-host
@staltz
staltz / introrx.md
Last active May 2, 2024 12:31
The introduction to Reactive Programming you've been missing
@ottomata
ottomata / kafka-mirror
Created August 12, 2013 21:15
init.d script for Kafka MirrorMaker
#!/bin/sh
#
# /etc/init.d/kafka -- startup script for the kafka distributed publish-subscribe messaging system
#
# Written by Alexandros Kosiaris <akosiaris@wikimedia.org>
#
### BEGIN INIT INFO
# Provides: kafka
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
@jedsundwall
jedsundwall / measured-voice-terms-of-service.md
Last active December 18, 2015 18:29
This gist contains Measured Voice's government-friendly terms of service, which you can see at http://measuredvoice.com/terms. Measured Voice owns the copyright to these terms, but you are free to copy them for your own use under a the Creative Commons Attribution-ShareAlike 3.0 license (http://creativecommons.org/licenses/by-sa/3.0/). We want t…

Measured Voice Terms of Service

Amended on 25 January, 2013

1. Your Acceptance of Terms

1.1 Your use of Measured Voice and the Measured Voice web site (collectively referred to as the “Service”), is subject to the terms of a legal agreement (“Terms”) between you and Captura Group Inc., DBA Measured Voice (“Measured Voice”). The following Terms of Services ("TOS") explains the agreement and the terms of that agreement.

1.2 In order to use the Service, you must first agree to the Terms. You may not use the Service if you do not accept the Terms. You can accept the Terms by (a) actually using the Service, or (b) clicking a box where such box is made available to you. If you do not agree to any of the following Terms, please do not use the Service. You should print or otherwise save a copy of these TOS for your records.

@jboner
jboner / latency.txt
Last active May 2, 2024 09:45
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