Skip to content

Instantly share code, notes, and snippets.

View Alexhuszagh's full-sized avatar

Alexander Huszagh Alexhuszagh

View GitHub Profile
@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 / walkthrough.md
Last active October 5, 2018 05:03
NEM SDK Walkthrough
@Alexhuszagh
Alexhuszagh / walkthrough.md
Last active June 2, 2018 20:15
NEM NIS API Walkthrough
@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 / 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 / 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 / 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 / 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 / OOP_Python.md
Last active August 11, 2017 01:05
A Gentle Introduction to Object-Oriented Programming (OOP)

Before OOP

Traditionally, functions and data were separate entities. Say, for example, I have an employee who would like to change his name, I can do this with an object and a function.

Code

class Employee(object):
    _id = -1
    _name = ""
@Alexhuszagh
Alexhuszagh / OOP.md
Created August 11, 2017 00:30
What is Object-Oriented Programming (OOP)

Traditionally, functions and data were separate entities. For example