Skip to content

Instantly share code, notes, and snippets.

Juan Arrieta arrieta

Block or report user

Report or block arrieta

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@arrieta
arrieta / make_canonical.hpp
Created Apr 25, 2019
Transform strings into a canonical representation
View make_canonical.hpp
/// @file make_canonical.hpp
/// @brief Transform strings into a canonical representation.
/// @author J. Arrieta <Juan.Arrieta@nablazerolabs.com>
/// @copyright (C) 2019 Nabla Zero Labs
/// @license MIT
#pragma once
#include <algorithm>
#include <cctype>
@arrieta
arrieta / timestamp.hpp
Created Apr 22, 2019
UNIX Timestamp in C++ (Guaranteed in C++20; de facto standard pre-C++20)
View timestamp.hpp
/// @file timestamp.hpp
/// @brief Return UNIX timestamp.
/// @author J. Arrieta <Juan.Arrieta@nablazerolabs.com>
/// @copyright (C) 2019 Nabla Zero Labs
/// @license MIT
#pragma once
#include <chrono>
#include <cstdint>
@arrieta
arrieta / heartbeat.cpp
Last active Apr 12, 2019
Dirt Simple Heart Beat Server in C++
View heartbeat.cpp
#include <cerrno>
#include <cstdio>
#include <cstring>
#include <sstream>
#include <chrono>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <unistd.h>
@arrieta
arrieta / AWSLambdaGenerateKeyPair.go
Last active Mar 8, 2019
AWS Lambda Generate Key Pair (Go)
View AWSLambdaGenerateKeyPair.go
// Sample code used to generate a cryptographic key pair via an AWS Lambda function.
// (C) 2019 Nabla Zero Labs
// MIT License
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
@arrieta
arrieta / base64.hpp
Last active Jan 29, 2019
Implementation of Base64 encoding and decoding in C++
View base64.hpp
// -*- coding:utf-8; mode:c++; mode:auto-fill; fill-column:80; -*-
/// @file base64.hpp
/// @brief Base64 encoding and decoding.
/// @author J. Arrieta <juan.arrieta@nablazerolabs.com>
/// @date January 28, 2019
/// @copyright (C) 2019 Nabla Zero Labs
#pragma once
// C++ Standard Library
View tle.cpp
// -*- coding:utf-8; mode:c++; mode:auto-fill; fill-column:80; -*-
/// @file tle.cpp
/// @brief Implementation of tle.
/// @author J. Arrieta <juan.arrieta@hesslag.com>
/// @date January 25, 2019
/// @copyright (C) 2019 Hesslag, Inc.
// Component header
#include "tle.hpp"
@arrieta
arrieta / slurp.hpp
Created Jan 13, 2019
Read file into std::string
View slurp.hpp
#pragma once
#include <fstream>
#include <string>
#include <system_error>
#include <iterator>
inline std::string slurp(const std::string& path) {
constexpr auto flags = std::ios::in | std::ios::binary;
if (auto fp = std::ifstream(path, flags); fp) {
@arrieta
arrieta / benchmark-poly.py
Created Nov 27, 2018
Basic benchmark polynomial evaluation using Horner's Method
View benchmark-poly.py
"""Simple re-arrangement can yield significant performance improvements in
naive, low-order polynomial evaluation. The interested reader may wish to read
about "Horner's method."
(C) 2018 Nabla Zero Labs
MIT License
"""
import time
def p0(a, x):
@arrieta
arrieta / memory_map.hpp
Created Nov 23, 2018
Simple Memory Mapping in C++
View memory_map.hpp
// -*- coding:utf-8; mode:c++; mode:auto-fill; fill-column:80; -*-
/// @file nzl/memory_map.hpp
/// @brief A mapped memory region.
/// @author J. Arrieta <juan.arrieta@nablazerolabs.com>
/// @date November 23, 2018
///
/// Copyright 2018 Nabla Zero Labs
///
/// Permission is hereby granted, free of charge, to any person obtaining a copy
@arrieta
arrieta / lexer.cpp
Created Nov 19, 2018
Simple C++ Lexer
View lexer.cpp
// A simple Lexer meant to demonstrate a few theoretical concepts. It can
// support several parser concepts and is very fast (though speed is not its
// design goal).
//
// J. Arrieta
// (C) 2018 Nabla Zero Labs
#include <string>
class Token {
You can’t perform that action at this time.