Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Complete GrapheneOS Installation Script for Pixel 8
# This script guides you through the entire installation process
# No need to restart - just follow the prompts!
#
# Security features:
# - Automatic signature verification (SSH Signatures)
# - SHA256 checksum validation
# - Secure download over HTTPS
@qatoqat
qatoqat / mute_and_hide_ad_video.js
Created May 6, 2025 05:39
Auto Hide & Mute YouTube Sponsored Ads
// ==UserScript==
// @name Auto Hide & Mute YouTube Sponsored Ads
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Mute and hide YouTube video when "Sponsored" text appears in the player overlay; otherwise unmute and show.
// @match https://www.youtube.com/*
// @grant none
// ==/UserScript==
(function () {
'use strict';
@qatoqat
qatoqat / server.py
Created April 10, 2025 17:41
Python static web server with hot reload using built-in library (pypy compatible)
import filecmp
import http.server
import mimetypes
import os
import shutil
import socketserver
import time
from subprocess import run
from threading import Thread
@qatoqat
qatoqat / >w<
Created April 7, 2025 21:29
>w<
>w<
@qatoqat
qatoqat / line.rs
Created March 10, 2025 11:02
Line algorithm benchmark
// Bresenham average time: 30.9531ms
// DDA average time: 54.9077ms
// Xiaolin Wu average time: 58.1189ms
// Midpoint average time: 22.2429ms
// Gupta-Sproull average time: 121.9053ms
// Bresenham (flat buffer) avg time: 92.995ms
// DDA (flat buffer) avg time: 127.3775ms
// Xiaolin Wu (flat buffer) avg time: 144.9308ms
// Midpoint (flat buffer) avg time: 77.1491ms
// Gupta-Sproull (flat buffer) avg time: 252.5661ms
@qatoqat
qatoqat / ok.rs
Created March 6, 2025 17:54
ok shortcut
pub trait IntoOk<T> {
fn ok(self) -> anyhow::Result<T>;
}
impl<T> IntoOk<T> for T {
fn ok(self) -> anyhow::Result<T> {
Ok(self)
}
}
@qatoqat
qatoqat / main.rs
Created March 6, 2025 11:19
Weak pointer sizes
use std::sync::{Arc, Weak};
fn main() {
struct A {
valid: Option<Arc<()>>
}
impl A {
fn weak(&mut self) -> Weak<()> {
@qatoqat
qatoqat / main.rs
Created March 6, 2025 10:37
Benchmark local vs shared bool access
// Local bool access: 384.0872ms
// Arc<bool> access: 337.0548ms
// Arc<AtomicBool> access: 665.9188ms
// Weak<AtomicBool> upgrade & access (valid): 19.8125438s
// Weak<bool> upgrade & access (valid): 17.187099s
// Weak<AtomicBool> upgrade & access (dropped): 19.7792422s
// Weak<bool> upgrade & access (dropped): 17.5252546s
use std::sync::{Arc, Weak};
use std::sync::atomic::{AtomicBool, Ordering};
@qatoqat
qatoqat / main.rs
Created March 6, 2025 10:20
Benchmark arc + bool + atomic bool + option
// Arc<AtomicBool> access: 4.3390258s
// Arc<bool> access: 3.3204702s
// Option<Arc<AtomicBool>> access: 4.1391463s
// Option<Arc<bool>> access: 3.3405671s
// Weak<AtomicBool> access after drop: 6.6603574s
// Weak<bool> access after drop: 6.5926837s
use std::sync::{Arc, Weak};
use std::sync::atomic::AtomicBool;
use std::time::Instant;
@qatoqat
qatoqat / main.rs
Last active March 5, 2025 12:28
SDL3 RGB Circles Benchmark - Surface to Texture vs Streaming Texture
// Total textures created (Surface -> Texture): 300
// Time taken: 2.1722655s
// Memory Usage: 1533 MB
// Total textures created (Streaming Texture): 300
// Time taken: 798.8623ms
// Memory Usage: 1567 MB
use std::ffi::{c_int, CString};
use sdl3_sys::everything::*;
use std::ptr::{null, null_mut, NonNull};