Skip to content

Instantly share code, notes, and snippets.

View orlp's full-sized avatar
⚠️
This user's social credit score is unknown.

Orson Peters orlp

⚠️
This user's social credit score is unknown.
View GitHub Profile
@orlp
orlp / big.txt
Last active August 29, 2015 14:18
dcfebadccbededgf
degfbcedcdfeabdc
bcdecdefabcddefg
fdceecbddbacgedf
dabcgdefebcdfcde
fgdeefcddebccdab
gfdedcabfecdedbc
cdefbcdeabcddefg
edbcdcabgfdefecd
bdcedfegcedfacbd
import sys
if len(sys.argv) < 3:
print("Usage: {} [-d] <file> <n>".format(sys.argv[0]))
sys.exit()
debug = False
if sys.argv[1] == "-d":
sys.argv.pop(1)
debug = True
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
html, body {
margin: 0;
height: 100%;
overflow-y: hidden;
font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif;
}
import functools
# s(x) is the space usage after x reallocations
# n(x) is the number of elements after x reallocations
# a(x) is the amount of free space at the worst-case end after x reallocations
# b(x) is the amount of free space at the other end of a after x reallocations
@functools.lru_cache(None)
#include <cstdint>
#include <limits>
#include <array>
// Implementation of the Tyche-i RNG by Samuel Neves and Filipe Araujo.
// Period is expected to be 2^127, with a very good uniform distribution.
// Can be used as a random engine for the C++11 <random> library.
// WARNING: NOT FOR CRYPTOGRAPHIC USE
class Tychei {
public:
@orlp
orlp / chacha.h
Last active April 25, 2024 12:36
C++11 ChaCha implementation.
/*
Copyright (c) 2024 Orson Peters <orsonpeters@gmail.com>
This software is provided 'as-is', without any express or implied warranty. In no event will the
authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial
applications, and to alter it and redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the
pick_percentages = (
("Thresh", 30.62),
("Lee Sin", 27.84),
("Leona", 25.49),
("Morgana", 24.53),
("Jinx", 24.33),
("Caitlyn", 24.22),
("Vayne", 23.37),
("Graves", 23.25),
("Blitzcrank", 21.49),
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <chrono>
#include <memory>
#include <cstdlib>
#include "splay_tree.h"
#include "avl_tree.h"
#include <iterator>
#include <type_traits>
template<class Iterator>
using move_if_noexcept_iterator = typename std::conditional<
!std::is_nothrow_move_constructible<
typename std::iterator_traits<Iterator>::value_type
>::value && std::is_copy_constructible<
typename std::iterator_traits<Iterator>::value_type
>::value,
" quick replace occurences
let g:should_inject_replace_occurences = 0
function! MoveToNext()
if g:should_inject_replace_occurences
call feedkeys("n")
call repeat#set("\<Plug>ReplaceOccurences")
endif
let g:should_inject_replace_occurences = 0
endfunction