Skip to content

Instantly share code, notes, and snippets.

View rnag's full-sized avatar

Ritvik Nag rnag

View GitHub Profile
'''
>tesla-inventory-price-scraper.py<
@Author: Maxwell Mowbray
@Email: [email protected]
@Date: April 2020
@Description:
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
rnag / .Rewrite-Git-Commit-Author.md
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:
[user]
name = Ritvik Nag
[init]
defaultBranch = main
[push]
followTags = true
autoSetupRemote = true
@rnag
rnag / .editorconfig
Created January 20, 2024 05:30
.editorconfig
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# http://editorconfig.org
# top-most EditorConfig file
root = true
[*]
# Change these settings to your own preference
@rnag
rnag / a_instructions
Created January 19, 2024 02:05
VS Code (.vscode) - My Settings
Put below files in `.vscode` folder
@rnag
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:
# - https://github.com/peterheb/rembg-lambda/issues/1#issue-1621934443
# - https://docs.aws.amazon.com/lambda/latest/dg/python-image.html
# - https://gallery.ecr.aws/lambda/python (-> Image tags)
# Date (Timestamp) of the Image to Build
@rnag
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:
// - https://github.com/microsoft/TypeScript-wiki/blob/main/Using-the-Compiler-API.md
// - https://github.com/Microsoft/TypeScript/issues/6387#issuecomment-169739615
@rnag
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
rnag / validate_test_1.py
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
@dataclass
class FooDC:
# alternatively, like:
@rnag
rnag / dump_json_to_term.py
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"
},
{