Skip to content

Instantly share code, notes, and snippets.

View DarkKirb's full-sized avatar
🦝
github does not let me add my middle name

Charlotte DarkKirb

🦝
github does not let me add my middle name
View GitHub Profile
@DarkKirb
DarkKirb / transparent-windows.py
Created May 26, 2023 17:47
sway transparent unfocused windows, less transparent foreground windows
#!/usr/bin/env nix-shell
#!nix-shell -i python3 -p python3 python3Packages.i3ipc
import i3ipc
import signal
import sys
from functools import partial
foreground_transparency = "0.9"
background_transparency = "0.7"
#!@python@/bin/python
import asyncio
from concurrent.futures import ThreadPoolExecutor
import functools
from typing import Any, AsyncIterable, Awaitable, Callable, Optional, TypeVar, cast
from os import path, listdir
import datetime
import json
@DarkKirb
DarkKirb / test.js
Last active June 1, 2023 17:08
Itchio add bundle to collection
async function do_it() {
for(var i = 3; i < document.forms.length; i++) {
var data = new FormData(document.forms[i])
data.append("action", "claim")
fetch(document.location, {method: "POST", body: data})
await new Promise(resolve => setTimeout(resolve, 500))
}
}
await do_it()
@DarkKirb
DarkKirb / default.nix
Created February 15, 2022 20:34
Nix shitpost: purely functional pronouns
{ pkgs ? import <nixpkgs> { }, ... }:
let
word = pkgs.writeText "word";
mergePronoun = wordList: pkgs.runCommand "pronoun" { } ''
for word in ${toString wordList}; do
echo -n "$(cat $word)/" >> $out;
done
sed -i 's|/$|\n|' $out
'';
mergePronouns = pronounList: pkgs.runCommand "pronouns" { } ''

Keybase proof

I hereby claim:

  • I am darkkirb on github.
  • I am darkkirb (https://keybase.io/darkkirb) on keybase.
  • I have a public key ASA3e37WUD-04PGdAX4Ki9plpCbRJZUhCNWqKIvpP6Pl7go

To claim this, I am signing this object:

@DarkKirb
DarkKirb / main.rs
Last active March 16, 2021 17:15
dd iflag=fullblock bs=1M but better
use tokio::io::*;
#[tokio::main]
async fn main() -> Result<()> {
let mut stdin = stdin();
let mut stdout = stdout();
let mut buf = vec![0u8; 1024 * 1024];
let mut buf_off = 0;
loop {
let bytes_read = stdin.read(&mut buf[buf_off..]).await?;
@DarkKirb
DarkKirb / map_to_yaml.py
Last active August 5, 2017 15:23
xbin4 YAML
import sys
import yaml
import io
from xbin_to_yaml import YAML
def get_xbin_len(f):
assert f.read(4) == b"XBIN"
f.read(4)
return int.from_bytes(f.read(4), 'little')
def dump_xbins(f, p):
f.seek(p)
#include "lzss.hpp"
#include <algorithm>
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MAX(a,b) ((a)>(b)?(a):(b))
auto reverse = [](uint8_t b) -> uint8_t {
b = (b & 0xF0) >> 4 | (b & 0x0F) << 4;
b = (b & 0xCC) >> 2 | (b & 0x33) << 2;
b = (b & 0xAA) >> 1 | (b & 0x55) << 1;
return b;
};
@DarkKirb
DarkKirb / Makefile
Last active December 3, 2016 10:42
Makefile for the cross compiler MTGos uses
CROSSPATH = $(HOME)/opt
TARGET = none
export PATH := $(CROSSPATH)/opt/bin:$(PATH)
all: | clean $(CROSSPATH)/ fetch prereqs i686-elf-gcc arm-none-eabi-gcc armeb-eabi-gcc ppc-elf-gcc aarch64-none-elf-gcc x86-64-elf-gcc
clean:
rm -rf $(CROSSPATH)
rm -rf temp
$(CROSSPATH)/: