Skip to content

Instantly share code, notes, and snippets.

#include <cstdio>
#include <random>
#include "openbw/bwgame.h"
#include "openbw/actions.h"
int main() {
std::mt19937 rng(std::random_device{}());
@apsun
apsun / delet_tweets.md
Last active October 23, 2025 18:50
Delete your old tweets with this disgusting bash script

100% free. Runs completely locally on your machine. Bypasses the 3200 tweet limit. May require some eye bleach for the script. Here's how to use it:

  1. Go to settings -> account -> your Twitter data and request a download. This may take a few hours. You'll get an email with a link to download a zip file. Extract the zip file and navigate to the data directory.

  2. Go to Twitter in a web browser and find any Tweet you want to delete. We're going to use it to extract your authentication credentials for the next step. Open developer tools, delete the tweet, and find the request

@juniorprincewang
juniorprincewang / test_cudaLaunchKernel.cu
Last active October 10, 2022 13:38
cudaLaunchKernel usage
// Copyright (c) 2019, NVIDIA Corporation. All rights reserved.
//
// This work is made available under the Nvidia Source Code License-NC.
// To view a copy of this license, visit
// https://nvlabs.github.io/stylegan2/license.html
// From https://github.com/NVlabs/stylegan2/blob/master/test_nvcc.cu
#include <cstdio>
void checkCudaError(cudaError_t err)
@heiner
heiner / welford_test.py
Last active November 4, 2021 23:41
Various equivalent implementations of Welford's Algorithm, including its "parallel" version
#
# pytest -svx welford_test.py
#
"""
Cf. Sutton-Barto
http://www.incompleteideas.net/book/first/ebook/node19.html
and
https://math.stackexchange.com/a/103025/5051
as well as
https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Parallel_algorithm
BRIGHT = 8
def color(s, fg, bg):
return "\033[%d;3%d;4%dm%s\033[0m" % (
bool(fg & BRIGHT),
fg & ~BRIGHT,
bg & ~BRIGHT,
s,
)
@kolypto
kolypto / generators.py
Created July 27, 2021 15:21
Advanced examples for Python generators: next(), send(), throw(), yield
# https://docs.python.org/3/library/typing.html#typing.Generator
# 💥💥💥 Simple generator: yield values one by one
# This function pauses to return a value to the outer scope, then proceeds
DICTIONARY = {
'a': 'apple',
'b': 'banana',
'c': 'cat',