Skip to content

Instantly share code, notes, and snippets.

View karmanyaahm's full-sized avatar
💭
hello everyone

Karmanyaah Malhotra karmanyaahm

💭
hello everyone
View GitHub Profile

Core words

Arigatou Gozaimasu - Thank you Domo - thanks + bow arigatou gozaimasu shita - thank you [end of conversation]

Summimassen - Excuse me/Sorry

onegaishimasu - please

daijoubu/daijubu desu - it's ok (no thanks)

# Storage service profit accumulation simulation
# Variables (constants in uppercase)
print("Cost Price: $0.50 for operations, $0.99 for backup (AWS Glacier), $6 for Backblaze object storage * taxes")
COST_PRICE = 7.49 * 1.0825 # $/TB/month
USER_CHARGE = 20 # $/TB/month
print(f"Google Photos is $10/TB/month, we charge ${USER_CHARGE}")
print("Optimistic 0% inflation in storage if drive prices keep falling")
@karmanyaahm
karmanyaahm / usageDirectAppToBucketsFile.sql
Last active August 16, 2025 03:30
convert instagram screen time to roth IRA contributions; usageDirect Android app DB to Buckets bugeting app CSV Import; workflow is to import this and then transfer an equivalent sum of money by hand when reconciling your monthly budget; made without AI :)))
#!/usr/bin/env bash
# run this as chmod +x ~/bin/usageDirectAppToBucketsFile.sql; ~/bin/usageDirectAppToBucketsFile.sql usageDirect-history.sqlite3
tail -n +6 "$0" | sqlite3 "$1"
exit $?
-- sql commands
@karmanyaahm
karmanyaahm / humiditycalc.py
Created August 8, 2025 06:43
metpy calculate drybox humidity stuff
from metpy.calc import *
from metpy.constants.nounit import epsilon
from metpy.units import units
print("epsilon", epsilon)
p = 1 * units.atm
T_amb = 20 * units.degC
rh = .90 * units.atm/units.atm
print(f"starting_rel_humid {rh.to('percent'):.1f}")
print(f"ambient_temp {T_amb.to('degC'):.1f}")
@karmanyaahm
karmanyaahm / venmoToBuckets.py
Created June 30, 2025 01:51
venmo statement export to budgetwithbuckets.com, run with `~/bin/venmoToBuckets.py VenmoStatement*`, outputs to buckets.csv
#!/usr/bin/env python3
"""
venmoToBuckets.py
Merge one or more Venmo CSV exports into buckets.csv
ID, Date (YYYYMMDD), Memo, Amount
Amount keeps the sign but no dollar symbol.
Deduplicates by ID across all inputs.
Prints each files ending balance.
@karmanyaahm
karmanyaahm / gist:d2e8665645cc79f7c5a43b08340658e3
Last active January 12, 2025 00:58
raspberry pi os setup user
Because newer versions of raspberry pi OS don't have the pi:raspberry user anymore, we need to create it manually by putting a file called userconf.txt in bootfs with the following contents:
pi:$6$y386.4xa.5z9PXrO$tiu/VR9gjA3fjLuskScBnA8RtnvN7Pcif4pHpcpgIrx388LRZwkeXm7Ahjm0S1pAPdZVfLfqwjNYNqTDz2LXJ.
`touch ssh`
https://forums.raspberrypi.com/viewtopic.php?t=357623#p2144098
@karmanyaahm
karmanyaahm / Makefile
Last active March 18, 2024 17:43
Put this in a directory and then call `nix develop --impure` This is assuming flakes are enabled in the nix config (I'm using it on NixOS but it should??? work on any nix package manager installation?)
all: clean build
build:
gcc student_a64_template.s a64_testbench.o -o ac_lab -g -lm
run: build
qemu-aarch64 ./ac_lab ${ARGS}
run-and-wait-for-debug:
while true; do make build && qemu-aarch64 -g 25540 ./ac_lab ${ARGS}; sleep 1; done
@karmanyaahm
karmanyaahm / flake.nix
Last active June 25, 2023 18:34
Orange Pi Zero with Allwinner H2+ NixOS SD Card image with uboot included; cross compiling `x86_64` -> `armv7l`; ethernet works, wifi not tested
# NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1 nix build --impure .#opi
{
description = "NixOS Orange Pi Zero configuration flake";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
outputs = { self, nixpkgs }: rec {
pkgsIntel = import nixpkgs {
system = "x86_64-linux"; # or something else
config = { allowUnfree = true; allowUnsupportedSystem = true;};
@karmanyaahm
karmanyaahm / polyglot.py
Last active April 4, 2023 02:38
PNG Text Polyglot generator, insert tEXt chunk into PNG using Python (made for micropython/circuitpython, so it conserves memory and has minimal dependencies)
# Minimum index is 1, the IHDR block MUST be first for a valid PNG
# this assumes the skipped blocks aren't very large, so it reads the whole block into memory at once, beware of setting index to more than 1
# The script is also read into memory so don't make it too large
def insert_text_chunk(filein, fileout, text, index = 1):
from binascii import crc32
from struct import pack, unpack
with open(filein, 'rb') as fin, open(fileout, 'wb') as fout:
fout.write(fin.read(8)) # PNG Header
# skip blocks
@karmanyaahm
karmanyaahm / selection-to-ntfy-bookmarket.js
Created December 20, 2022 20:51
Send currently selected text to you chosen ntfy topic by just clicking on a bookmarket; currently doesn't work for textboxes
javascript:(() => { w = window.open("https://ntfy.sh/mytopic/publish?message="+encodeURIComponent(document.getSelection().toString().replace(/(<br>)|(<br\/>)/, "\n"))); setTimeout(() => {w.close()}, 1500); })();