Skip to content

Instantly share code, notes, and snippets.

View yogeshnarayanan's full-sized avatar

Yogesh Narayanan yogeshnarayanan

View GitHub Profile
@yogeshnarayanan
yogeshnarayanan / limit-goroutines.go
Created December 5, 2017 07:13
Limiting number of goroutines (concurrency) in golang
concurrency := 10 // 10 is max concurrency
sem := make(chan bool, concurrency)
urls := []string{"url1", "url2"}
for _, url := range urls {
sem <- true // mark one as running (will block when full)
go func(url) {
defer func() { <-sem }() // mark one as completed
// Do something with the url
}(url)
}
@yogeshnarayanan
yogeshnarayanan / jsconfig.json
Created September 14, 2018 19:19
VSCode jsconfig.json to support Absolute path navigation in React project
{
"compilerOptions": {
"baseUrl": "./src/",
"target": "es6",
"jsx": "react",
"module": "commonjs"
},
"include": ["src/**/*"]
}
@yogeshnarayanan
yogeshnarayanan / git-repo-mirror.sh
Created December 6, 2018 05:58
Git Command to move repository origin
git clone --bare https://github.com/exampleuser/old-repository.git
cd old-repository.git
git push --mirror https://github.com/exampleuser/new-repository.git
@yogeshnarayanan
yogeshnarayanan / google_form_whatsapp_template_message.js
Last active August 21, 2023 12:50
Google Form <> Gallabox WhatsApp Template Message
const GENERIC_WEBHOOK_URL = "XXXXXXX";
// Pick the Webhook Url from
// https://app.gallabox.com/integration/genericWebhook
function sendPostRequest(e) {
var resp = {};
var itemResponses = e.response.getItemResponses();
for (var j = 0; j < itemResponses.length; j++) {
var itemResponse = itemResponses[j];