Skip to content

Instantly share code, notes, and snippets.

Avatar

Nathan Moinvaziri nmoinvaz

  • Phoenix, United States
View GitHub Profile
@nmoinvaz
nmoinvaz / clang-format.ps1
Last active Jun 6, 2022
PowerShell Clang-Format all files
View clang-format.ps1
$files=(git ls-files --exclude-standard); foreach ($file in $files) { if ((get-item $file).Extension -in ".cpp", ".hpp", ".c", ".cc", ".cxx", ".h", ".hxx", ".ixx", ".hh", ".m", ".mm") { &clang-format -i -style=file $file } }
View compare256_neon.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <arm_neon.h>
#include <byteswap.h>
#include <stdio.h>
#include <stdint.h>
View chunkcopy_test1
```
2022-01-19T20:11:24-08:00
Running C:\Users\nathan\Source\zlib-ng\build\test\benchmarks\Release\benchmark_zlib.exe
Run on (8 X 2995 MHz CPU s)
CPU Caches:
L1 Data 48 KiB (x4)
L1 Instruction 32 KiB (x4)
L2 Unified 1280 KiB (x4)
L3 Unified 12288 KiB (x1)
--------------------------------------------------------------------
@nmoinvaz
nmoinvaz / adler32_benchmark.cc
Last active Dec 1, 2021
adler32_benchmark_pr_1053
View adler32_benchmark.cc
/*
cmake_minimum_required(VERSION 3.17)
cmake_policy(SET CMP0091 NEW)
project(adler32_benchmark CXX)
set(BENCHMARK_ENABLE_GTEST_TESTS OFF)
add_executable(adler32_benchmark)
add_subdirectory(benchmark)
target_sources(adler32_benchmark PRIVATE adler32_benchmark.cc)
@nmoinvaz
nmoinvaz / crc32_benchmark.cc
Last active Jul 7, 2021
crc32_benchmark.cc
View crc32_benchmark.cc
/*
cmake_minimum_required(VERSION 3.17)
cmake_policy(SET CMP0091 NEW)
include(FetchContent)
project(crc32_benchmark CXX)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED YES)
@nmoinvaz
nmoinvaz / cursortable.js
Last active May 6, 2022
Antd Cursor Paginated Table Component
View cursortable.js
import React, { useEffect, useState } from "react";
import { Table, Button, Space, Row, Col } from "antd";
import { LeftOutlined, RightOutlined } from "@ant-design/icons";
const CursorPagination = ({ lastEvaluatedKey, onChange, size }) => {
/* Use stack to keep track of which evaluated keys have been previously seen */
const [ prevEvaluatedKeys, setPrevEvaluatedKeys ] = useState([]);
/* Keep track of the current evaluated key */
const [ currentEvaluatedKey, setCurrentEvaluatedKey ] = useState(null);
@nmoinvaz
nmoinvaz / bi_reverse.c
Last active May 5, 2021
zlib-ng bi-reverse table
View bi_reverse.c
#include <stdio.h>
#include <cstdlib>
#include <map>
unsigned bi_reverse(unsigned code, int len) {
/* code: the value to invert */
/* len: its bit length */
unsigned long res = 0;
do {
View host_burn.py
import sys
if sys.version_info.major < 3:
print('Python 3 or higher is required to run this script')
exit(1)
import os
import argparse
import codecs
import pprint
View zlib-ng-launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${command:cmake.launchTargetPath}",
"args": ["checksum_fuzzer", ".git", ".gitattributes", ".github", ".gitignore", ".not-used", ".shellcheckrc", "CMakeFiles", "CMakeLists.txt", "FAQ.zlib", "INDEX.md", "LICENSE.md", "Makefile.in", "README.md", "adler32.c", "adler32_p.h", "arch", "chunkset.c", "chunkset_tpl.h", "cmake", "compare258.c", "compress.c", "configure", "crc32.c", "crc32_p.h", "crc32_tbl.h", "deflate.c", "deflate.h", "deflate_fast.c", "deflate_medium.c", "deflate_p.h", "deflate_quick.c", "deflate_slow.c", "doc", "fallback_builtins.h", "functable.c", "functable.h", "gzguts.h", "gzlib.c", "gzread.c", "gzwrite.c", "infback.c", "inffast.c", "inffast.h", "inffixed_tbl.h", "inflate.c", "inflate.h", "inflate_p.h", "inftrees.c", "inftrees.h", "insert_string.c", "insert_string_tpl.h", "match_tpl.h", "test", "tools", "tr
@nmoinvaz
nmoinvaz / hashtable_mask.txt
Last active Jul 3, 2020
Zlib-ng hash table mask results
View hashtable_mask.txt
Results in the comments..