Skip to content

Instantly share code, notes, and snippets.

View austonpramodh's full-sized avatar

Auston Pramodh Barboza austonpramodh

View GitHub Profile
@austonpramodh
austonpramodh / getCourseCurriculum.js
Created December 28, 2020 10:46
Gets All the course curriculum from udemy
// let showmoreBtn = $("[data-purpose=\"show-more\"]")
// if (showmoreBtn) showmoreBtn.click()
let expandAllBtn = $("[data-purpose=\"expand-toggle\"]")
if (expandAllBtn) expandAllBtn.click()
let sectionElements = $(".clp-component-render [data-purpose=\"course-curriculum\"] :nth-child(3)").children
@austonpramodh
austonpramodh / finding urls
Created December 24, 2020 15:26
Snippet for finding all http Urls
const fs = require("fs");
const path = require("path");
const p = path.join(__dirname, "./index.android.bundle")
const file = fs.readFileSync(p, "utf-8");
var expression = /(?:(?:https?|ftp|file):\/\/|www\.|ftp\.)(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[-A-Z0-9+&@#\/%=~_|$?!:,.])*(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[A-Z0-9+&@#\/%=~_|$])/gi;
var regex = new RegExp(expression);
@austonpramodh
austonpramodh / jwtRS256.sh
Last active November 25, 2020 14:33 — forked from Holger-Will/jwtRS256.sh
generate public private key pair (RSA RS256) for use with koa-jwt jasonwebtoken etc.
# generate private key
openssl genrsa -out jwtRS256.key 2048
# extatract public key from it
openssl rsa -in jwtRS256.key -pubout > jwtRS256.key.pub
const AlphabetsCharacters =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
const NumberCharacters = "0123456789";
/**
* Creates String of random alphanumeric characters of given length
* @param length
*/
export function makeRandomString(length: number) {
let result = "";
@austonpramodh
austonpramodh / stateHook.ts
Last active April 23, 2020 13:39
Custom hook for react function component to act like class based state
import { useState } from "react";
const useSetState = <T>(
initialState: T
): [T, (newState: Partial<T>) => void] => {
const [state, regularSetState] = useState<T>(initialState);
const setState = (newState: Partial<T>) => {
regularSetState(prevState => ({
...prevState,
@austonpramodh
austonpramodh / gist:a3cd2e21e170704d7b3e74d2313ec571
Created March 28, 2020 18:49
SoftEther VPN for Ubuntu 16.04 & 18.04
## Credits https://gist.github.com/amanjuman/6a40d20be7e04d9986ccca14e4a3d3b4
sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get autoremove -y
sudo apt-get -y install build-essential wget curl gcc make wget tzdata git libreadline-dev libncurses-dev libssl-dev zlib1g-dev
wget https://github.com/SoftEtherVPN/SoftEtherVPN_Stable/releases/download/v4.34-9744-beta/softether-vpnserver-v4.34-9744-beta-2020.03.20-linux-x64-64bit.tar.gz
tar xzf softether-vpnserver-v4.34-9744-beta-2020.03.20-linux-x64-64bit.tar.gz && rm softether-vpnserver-v4.34-9744-beta-2020.03.20-linux-x64-64bit.tar.gz
cd vpnserver && sudo make
@austonpramodh
austonpramodh / Fakingoose.d.ts
Created March 18, 2020 20:15
Fakingoose Type declarations
type UnExtend<T, K> = Pick<T, Exclude<keyof T, keyof K>>;
declare module "fakingoose" {
import { Model, Document } from "mongoose";
interface Fakingoose<T> {
generate: () => UnExtend<T, Document> & { _id: string };
}
function fakingoose<T>(schema: Model<T & Document, {}>): Fakingoose<T>;
export = fakingoose;
}
<html>
<body>
<h1>Hello {{ firstName }} {{ lastName }}!</h1>
</body>
</html>
@austonpramodh
austonpramodh / docker-compose.yml
Created October 8, 2019 13:53
MySql, phpMyAdmin -Docker-compose.yml
version: "3.3"
services:
db:
image: mysql:latest
container_name: mySql
command:
[
"--character-set-server=utf8mb4",
"--collation-server=utf8mb4_unicode_ci",
"--default-authentication-plugin=mysql_native_password",
@austonpramodh
austonpramodh / generateSASToken.js
Created September 13, 2019 04:45
SAS Token generation - Azure Blob Storage
const {
BlobSASPermissions,
SharedKeyCredential,
generateBlobSASQueryParameters,
} = require("@azure/storage-blob");
const {
STORAGE_ACCOUNT_KEY,
STORAGE_ACCOUNT_NAME,
CONTAINERS,