Skip to content

Instantly share code, notes, and snippets.

View kashav's full-sized avatar
🧠

Kashav Madan kashav

🧠
View GitHub Profile
@kashav
kashav / celsius.txt
Last active March 24, 2023 12:45
half it and subtract 17 (faster than siri)
% python3
Python 3.10.8 (main, Oct 21 2022, 22:22:30) [Clang 14.0.0 (clang-1400.0.29.202)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> lower = lambda F: 0.5 * F - 17
>>> upper = lambda F: 0.6 * F - 18
>>> lower(45)
5.5
>>> upper(45)
9.0
>>> real = lamdba F: ((5/9)*F) - (160/9)
@kashav
kashav / links.txt
Created August 28, 2022 00:03
interesting links
commit f3bfb8e96629861590cf167e6931adb8a00156ff
Author: Kashav Madan <kshvmdn@gmail.com>
Date: Wed May 25 11:14:39 2022 -0400
Add some macos stuff
diff --git a/macos/.gitkeep b/macos/.gitkeep
deleted file mode 100644
index e69de29..0000000
diff --git a/macos/Brewfile b/macos/Brewfile
@kashav
kashav / silly.html
Created February 21, 2022 19:32
favicon canvas fun
<!DOCTYPE html>
<html>
<head>
<style>
canvas { border: 1px solid #000000; }
</style>
</head>
<body>
<canvas width="300" height="300" />
<script>
https://github.com/search?l=Python&q=%22I%27ll+explain+this+in+a+second%22&type=Code
@kashav
kashav / gist:69e87a6c64e533fc619bc0745c706098
Created February 6, 2022 04:50
for the next time someone makes fun of you for `return cond ? true : false`
https://github.com/coreutils/gnulib/blob/aa0d1e7800903f2d75432d78aa64a0e9770e83f2/lib/hash.c#L206-L209
@kashav
kashav / callstack.md
Created December 31, 2021 02:58
call stack from Node.js net.Server.listen() to the bind(3) get_port helper
@kashav
kashav / day4.py
Created December 5, 2021 01:23
Advent of Code 2021
import collections
class Board:
def __init__(self, rows):
self.rows = [[int(n) for n in r.split()] for r in rows]
self.all = collections.defaultdict(list)
self.done = False
for i, row in enumerate(self.rows):
for j, n in enumerate(row):
@kashav
kashav / wikipedia.py
Created October 13, 2021 20:52
Fetch all revisions for a Wikipedia article
#!/usr/bin/env python3
# Mostly stolen from https://stackoverflow.com/questions/45193005
import mwclient
import json
import os
import time
import sys
@kashav
kashav / .hgrc
Last active September 23, 2021 18:05
[ui]
username = Kashav Madan <kshvmdn@gmail.com>
tweakdefaults = true
interface = curses
merge = internal:merge
ignore = ~/.hgignore
[diff]
git = true
showfunc = true
[extensions]