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 / 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 / Figlet fonts preview.md
Last active January 17, 2024 09:41
380 figlet fonts preview

Font - 1Row

'| /? () \/\/ 
              

Font - 3D-ASCII

@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 / AWS_regions.json
Created July 18, 2022 14:03
AWS Regions' list in array with region code
[
"US East (N. Virginia) us-east-1",
"US East (Ohio) us-east-2",
"US West (N. California) us-west-1",
"US West (Oregon) us-west-2",
"Africa (Cape Town) af-south-1",
"Asia Pacific (Hong Kong) ap-east-1",
"Asia Pacific (Jakarta) ap-southeast-3",
"Asia Pacific (Mumbai) ap-south-1",
"Asia Pacific (Osaka) ap-northeast-3",
@ShivamJoker
ShivamJoker / get-cookie.js
Created July 13, 2022 17:41
Simple cookie utility function to get a particular cookie in JavaScript
@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 / README.md
Created May 26, 2022 09:34
Simple function which rendereds RGB color in your terminal console

Sample color pallete output

image