Skip to content

Instantly share code, notes, and snippets.

View rnag's full-sized avatar

Ritvik Nag rnag

View GitHub Profile
@arnoson
arnoson / cleanupEmptyFolders.js
Created November 15, 2022 11:47
nodejs: remove empty directories recursively
import { readdirSync, rmdirSync, statSync } from 'node:fs'
import { join } from 'node:path'
export const cleanupEmptyFolders = (folder) => {
if (!statSync(folder).isDirectory()) return
let files = readdirSync(folder)
if (files.length > 0) {
files.forEach((file) => cleanupEmptyFolders(join(folder, file)))
// Re-evaluate files; after deleting subfolders we may have an empty parent
@rnag
rnag / my_stack.py
Last active May 18, 2023 02:35
AWS CDK - AWS Lambda Asset
# from pathlib import Path # Optional
# Using CDK v2
from aws_cdk import Duration
from aws_cdk.aws_lambda import Function, Runtime
from aws_cdk_lambda_asset.zip_asset_code import ZipAssetCode
# NOTE: Only example usage below (needs some modification)
1. While still on any branch
git tag -d v1.1
2. Create the tag again: This will "move" the tag to point to your latest commit on that branch
git tag v1.1
3. Delete the tag on remote
@oseme-techguy
oseme-techguy / Correct_GnuPG_Permission.sh
Last active April 10, 2024 07:46
This fixes the " gpg: WARNING: unsafe permissions on homedir '/home/path/to/user/.gnupg' " error while using Gnupg .
#!/usr/bin/env bash
# To fix the " gpg: WARNING: unsafe permissions on homedir '/home/path/to/user/.gnupg' " error
# Make sure that the .gnupg directory and its contents is accessibile by your user.
chown -R $(whoami) ~/.gnupg/
# Also correct the permissions and access rights on the directory
chmod 600 ~/.gnupg/*
chmod 700 ~/.gnupg
@fbaierl
fbaierl / ForkMITLicensedProject.md
Created November 6, 2018 14:17
HOWTO fork a MIT licensed project

No, you are not allowed to change the copyright notice. Indeed, the license text states pretty clearly:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

But you are allowed to add a copyright notice.

If you want to keep the MIT license, which is what I would advise you to do, you only need to add a single line to the license file, before or after Copyright (c) 2012 Some Name with your own copyright notice. The final LICENSE file will look like this:

The MIT License (MIT)

@gene1wood
gene1wood / all_aws_lambda_modules_python.md
Last active April 25, 2024 03:06
AWS Lambda function to list all available Python modules for Python 2.7 3.6 and 3.7