Skip to content

Instantly share code, notes, and snippets.

View skant09's full-sized avatar
💭
setting status

suryakant skant09

💭
setting status
  • lightmetrics
  • Bangalore
View GitHub Profile
@skant09
skant09 / resetPassword.js
Last active October 11, 2025 19:49
Change password for Cognito users
import { CognitoIdentityProviderClient, AdminSetUserPasswordCommand } from "@aws-sdk/client-cognito-identity-provider";
const REGION = "us-east-1";
const USER_POOL_ID = "us-east-1_xxxxxx";
const TEMP_PASSWORD = function(){
// generate a random password with 8 characters, including at least one uppercase letter, one lowercase letter, one number, and one special character
const length = 12;
const charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+~`|}{[]:;?><,./-=";
let password = "";
for (let i = 0, n = charset.length; i < length - 4; ++i) {
@skant09
skant09 / GMAIL_delete.md
Created February 4, 2025 13:40 — forked from jamesramsay/README.md
Gmail: delete old emails automatically

Gmail: delete old emails automatically

Automatically deletes old emails that match the specified label.

Get started

  • Create a new Google Apps Script at https://script.google.com
  • Overwrite the placeholder with the javascript below
  • Update the following constants:
  • LABEL_TO_DELETE: the label that should be have old messages deleted
@skant09
skant09 / batch-delete-gmail-emails.js
Created February 4, 2025 13:39 — forked from gene1wood/batch-delete-gmail-emails.js
A Google Apps Script script to bulk delete large amounts of email in Gmail while avoiding the error #793 which Gmail encounters normally
/*
This script, when used with Google Apps Scripts, will delete 400 emails and
can be triggered to run every few minutes without user interaction enabling you
to bulk delete email in Gmail without getting the #793 error from Gmail.
Google returns a maximum of 500 email threads in a single API call.
This script fetches 400 threads in case 500 threads is causing timeouts
Configure the search query in the code below to match the type of emails
you want to delete
#!/bin/bash
set -e
time_in_the_past=15780000 # 1 week in seconds
bucket_name="nfs"
bucket_path="ebs/www/media/configimages/ZI"
directory="/mnt/$bucket_path"
current_time=$(date +"%s")
echo $directory $bucket_path;
@skant09
skant09 / git-worktree-cheatsheet.md
Created May 26, 2022 09:09 — forked from vaidd4/git-worktree-cheatsheet.md
A cheat sheet for Git Worktrees

Git Worktree Cheatsheet

Documentation

Setup a folder inside a repo with a specific commit of that repo.

Create a new worktree

git worktree add [-f] [--detach] [--checkout] [--lock] [-b ]  []
@skant09
skant09 / package.json
Created May 2, 2022 15:55 — forked from kentcdodds/package.json
setup script for my workshops
{
"name": "workshop-setup",
"version": "1.0.0",
"description": "This is the common setup script for most of my workshops",
"bin": "./setup.js"
}
@skant09
skant09 / web-servers.md
Created September 1, 2021 19:02 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@skant09
skant09 / Javascript interview question.md
Last active August 15, 2021 17:03
Javascript interview question

Implement jQuery

$('.class').add('asdasd').css('background-color:black');

Implement Promise polyfill


Implement Promise.all

Reach UI Philosophy

Reach UI is an accessible foundation for React applications and design systems.

The three equally important goals are to be:

  • Accessible
  • Composable
  • Stylable
@skant09
skant09 / fetch-handler.js
Last active August 23, 2018 17:38
fetch handler
/**
* Constructor for HTTP error
* @param {*} err API response with message
* @param {*} args other orguments
* return new HTTPError object
*/
export default function HTTPError(err, ...args) {
Error.call(this, err.message || err);
Object.assign(this, err);
}