Skip to content

Instantly share code, notes, and snippets.

View ShivamJoker's full-sized avatar
🐢
Code for life

Shivam ShivamJoker

🐢
Code for life
View GitHub Profile
@ShivamJoker
ShivamJoker / Useful bash commands.md
Last active January 17, 2024 09:43
Some of the useful bash commands which I use everyday

Rename all files extension recursively eg. .js to .jsx

find . -name '*.js' -exec sh -c 'mv "$0" "${0%.js}.jsx"' {} \;

Convert all images in a specific format (eg .png or .jpg to webp)

for i in *; do convert $i "${i%.*}.webp"; done   
@ShivamJoker
ShivamJoker / README.md
Created May 26, 2022 09:34
Simple function which rendereds RGB color in your terminal console

Sample color pallete output

image

@ShivamJoker
ShivamJoker / Figlet fonts preview.md
Last active January 17, 2024 09:41
380 figlet fonts preview

Font - 1Row

'| /? () \/\/ 
              

Font - 3D-ASCII

@ShivamJoker
ShivamJoker / delete-cognito-users.js
Created August 24, 2023 09:44
Use AWS Cognito SDK to delete all the users in a cognito user pool
import {
CognitoIdentityProviderClient,
ListUsersCommand,
AdminDeleteUserCommand,
} from "@aws-sdk/client-cognito-identity-provider";
const USER_POOL_ID = "your-pool-id";
const client = new CognitoIdentityProviderClient({ region: "us-east-1" });
@ShivamJoker
ShivamJoker / NodeJS-HTTP-Server-on-port-80.mjs
Last active July 4, 2023 09:42
Simple NodeJs server and commands to run it on port 80
import http from "node:http"
const hostname = '0.0.0.0';
const port = 80;
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader("Content-Type", "text/html");
res.end("<h1>Hello from LearnAWS.io</h1>\n");
});
@ShivamJoker
ShivamJoker / s3-cloudfront-policy.json
Created February 1, 2023 17:54
Origin access control policy example to allow Amazon Cloudfront to access S3
{
"Version": "2008-10-17",
"Id": "PolicyForCloudFrontPrivateContent",
"Statement": [
{
"Sid": "AllowCloudFrontServicePrincipal",
"Effect": "Allow",
"Principal": {
"Service": "cloudfront.amazonaws.com"
},
@ShivamJoker
ShivamJoker / sleep.js
Created October 14, 2022 12:56
Simple JavaScript promise based function to add delay between your executions
const sleep = (duration) => {
return new Promise((resolve) => {
setTimeout(() => {
resolve();
}, duration);
});
};
@ShivamJoker
ShivamJoker / jwt-encode-decode-with-jose.js
Last active September 6, 2022 17:48
Simple JWT encoding and verifying with jose library
import { TextEncoder } from "util";
import { SignJWT, jwtVerify } from "jose";
const secret = process.env.JWT_SECRET ?? "I like bananas";
const textEncoder = new TextEncoder();
const keyToSignWith = textEncoder.encode(secret);
const jwt = await new SignJWT({
email: "cool@guy.com"
@ShivamJoker
ShivamJoker / dad-jokes-collection.json
Created September 6, 2022 14:57
A collection of 600+ dad jokes downloaded from icanhazdadjoke.com
[
{
"id": "0189hNRf2g",
"joke": "I'm tired of following my dreams. I'm just going to ask them where they are going and meet up with them later."
},
{
"id": "08EQZ8EQukb",
"joke": "Did you hear about the guy whose whole left side was cut off? He's all right now."
},
{
@ShivamJoker
ShivamJoker / GoogleLogin.js
Created December 29, 2020 16:23
Login to your google account with puppeteer
import puppeteer from "puppeteer-extra";
import StealthPlugin from "puppeteer-extra-plugin-stealth";
puppeteer.use(StealthPlugin());
(async () => {
const browser = await puppeteer.launch({ headless: false });
const page = await browser.newPage();
const navigationPromise = page.waitForNavigation();
await page.goto("https://accounts.google.com/");