Skip to content

Instantly share code, notes, and snippets.

View rnag's full-sized avatar

Ritvik Nag rnag

View GitHub Profile
@Author: Maxwell Mowbray
@Date: April 2020
This script scrapes Tesla's car inventory website and alerts the user if a car under a certain price appears.
It can easily be adapted to do other things with the results, such as alert you when a specific car with a specific trim/color/wheel size appears in inventory.
rnag /
Last active February 27, 2024 19:54
Git - Change Commit Author

Bash/Zsh Function to Change Author for Commit(s)

Based off my Answer on SO.

The below function cca (shorthand for change-commit-author) makes some assumptions:

  • The branch with commit(s) to update author for is the current branch.
  • Git User / Email (AKA New Author) is the one currently set up with git.
  • One of the following arguments is passed in:
name = Ritvik Nag
defaultBranch = main
followTags = true
autoSetupRemote = true
rnag / .editorconfig
Created January 20, 2024 05:30
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# top-most EditorConfig file
root = true
# Change these settings to your own preference
rnag / a_instructions
Created January 19, 2024 02:05
VS Code (.vscode) - My Settings
Put below files in `.vscode` folder
rnag / Dockerfile
Last active April 2, 2023 23:35
Dockerfile for `rembg-aws-lambda` in AWS environments
# Note:
# Lock in build date on the tag (ex: 2023.03.29) - otherwise, we rebuild the
# entire Docker image each time a tag is updated (ex: python:3.9-x86_64)
# Refs:
# -
# -
# - (-> Image tags)
# Date (Timestamp) of the Image to Build
rnag / ts-compile.ts
Last active February 3, 2023 22:33
TypeScript Compiler API - Example
// TypeScript code to programatically run the equivalent of `tsc`
// With Slight modifications, such as *Colorized* output being displayed.
// However, the nice one-line Error Summary that `tsc` gives you (e.g. Errors in X files) is currently missing.
// Refs:
// -
// -
rnag / cleanupEmptyFolders.ts
Last active February 3, 2023 22:20 — forked from arnoson/cleanupEmptyFolders.js
ts/node: remove empty directories recursively. `exclude` is a list of directories to not traverse (optimization)
import { readdirSync, rmdirSync, statSync } from 'node:fs';
import { basename, join } from 'node:path';
export const cleanupEmptyFolders = (
folder: string,
exclude: string[] = ['node_modules']
) => {
if (!statSync(folder).isDirectory()) return;
const folderName = basename(folder);
rnag /
Last active July 28, 2023 06:22
Dataclass Type Validation
# dataclass type validation for fields on class instantiation -and- on assignment.
from dataclasses import dataclass
from validators import TypeValidator
class FooDC:
# alternatively, like:
rnag /
Created August 23, 2022 14:11
measuring dump JSON to terminal times
from timeit import timeit
data = [
"eventStatus": "Failure",
"eventType": "Archive",
"objectName": "W12 BO Template",
"time": "2022-08-23T10:09:33.092Z"