Skip to content

Instantly share code, notes, and snippets.

@liusheng
liusheng / make-protoc-2.5.0-statically-linked.sh
Last active August 18, 2024 07:04
protobuf 2.5.0 ARM64 support
apt-get update && apt-get install -y make cmake gcc g++ patch
curl -sSL https://github.com/protocolbuffers/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.gz | tar zx -C /opt/
cd /opt/protobuf-2.5.0
curl -L -O https://gist.githubusercontent.com/liusheng/64aee1b27de037f8b9ccf1873b82c413/raw/118c2fce733a9a62a03281753572a45b6efb8639/protobuf-2.5.0-arm64.patch
patch -p1 < protobuf-2.5.0-arm64.patch
./configure --disable-shared
make
ls -l src/protoc
@jkomyno
jkomyno / sockaddr_tostr.h
Last active August 29, 2024 18:43
Convert a struct sockaddr address to a string, IPv4 and IPv6
// Convert a struct sockaddr address to a string, IPv4 and IPv6:
char *get_ip_str(const struct sockaddr *sa, char *s, size_t maxlen)
{
switch(sa->sa_family) {
case AF_INET:
inet_ntop(AF_INET, &(((struct sockaddr_in *)sa)->sin_addr),
s, maxlen);
break;