Skip to content

Instantly share code, notes, and snippets.

View say4n's full-sized avatar
💻

Sayan Goswami say4n

💻
View GitHub Profile
@say4n
say4n / Wayback Availability JSON API
Created April 18, 2016 07:14
This simple API for Wayback is a test to see if a given url is archived and currenlty accessible in the Wayback Machine. This API is useful for providing a 404 or other error handler which checks Wayback to see if it has an archived copy ready to display. The API can be used as follows:
This simple API for Wayback is a test to see if a given url is archived and currenlty accessible in the Wayback Machine. This API is useful for providing a 404 or other error handler which checks Wayback to see if it has an archived copy ready to display. The API can be used as follows:
http://archive.org/wayback/available?url=example.com
which might return:
{
"archived_snapshots": {
"closest": {
"available": true,
"url": "http://web.archive.org/web/20130919044612/http://example.com/",
@say4n
say4n / vanguard-real-return.js
Last active December 31, 2023 08:22
Compute real return instead of IRR on Vanguard UK's investment dashboard.
// ==UserScript==
// @name Vangugard Real Return
// @namespace https://sayan.page/
// @version 2023-12-31
// @description Vangugard show real return instead of IRR.
// @author say4n
// @match https://secure.vanguardinvestor.co.uk/en-gb/customer/home/*/investments/personals*
// @icon https://www.google.com/s2/favicons?sz=64&domain=vanguardinvestor.co.uk
// @run-at document-idle
// @grant none
@say4n
say4n / excuses.txt
Created November 6, 2023 16:43 — forked from fortytw2/excuses.txt
programming excuses
Actually, that's a feature
Don't worry, that value is only wrong half of the time
Even though it doesn't work, how does it feel?
Everything looks fine my end
How is that possible?
I broke that deliberately to do some testing
I can have a look but there's a lot of if statements in that code!
I can't make that a priority right now
I can't test everything
I couldn't find any examples of how that can be done anywhere else in the project
@say4n
say4n / disconnected_components_in_graph.py
Created February 6, 2022 17:58
Finds the number of disconnected components in a graph.
def number_of_disconnected_components(self, adj: List[List[int]]) -> int:
n = len(adj)
visited = set()
components = 0
for i in range(n):
if i not in visited:
visited |= {i}
components += 1
@say4n
say4n / bufferoverflow.c
Last active September 28, 2021 18:06
Buffer Overflow
#include <stdio.h>
#include <string.h>
// Compile with GCC for buffer overflow. :)
// gcc -w -fno-stack-protector -o main main.c && ./main
int main(void) {
char A[8] = "";
unsigned short B = 1979;
@say4n
say4n / shenanigans.sh
Last active January 13, 2021 05:52
MacOS Shenanigans
# Disable Gatekeeper
sudo spctl --master-disable
# Enable Gatekeeper
sudo spctl --master-enable
@say4n
say4n / analyze.py
Created November 2, 2020 19:07
Google Takeout Analyzer
#! /usr/bin/env python3
from collections import defaultdict
from pprint import pprint
fname = "files.txt"
files = []
with open(fname, "rt") as f:
files = f.readlines()
@say4n
say4n / readme.md
Last active October 24, 2020 12:54
Split PDFs!

usage

This will split the file input.pdf into (n + 1) files.

$ chmod +x splitPDF.py
$ ./splitPDF.py input.pdf splitPageNum_1 ... splitPageNum_n

source

@say4n
say4n / AtomOneDark.js
Created September 23, 2020 15:51 — forked from zeiv/AtomOneDark.js
Blink shell Atom One Dark theme
black = '#282c34';
red = '#e06c75'; // red
green = '#98c379'; // green
yellow = '#d19a66'; // yellow
blue = '#56b6c2'; // blue
magenta = '#c678dd'; // pink
cyan = '#56b6c2'; // cyan
white = '#d0d0d0'; // light gray
lightBlack = '#808080'; // medium gray
lightRed = '#e06c75'; // red
@say4n
say4n / memtest.sh
Created July 29, 2020 11:37
ensmallen memfix
#! /usr/bin/env zsh
rm -rf build
mkdir -p build
cd build
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-O0 -g" -DCMAKE_C_FLAGS="-O0 -g" ..