Skip to content

Instantly share code, notes, and snippets.

Avatar
💻

Sayan Goswami say4n

💻
View GitHub Profile
@say4n
say4n / shenanigans.sh
Last active Jan 13, 2021
MacOS Shenanigans
View shenanigans.sh
# Disable Gatekeeper
sudo spctl --master-disable
# Enable Gatekeeper
sudo spctl --master-enable
@say4n
say4n / analyze.py
Created Nov 2, 2020
Google Takeout Analyzer
View analyze.py
#! /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 Oct 24, 2020
Split PDFs!
View readme.md

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 Sep 23, 2020 — forked from zeiv/AtomOneDark.js
Blink shell Atom One Dark theme
View AtomOneDark.js
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 Jul 29, 2020
ensmallen memfix
View memtest.sh
#! /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" ..
@say4n
say4n / heap.py
Created May 6, 2020
A simple min/max heap implementation.
View heap.py
#! /usr/bin/env python3
class Heap:
"""
Min-heap implementation.
"""
def __init__(self, ordering='min'):
self.data = []
assert str.lower(ordering) in ('min', 'max')
self.ordering = ordering
@say4n
say4n / trie.py
Last active Mar 26, 2020
A Trie implementation in Python3.
View trie.py
#! /usr/bin/env python3
from typing import Any, Dict
class Node:
def __init__(self, value=None):
self.value: Any = value
self.children: Dict[str, Node] = {}
class Trie:
@say4n
say4n / hashmap.py
Last active Mar 26, 2020
A very crude, inefficient HashMap implementation.
View hashmap.py
#! /usr/bin/env python3
import random
class HashMap:
def __init__(self, num_buckets=100):
self.num_buckets = num_buckets
self.buckets = [[] for _ in range(num_buckets)]
def put(self, key, val):
@say4n
say4n / backprop.ipynb
Created Jan 31, 2020
Hacker's guide to Neural Networks in Python!
View backprop.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@say4n
say4n / Makefile
Last active Sep 13, 2019
heap, heap-sort implementation in C++
View Makefile
.PHONY: all
all: heap
heap: heap.cpp
$(CXX) -std=c++11 heap.cpp