Skip to content

Instantly share code, notes, and snippets.

@talbii
talbii / .vimrc
Last active April 19, 2024 21:20
syntax on
set ruler
" tab -> 4 spaces
filetype plugin indent on
syntax enable
set tabstop=4
set shiftwidth=4
set expandtab
#include <cstdint>
#include <iostream>
#include <ratio>
#include <libdivide.h> // -I/path/to/libdivide
#include <bench.hpp> // -I/path/to/<https://github.com/talbii/bench.hpp>
bool stock(std::uint64_t n) {
std::uint64_t fact = 1u;
for (auto i = 2u; i < n; ++i)
// compile: cpp -std=c++20 virtual.cpp -o virtual -O2
#include "bench.hpp/bench.hpp" // https://github.com/talbii/bench.hpp
#include <ratio>
#include <cstddef>
#include <iostream>
struct A {
int x{};
virtual ~A() = default;
@talbii
talbii / password.py
Last active October 2, 2023 21:35
I keep seeing "password generator in Python" videos/comments which are written horribly, so I've decided to write a decent one instead. *Not cryptographically secure.*
from random import choices
#from secrets import choice # cryptographically secure version:
#choices = lambda N : [choice(letters) for _ in range(N)]
import string
letters = string.ascii_letters + string.digits + string.punctuation
password_gen = lambda N : ''.join(choices(letters, k=N))