Skip to content

Instantly share code, notes, and snippets.

View tejasrsuthar's full-sized avatar
🏠
Working from home

Tejas Suthar tejasrsuthar

🏠
Working from home
  • Mobiquity Inc.
  • Ahmedabad
View GitHub Profile
@tejasrsuthar
tejasrsuthar / authorize.js
Created April 3, 2023 23:57 — forked from kndt84/authorize.js
Sample code: how to refresh session of Cognito User Pools with Node.js and Express
const AWS = require('aws-sdk');
const CognitoUserPool = require('amazon-cognito-identity-js-node').CognitoUserPool;
const CognitoUserSession = require('amazon-cognito-identity-js-node').CognitoUserSession;
const CognitoUser = require('amazon-cognito-identity-js-node').CognitoUser;
const CognitoIdToken = require('amazon-cognito-identity-js-node').CognitoIdToken;
const CognitoAccessToken = require('amazon-cognito-identity-js-node').CognitoAccessToken;
const CognitoRefreshToken = require('amazon-cognito-identity-js-node').CognitoRefreshToken;
const cfg = require('config').config;
const COGNITO_IDENTITY_POOL_ID = cfg.COGNITO_IDENTITY_POOL_ID;
@tejasrsuthar
tejasrsuthar / codility_solutions.txt
Created May 27, 2022 11:23 — forked from lalkmim/codility_solutions.txt
Codility Solutions in JavaScript
Lesson 1 - Iterations
- BinaryGap - https://codility.com/demo/results/trainingU2FQPQ-7Y4/
Lesson 2 - Arrays
- OddOccurrencesInArray - https://codility.com/demo/results/trainingFN5RVT-XQ4/
- CyclicRotation - https://codility.com/demo/results/trainingSH2W5R-RP5/
Lesson 3 - Time Complexity
- FrogJmp - https://codility.com/demo/results/training6KKWUD-BXJ/
- PermMissingElem - https://codility.com/demo/results/training58W4YJ-VHA/
@tejasrsuthar
tejasrsuthar / await-async.js
Created November 16, 2021 02:02 — forked from MichalZalecki/await-async.js
Run generators and and await/async
import axios from "axios";
export default async function () {
const { data: { id } } = await axios.get("//localhost:3000/id");
const { data: { group } } = await axios.get("//localhost:3000/group");
const { data: { name } } = await axios.get(`//localhost:3000/${group}/${id}`);
console.log(name); // Michał
}
@tejasrsuthar
tejasrsuthar / Trendrider.js
Created January 8, 2021 10:40
Trendrider - Pinescript - Tradingview
//@version=3
study(title="Wolf TrendRider v2 ", shorttitle="TrendRider", overlay=true)
// SLOW MA
len1 = input(50, minval=1, title="Slow EMA")
src1 = input(close, title="Source")
ma1 = sma(src1, len1)
maColor1 = ma1 > ma1[1] and close > ma1 ? green : ma1 < ma1[1] and close < ma1 ? red : yellow
@tejasrsuthar
tejasrsuthar / installing-postman.md
Created September 10, 2020 05:47 — forked from ba11b0y/installing-postman.md
Installing Postman on Ubuntu/Gnome

Since Chrome apps are now being deprecated. Download postman from https://dl.pstmn.io/download/latest/linux

Although I highly recommend using a snap

sudo snap install postman

Installing Postman

tar -xzf Postman-linux-x64-5.3.2.tar.gz
@tejasrsuthar
tejasrsuthar / install-firacode.sh
Created September 9, 2020 13:10 — forked from nikhita/install-firacode.sh
How to install FiraCode font on Linux
mkdir -p ~/.local/share/fonts
for type in Bold Light Medium Regular Retina; do wget -O ~/.local/share/fonts/FiraCode-$type.ttf "https://github.com/tonsky/FiraCode/blob/master/distr/ttf/FiraCode-$type.ttf?raw=true"; done
fc-cache -f
@tejasrsuthar
tejasrsuthar / setup-wifi.sh
Created September 9, 2020 13:05 — forked from glombard/setup-wifi.sh
Install wifi drivers for Ubuntu / Lubuntu 14.04 on Acer Aspire 5755G (Broadcom BCM43227 network controller)
# Determine wireless device model (manufacturer 14e4 for Broadcom):
lspci -vvnn | grep 14e4
# Install Broadcom STA driver for BCM43227:
sudo apt-get update
sudo apt-get install --reinstall linux-headers-generic build-essential dkms bcmwl-kernel-source
sudo modprobe -r b43 ssb wl brcmfmac brcmsmac bcma
sudo modprobe wl
# Connect (press Fn+F3 to enable wifi if necessary first):
@tejasrsuthar
tejasrsuthar / sortby.js
Created June 22, 2020 05:08
Normal Array of Objects sort by
const usCityOptions = cities
// Object sorting by key
.sort((a, b) => {
if(a.state < b.state){
return -1;
// a should come after b in the sorted order
}else if(a.state > b.state){
return 1;
// and and b are the same
}else{
@tejasrsuthar
tejasrsuthar / nginxproxy.md
Created June 12, 2020 02:13 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers