Skip to content

Instantly share code, notes, and snippets.

View Alexhuszagh's full-sized avatar

Alexander Huszagh Alexhuszagh

View GitHub Profile
@Alexhuszagh
Alexhuszagh / dump_defines.sh
Created November 30, 2017 15:32
Dumb Preprocessor Defines
#!/bin/bash
# Use as `./dump_defines.sh $CC`, where CC is the C or C++
# compiler desired. There must be an arg1, or the script
# will quit.
if [ "$#" -ne 1 ]; then
echo "Use: ./dump_defines.sh \$CC."
echo "Must invoke with exactly 1 arg."
exit 1
@Alexhuszagh
Alexhuszagh / trace_macro.sh
Last active January 6, 2018 21:33
Trace Macro Expansion of Type or Function
#!/bin/bash
# Use as `./macro.sh $CC $HEADER $MACRO`, where CC is the
# C or C++ compiler desired. There must be an arg1, arg2,
# arg3, and, or the script will quit.
if [ "$#" -ne 3 ]; then
echo "Use: ./.sh.sh \$CC \$HEADER \$MACRO."
echo "Must invoke with exactly 3 args."
exit 1
@Alexhuszagh
Alexhuszagh / redirect_stderr.py
Created March 7, 2018 01:11
Redirect stderr
import contextlib
@contextlib.contextmanager
def redirect_stderr():
'''Redirect stderr across processes temporarily.'''
stderr = None
try:
stderr = os.dup(sys.stderr.fileno())
with open(os.devnull, 'w') as devnull:
@Alexhuszagh
Alexhuszagh / nemnis_installer.sh
Created May 28, 2018 21:49
NEM NIS Installer (Ubuntu 17.04)
#!/bin/bash
# Update and add the Java repository
apt update
apt install -y software-properties-common
add-apt-repository -y ppa:webupd8team/java
# Update and install Java
apt update
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && \
@Alexhuszagh
Alexhuszagh / Dockerfile
Last active May 30, 2018 20:19
NEM NIS Dockerfile
FROM ubuntu:18.04
# Update and add the ethereum repository
RUN apt update
RUN apt install -y software-properties-common
RUN add-apt-repository -y ppa:webupd8team/java
# Update and install Java
RUN apt update
RUN echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && \
@Alexhuszagh
Alexhuszagh / walkthrough.md
Last active June 2, 2018 20:15
NEM NIS API Walkthrough
@Alexhuszagh
Alexhuszagh / walkthrough.md
Last active October 5, 2018 05:03
NEM SDK Walkthrough
@Alexhuszagh
Alexhuszagh / memchr_bench.md
Created August 4, 2019 15:30
Benchmark Results for rust-memchr

Results

These results were run on an x86_64 Intel CPU to profile the performance of BurntSushi's memchr crate.

name unit rust libc fallback naive
memchr1/huge/never μs 10.957 10.817 48.203 356.29
memchr1/huge/rare μs 12.678 12.136 49.868 361.04
memchr1/huge/uncommon μs 107.72 98.615 203.96 416.35
@Alexhuszagh
Alexhuszagh / memchr_simd.rs
Created August 4, 2019 20:52
memchr implementation with portable SIMD instructions using packed_simd. Nightly-only.
// This is derived off of BurntSushi's rust-memchr, and is re-released under
// the same licensing conditions as rust-memchr.
//
// Dual-licensed under MIT or the UNLICENSE.
//
// LICENSE
// =======
//
// This is free and unencumbered software released into the public domain.
//
@Alexhuszagh
Alexhuszagh / block_followers.py
Last active August 30, 2019 14:23
Block Followers of Accounts
'''
block_followers
===============
Block followers of a given account.
Block followers **does** not block an account if:
1. The account is verified (override with the `whitelist_verified=False`).
2. You are following the account (override with `whitelist_following=False`).