Skip to content

Instantly share code, notes, and snippets.

View amrali's full-sized avatar
:shipit:
4570719753318195560

Amr Ali amrali

:shipit:
4570719753318195560
  • Egypt
View GitHub Profile
@amrali
amrali / arthur.py
Created November 8, 2018 20:28
Tezos signature
from base58 import b58encode_check
from hashlib import blake2b
prefix = lambda x: b'\x36\xf0\x2c\x34' + x
data = b'hello world'
md32 = blake2b(data, digest_size=32).digest()
md64 = blake2b(data, digest_size=64).digest()
encoded_md32 = b58encode_check(prefix(md32))
encoded_md64 = b58encode_check(prefix(md64))
@amrali
amrali / hkt.cpp
Created September 17, 2018 00:14 — forked from jhaberstro/hkt.cpp
Functor, Maybe, and Higher-Kinded Types in C++
// Example program
#include <iostream>
#include <string>
#include <vector>
#include <type_traits>
//---------------------
// Maybe and MyVector, two totally unrelated classes whose only commanilty is that they are both type constructors of the same arity (e.g. 1) and order (e.g. 1).
//---------------------
template< typename T >
@amrali
amrali / YubiKey-GPG-SSH-guide.md
Created August 17, 2018 03:48 — forked from ageis/YubiKey-GPG-SSH-guide.md
Technical guide for using YubiKey series 4 for GPG and SSH

YubiKey 4 series GPG and SSH setup guide

Written for fairly adept technical users, preferably of Debian GNU/Linux, not for absolute beginners.

You'll probably be working with a single smartcard, so you'll want only one primary key (1. Sign & Certify) and two associated subkeys (2. Encrypt, 3. Authenticate).

### Keybase proof
I hereby claim:
* I am amrali on github.
* I am d4de (https://keybase.io/d4de) on keybase.
* I have a public key ASCNhEboNTHV0lsmYqwanCCVMcWxzhzf82HMwuS2iZODIQo
To claim this, I am signing this object:
@amrali
amrali / fingerprint_publickey.coffee
Created September 2, 2012 08:01
Get public key's fingerprint in CoffeeScript
crypto = require 'crypto'
md5sum = crypto.createHash 'md5'
pkey = 'Base64 encoded public key goes here'
data = Buffer(key, 'base64').toString 'binary'
md5sum.update data
fingerprint = md5sum.digest 'hex'
fingerprint = ("#{fingerprint[i]}#{fingerprint[i + 1]}" for i in [0...fingerprint.length] when i % 2 is 0).join ':'