Skip to content

Instantly share code, notes, and snippets.

View thedevsaddam's full-sized avatar
🏴‍☠️
Wherever we want to go, we'll go!

Saddam H thedevsaddam

🏴‍☠️
Wherever we want to go, we'll go!
View GitHub Profile
@thedevsaddam
thedevsaddam / pget.go
Created March 10, 2020 07:56 — forked from montanaflynn/pget.go
Bounded Parallel Get Requests in Golang
package main
import (
"fmt"
"net/http"
"sort"
"time"
)
// a struct to hold the result from each request including an index
@thedevsaddam
thedevsaddam / rabbitmq-cluster.md
Created February 3, 2019 09:25 — forked from pobsuwan/rabbitmq-cluster.md
How to config rabbitmq server cluster [3 nodes]

How to config rabbitmq server cluster [3 nodes]

Do after install SLGInstallers

Edit /etc/hosts

vi /etc/hosts
192.168.10.157  rabbitmq-1
192.168.10.159  rabbitmq-2
192.168.10.161  rabbitmq-3
@thedevsaddam
thedevsaddam / getPassword.go
Created October 18, 2018 09:32 — forked from jlinoff/getPassword.go
Go code to prompt for password using only standard packages by utilizing syscall.ForkExec() and syscall.Wait4(), recovers from ^C gracefully.
// License: MIT Open Source
// Copyright (c) Joe Linoff 2016
// Go code to prompt for password using only standard packages by utilizing syscall.ForkExec() and syscall.Wait4().
// Correctly resets terminal echo after ^C interrupts.
package main
import (
"bufio"
"fmt"
"os"
@thedevsaddam
thedevsaddam / limitConcurrentGoroutines.go
Created June 5, 2018 05:54 — forked from AntoineAugusti/limitConcurrentGoroutines.go
Limit the maximum number of goroutines running at the same time
package main
import (
"flag"
"fmt"
"time"
)
// Fake a long and difficult work.
func DoWork() {
@thedevsaddam
thedevsaddam / redis_cheatsheet.bash
Created May 30, 2018 07:57 — forked from LeCoupa/redis_cheatsheet.bash
Redis Cheatsheet - Basic Commands You Must Know --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
# Redis Cheatsheet
# All the commands you need to know
redis-server /path/redis.conf # start redis with the related configuration file
redis-cli # opens a redis prompt
# Strings.
@thedevsaddam
thedevsaddam / mgoTestExample
Created January 31, 2018 12:20 — forked from laeshiny/mgoTestExample.go
mgo test example
package main
import (
"fmt"
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
"time"
)
type Content struct {
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
BINARY_NAME=mybinary
BINARY_UNIX=$(BINARY_NAME)_unix
@thedevsaddam
thedevsaddam / .gitattributes
Created December 28, 2017 05:49 — forked from M0nica/.gitattributes
Remove vendor files from GitHub's classification of the repositories language
static/* linguist-vendored
@thedevsaddam
thedevsaddam / strip.go
Created December 3, 2017 06:11 — forked from christopherhesse/strip.go
export stripTags from html/template as strip.StripTags
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package strip
import (
"bytes"
"encoding/json"
"fmt"
@thedevsaddam
thedevsaddam / multipart_upload.go
Created October 20, 2017 18:40 — forked from mattetti/multipart_upload.go
Example of doing a multipart upload in Go (golang)
package main
import (
"bytes"
"fmt"
"io"
"log"
"mime/multipart"
"net/http"
"os"