Skip to content

Instantly share code, notes, and snippets.

@willir
willir / Rust - Towns File Parser
Last active April 21, 2016 05:53
Rust: Towns File Parser
To give gist a name.
@willir
willir / preinclude_header.cmake
Created July 6, 2016 22:39
Preinclude Headers Cmake Function
function(preinclude_header headers)
foreach(header ${ARGV})
message(STATUS "header: ${header}")
if(MSVC)
add_definitions(/FI${header})
else()
add_definitions(-include ${header})
endif()
endforeach(header)
endfunction()
@willir
willir / 5_non_shared_substring_test.cpp
Last active August 20, 2018 00:35
Tests for Shortest Non-Shared Substring task
#include "catch.hpp"
#include <memory>
#include <random>
#include <unordered_set>
#include "non-shared-substring.h"
using std::string;
using std::unordered_set;
@willir
willir / rapidjson-ostream-wrapper-benchmark.cpp
Created October 13, 2019 11:01
Benchmark of rapidjson BasicOstreamWrapper vs BufferedOStreamWrapper.
// To Compile: g++ -O3 -std=c++17 -I${RAPIDJSON_INCLUDE} rapidjson-ostream-wrapper-benchmark.cpp -lbenchmark
#include <sstream>
#include <cstdlib>
#include <memory>
#include <random>
#include <string>
#include <string_view>
@willir
willir / build_rust.gradle
Created November 4, 2019 17:20
Android Rust
import java.nio.file.Files
import java.nio.file.Paths
import java.nio.file.Path
class BuildRust extends DefaultTask {
String variant
static String OUT_LIB_NAME = "libhello.so"
enum TargetType {
ARM64("arm64", "aarch64-linux-android", "arm64-v8a"),
@willir
willir / build-luarocks-local-server.py
Created September 20, 2021 17:26
Builds local luarocks server of specified rocks and their dependencies
#!/usr/bin/env python3
import argparse
import re
import sys
from contextlib import ExitStack
from pathlib import Path
from subprocess import run, PIPE
from typing import Set, Tuple