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
  • 20:48 (UTC -12:00)
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 / 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 / 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

@tejasrsuthar
tejasrsuthar / logging.js
Created April 7, 2020 04:57
A simple node module that makes console.log/error/warn/debug statements log through winston (simply include at the beginning of your app)
'use strict';
var util = require('util'),
winston = require('winston'),
logger = new winston.Logger(),
production = (process.env.NODE_ENV || '').toLowerCase() === 'production';
module.exports = {
middleware: function(req, res, next){
console.info(req.method, req.url, res.statusCode);
@tejasrsuthar
tejasrsuthar / composing-software.md
Created May 22, 2019 06:59 — forked from rosario/composing-software.md
Eric Elliott's Composing Software Series