Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Cache Rules Everything Around Me

Jay Kickliter JayKickliter

💭
Cache Rules Everything Around Me
View GitHub Profile
View expanded_curve_affine.rs
impl CurveAffine for G1Affine {
type Engine = Bls12;
type Scalar = Fr;
type Base = Fq;
type Prepared = G1Prepared;
type Projective = G1;
type Uncompressed = G1Uncompressed;
type Compressed = G1Compressed;
type Pair = G2Affine;
type PairingResult = Fq12;
@JayKickliter
JayKickliter / eu868_map.erl
Last active Feb 12, 2021
RSSIS to SNR curvefit
View eu868_map.erl
{
-7 => 7.6,
-8 => 7.8,
-9 => 7.8,
-10 => 7.9,
-11 => 8.0,
-12 => 8.0,
-13 => 8.0,
-14 => 8.0,
-15 => 8.0,
@JayKickliter
JayKickliter / main.rs
Created Feb 8, 2021
Remove line and block comments from a &str in Rust
View main.rs
fn main() {
let decommented = decomment(INPUT);
println!("{}", decommented);
}
/// Removes both c-style block comments and c++-style line comments from a str.
pub fn decomment(src: &str) -> String {
let mut in_line_comment = false;
let mut in_block_comment = false;
let mut decommented = String::with_capacity(src.len());
@JayKickliter
JayKickliter / .ccls
Created Jul 31, 2020
ccls file for arm cortex-m4 project
View .ccls
%compile_commands.json
--target=armv7m-none-eabi
--sysroot=/Users/jay/.local/gcc-arm-none-eabi-9-2019-q4-major/bin/../arm-none-eabi
-isystem/Users/jay/.local/gcc-arm-none-eabi-9-2019-q4-major/bin/../arm-none-eabi/include/c++/9.2.1
-isystem/Users/jay/.local/gcc-arm-none-eabi-9-2019-q4-major/arm-none-eabi/include/c++/9.2.1/arm-none-eabi/thumb/v7-m/nofp
-mfpu=none
@JayKickliter
JayKickliter / erlang-macos.md
Created Jun 27, 2020
How I compile Erlang from source on macOS
View erlang-macos.md

How I compile Erlang from source on macOS

CFLAGS="-Og -ggdb3 -fno-omit-frame-pointer" \
CXXFLAGS="-Og -ggdb3 -fno-omit-frame-pointer" \
./configure \
      --prefix=$HOME/.local \
      --disable-silent-rules \
      --enable-dynamic-ssl-lib \
      --with-ssl=/usr/local/opt/openssl \
@JayKickliter
JayKickliter / ASan.cmake
Created May 22, 2020
Defines a custom CMake build type ASan for use with the address santizier
View ASan.cmake
# This file provides a custom build type, `CMAKE_BUILD_TYPE_ASAN`
set(CMAKE_C_FLAGS_ASAN "${CMAKE_C_FLAGS_RELWITHDEBINFO} -fsanitize=address -fno-omit-frame-pointer -fno-common" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_ASAN "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -fsanitize=address -fno-omit-frame-pointer -fno-common" CACHE STRING "" FORCE)
set(CMAKE_EXE_LINKER_FLAGS_ASAN "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} -fsanitize=address" CACHE STRING "" FORCE)
set(CMAKE_SHARED_LINKER_FLAGS_ASAN "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO} -fsanitize=address" CACHE STRING "" FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo" "ASan")
@JayKickliter
JayKickliter / FindErlang.cmake
Created May 22, 2020
Provides CMake `find_package(Erlang)` using modern cmake
View FindErlang.cmake
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindErlang
-------
Finds Erlang libraries.
Imported Targets
@JayKickliter
JayKickliter / main.c
Created Feb 27, 2020
Serializing LoRa packets into JSON with parson
View main.c
#include "parson.h"
#include <stdio.h>
/* EXPECTED OUTPUT */
/*
{
"rxpkt": [
{
"chan": 0,
"codr": "4\/5",
@JayKickliter
JayKickliter / tickless.c
Created Jan 16, 2020
FreeRTOS tickless idle with STM32 LPTIM
View tickless.c
#include <assert.h>
#include <stdbool.h>
#include <stdint.h>
#include "system_config_lptim.h"
#include "system_config_power.h"
#include "system_config_irq.h"
#include "FreeRTOS.h"
#include "FreeRTOSConfig.h"
@JayKickliter
JayKickliter / bitacc.rs
Last active Nov 22, 2019
Bit accumulator in Rust
View bitacc.rs
#![feature(const_generics)]
use num::{PrimInt, Zero};
#[derive(Default)]
struct BitAcc<T: Default, const N: u8> {
acc: T,
n: u8,
}