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
def decolor(x): | |
from re import compile | |
return compile(r''' | |
\x1B # ESC | |
(?: # 7-bit C1 Fe (except CSI) | |
[@-Z\\-_] | |
| # or [ for CSI, followed by a control sequence | |
\[ | |
[0-?]* # Parameter bytes | |
[ -/]* # Intermediate bytes |
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
#pragma once | |
static inline float flog2_float(float x) {return (float)*(uint32_t *)&x * 0x1p-23f - 127.f;} | |
static inline double fastlog2_double(double x) {return (double)*(uint64_t *)&x * 0x1p-52 - 1023;} | |
// To convert this to approximate log-base-e, divide these by log(2) | |
#define LIBKL_ALOG_PD_MUL 1.539095918623324e-16 | |
#define LIBKL_ALOG_PD_INC -709.0895657128241 | |
#define LIBKL_ALOG_PS_MUL 8.2629582881927490e-8f |
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
#ifndef TIMESTAMPER_H__ | |
#define TIMESTAMPER_H__ | |
#include <chrono> | |
#include <cstdint> | |
#include <vector> | |
#include <iostream> | |
#include <numeric> | |
#include <algorithm> | |
namespace timestamp { |
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
# such grammar. very linguistics. wow. | |
# | |
# a context-free grammar of doge. | |
# | |
# much reference: the-toast.net/2014/02/06/linguist-explains-grammar-doge-wow | |
1 ROOT S | |
# ---- Sentences and doge phrases | |
# |
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
all: zomg | |
LDP=-L lib | |
LIBS=c10 gloo gtest clog THD protobuf caffe2 torch mkldnn c10d | |
LIB=$(patsubst %,-l%,$(LIBS)) | |
FLAGS=-O3 -std=c++17 -fopenmp -D_GLIBCXX_USE_CXX11_ABI=0 | |
INCS=include include/torch/csrc/api/include/ | |
INCLUDE=$(patsubst %,-I%,$(INCS)) | |
%: %.cpp |
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 <cstdio> | |
#include <cstring> | |
#include <random> | |
#include <cctype> | |
int main(int argc, char *argv[]) { | |
std::FILE *ifp = argc > 1 ? std::fopen(argv[1], "rb"): stdin, | |
*ofp = argc > 2 ? std::fopen(argv[2], "wb"): stdout; | |
int c; | |
static constexpr int arr[]{0,32}; |
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 sys | |
import random | |
if __name__ == "__main__": | |
for line in sys.stdin if len(sys.argv) < 2 else open(sys.argv[1]): | |
for char in line: | |
if char.isalpha(): | |
sys.stderr.write(char if random.choice([0,1]) else chr(ord(char) ^ 32)) | |
else: | |
sys.stderr.write(char) |
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 <cstdio> | |
#include <cstdint> | |
#ifndef _VEC_H__ | |
# define NO_SLEEF | |
# define NO_BLAZE | |
# include "vec/vec.h" // Import vec.h, but disable blaze and sleef. | |
#endif // Uses https://github.com/dnbaker/vec for vectorization metaprogramming | |
#ifndef HAS_AVX_512 | |
# define HAS_AVX_512 (_FEATURE_AVX512F || _FEATURE_AVX512ER || _FEATURE_AVX512PF || _FEATURE_AVX512CD || __AVX512BW__ || __AVX512CD__ || __AVX512F__) |
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
// Set ITER to be the code to execute at each iteration. | |
// Only use this when you can't guarantee your number of elements is a multiple of 8 (or some higher power of 2) | |
// If you want to save some time, you can initialize your accumulator with the first entry of the set and decrement len. | |
#define DO_DUFF(len, ITER) \ | |
do { \ | |
if(len) {\ | |
std::uint64_t loop = (len + 7) >> 3;\ | |
switch(len & 7) {\ | |
case 0: do {\ |
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
INLINE u32 nuccount(u64 kmer, unsigned k) { | |
kmer ^= XOR_MASK; | |
u32 counts(0); | |
#if 1 | |
static const u32 lut4 [] { | |
67108864, 50397184, 50331904, 50331649, 50397184, 33685504, 33620224, 33619969, 50331904, 33620224, 33554944, 33554689, 50331649, 33619969, 33554689, 33554434, | |
50397184, 33685504, 33620224, 33619969, 33685504, 16973824, 16908544, 16908289, 33620224, 16908544, 16843264, 16843009, 33619969, 16908289, 16843009, 16842754, | |
50331904, 33620224, 33554944, 33554689, 33620224, 16908544, 16843264, 16843009, 33554944, 16843264, 16777984, 16777729, 33554689, 16843009, 16777729, 16777474, | |
50331649, 33619969, 33554689, 33554434, 33619969, 16908289, 16843009, 16842754, 33554689, 16843009, 16777729, 16777474, 33554434, 16842754, 16777474, 16777219, | |
50397184, 33685504, 33620224, 33619969, 33685504, 16973824, 16908544, 16908289, 33620224, 16908544, 16843264, 16843009, 33619969, 16908289, 16843009, 16842754, |
NewerOlder