This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <typename ValT, std::size_t Capacity> | |
class StaticCache { | |
public: | |
ValT &operator[](std::uint32_t hash) { | |
for (std::size_t i = 0; i < num_entries; ++i) { | |
if (entries[i].hash == hash) return entries[i].value; | |
} | |
if (++num_entries > Capacity) num_entries = 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
constexpr auto hash_64bitwise(std::wstring_view str) noexcept | |
{ | |
using SizeType = decltype(str)::size_type; | |
constexpr auto offset_basis = 0xcbf29ce484222325ull; | |
constexpr auto prime = 0x00000100000001B3ull; | |
auto value = offset_basis; | |
auto size = str.length(); | |
if (size % 4) | |
return 0ull; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
source $HOME/.keychain/${HOSTNAME}-sh | |
cd ~/ | |
if [ ! -d "phnt_maintain" ]; then | |
mkdir phnt_maintain | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import numpy as np | |
import datetime as dt | |
import csv, glob, os | |
from currency_converter import CurrencyConverter | |
pd.set_option('precision', 9) | |
filename_tpl = 'output/temp/'+str(int(dt.datetime.utcnow().timestamp()))+'_{}.csv' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bit> | |
#include "stackext.hpp" | |
#ifdef RECLASS_PROXY_SINGLE_THREAD | |
# define RECLASS_PROXY_STORAGE_DUR | |
#else | |
# define RECLASS_PROXY_STORAGE_DUR thread_local | |
#endif | |
#define RECLASS_AUTO_INDIRECTION : public auto_indirection_tag |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CRC { | |
private int degree; | |
private int poly; | |
public CRC(int poly) { | |
this.poly = poly; | |
this.degree = mostSignificantSetBit(poly) - 1; | |
} | |
public int getDegree() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import struct | |
import time | |
import zlib | |
import numpy as np | |
from math import floor | |
from sfml import sf | |
png_signature = b'\x89PNG\r\n\x1A\n' |