Skip to content

Instantly share code, notes, and snippets.

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

Suman Saurabh sumanssaurabh

🏠
Working from home
View GitHub Profile
@echo off
"%~dp0mingw32-make.exe" %*
@sumanssaurabh
sumanssaurabh / nginxproxy.md
Created January 20, 2021 00:17 — 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

@sumanssaurabh
sumanssaurabh / iterate.js
Last active January 18, 2021 04:33
iterate loop without for loop
const arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
let counter = 0;
const len = arr.length;
const iterate = () => {
if (counter < len) {
console.log(arr[counter]);
counter = counter + 1;
iterate();
@sumanssaurabh
sumanssaurabh / clone.ps1
Created December 22, 2020 22:11
clone all public repos from github using powershell and git cli
[CmdletBinding()]
param (
[Parameter(Mandatory = $true, ParameterSetName = "name")]
[string]
$name
)
$api_url = "https://api.github.com/users/$($name)/repos?per_page=200"
$repos = Invoke-WebRequest -UseBasicParsing -Uri $api_url | ConvertFrom-Json
@sumanssaurabh
sumanssaurabh / semaphore.js
Created September 13, 2020 13:31 — forked from gregkorossy/semaphore.js
A simple implementation of a semaphore in JS
function Semaphore(max) {
var counter = 0;
var waiting = [];
var take = function() {
if (waiting.length > 0 && counter < max){
counter++;
let promise = waiting.shift();
promise.resolve();
}
Option Explicit
Dim objshell,path,DigitalID, Result
Set objshell = CreateObject("WScript.Shell")
'Set registry key path
Path = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\"
'Registry key value
DigitalID = objshell.RegRead(Path & "DigitalProductId")
Dim ProductName,ProductID,ProductKey,ProductData
'Get ProductName, ProductID, ProductKey
ProductName = "Product Name: " & objshell.RegRead(Path & "ProductName")
@sumanssaurabh
sumanssaurabh / download.py
Created February 13, 2020 18:35 — forked from mie00/download.py
pdf free books
# -*- coding: utf-8 -*-
import re
import urllib
from multiprocessing import Pool
import requests
import progressbar
CHUNK_SIZE = 1024 * 1024 # 1MB
def download(i):

Raspberry Pi VPN Router

This is a quick-and-dirty guide to setting up a Raspberry Pi as a "router on a stick" to PrivateInternetAccess VPN.

Requirements

Install Raspbian Jessie (2016-05-27-raspbian-jessie.img) to your Pi's sdcard.

Use the Raspberry Pi Configuration tool or sudo raspi-config to:

<?php
require 'db_config.php';
/**
* <?php
* $servername = "127.0.0.1";
* $username = "root";
* $password = "";
* $dbname = "myDB";
* ?>
@sumanssaurabh
sumanssaurabh / master-javascript-interview.md
Created April 3, 2019 18:03 — forked from Geoff-Ford/master-javascript-interview.md
Eric Elliott's Master the JavaScript Interview Series