Skip to content

Instantly share code, notes, and snippets.

@alexandnpu
alexandnpu / python_client_for_netty_protobuf.py
Created June 2, 2017 09:13
During my work, i have to use a python client to talk to a protobuf server based on netty. I can not find some python helpers to parse the length prepender that netty adds to each protobuf message. So I wrote the following code.
# the following is talk to protobuf server based on netty 4.1.11.Final
ONE_BYTE_MASK = 0xffffffff << 7
TWO_BYTES_MASK = 0xffffffff << 14
THREE_BYTES_MASK = 0xffffffff << 21
FOUR_BYTES_MASK = 0xffffffff << 28
def how_many_bytes_this_length_take(package_len):
result = package_len & ONE_BYTE_MASK
if result == 0:
@alexandnpu
alexandnpu / gist:44aacb0c42feac6d5848947808c30c21
Last active August 25, 2017 05:48 — forked from k-takata/gist:5124445
Build The Silver Searcher

Build The Silver Searcher

the silver searcher

For Win32/64 using MSYS2

Install Packages

Install the following packages using pacman -S package-name:

@alexandnpu
alexandnpu / OSX UTC Time Zone
Created October 24, 2017 03:11 — forked from nick-desteffen/OSX UTC Time Zone
Set Time zone in OSX to UTC
sudo ln -sf /usr/share/zoneinfo/UTC /etc/localtime
yum install libmpc-devel mpfr-devel gmp-devel
cd /usr/src/
curl ftp://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-4.9.3/gcc-4.9.3.tar.bz2 -O
tar xvfj gcc-4.9.3.tar.bz2
cd gcc-4.9.3
./configure --disable-multilib --enable-languages=c,c++
make -j `grep processor /proc/cpuinfo | wc -l`
make install
@alexandnpu
alexandnpu / build-git.md
Created January 17, 2022 11:59 — forked from egorsmkv/build-git.md
Build git from source code on CentOS 7

Build git from source code

1) Go to https://git-scm.com/ and check out the latest version of Git

Currently, the latest version is 2.18.0. Download and extract it and go to the folder of the source code:

wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.18.0.tar.gz
tar xf git-2.18.0.tar.gz
cd git-2.18.0/