Skip to content

Instantly share code, notes, and snippets.

View leonid-ed's full-sized avatar

Leonid Edrenkin leonid-ed

View GitHub Profile
@0xadada
0xadada / README.md
Last active August 5, 2022 16:48
VIM movement, keyboard commands and shortcuts
@kschaper
kschaper / infinite_loop.go
Last active March 21, 2024 14:02
CPU friendly infinite loop in Go
// CPU friendly
for {
select {
case <-time.After(time.Second):
// do something
}
}
// instead of busy loop
for {
@htfy96
htfy96 / static_inline_example.md
Last active September 23, 2024 18:13
static inline vs inline vs static in C++

In this article we compared different behavior of static, inline and static inline free functions in compiled binary. All the following test was done under g++ 7.1.1 on Linux amd64, ELF64.

Test sources

header.hpp

#pragma once

inline int only_inline() { return 42; }
static int only_static() { return 42; }
@miguelmota
miguelmota / ethereum_keys.sh
Last active November 4, 2024 16:05
Generate Ethereum Private key, Public key, and Address using Bash and OpenSSL
# Generate the private and public keys
openssl ecparam -name secp256k1 -genkey -noout | openssl ec -text -noout > key
# Extract the public key and remove the EC prefix 0x04
cat key | grep pub -A 5 | tail -n +2 | tr -d '\n[:space:]:' | sed 's/^04//' > pub
# Extract the private key and remove the leading zero byte
cat key | grep priv -A 3 | tail -n +2 | tr -d '\n[:space:]:' | sed 's/^00//' > priv
# Generate the hash and take the address part