Skip to content

Instantly share code, notes, and snippets.

View manigandand's full-sized avatar
👨‍💻
Go, MongoDB, NodeJS, Kubernetes

Manigandan Dharmalingam manigandand

👨‍💻
Go, MongoDB, NodeJS, Kubernetes
View GitHub Profile
@manigandand
manigandand / .tmux.conf
Last active March 1, 2023 08:24
Mac Setup
set-window-option -g xterm-keys on
set default-terminal "screen-256color"
set -ga terminal-overrides ",xterm-256color*:Tc"
set-window-option -g mode-keys vi
# split panes using | and -
unbind '"'
unbind %
bind | split-window -h
bind - split-window -v
@manigandand
manigandand / slice_append.go
Created April 25, 2021 17:22
Slice: append vs set performance comparison
package main
import (
"fmt"
"reflect"
"strings"
"unsafe"
)
func main() {
@manigandand
manigandand / find_min_path.go
Created October 22, 2021 15:49
epifi problem statement: find shortest route
package main
import "fmt"
type Route struct {
routes []int
routesM map[int]bool
}
type track struct {
@manigandand
manigandand / coredev
Created October 21, 2021 09:10
go get private repo
#!/bin/bash
BRANCH=$1
if [ "$BRANCH" == "" ]; then
BRANCH=$(git branch | grep "*" | sed s,*\ *,,g)
fi
if [ "$BRANCH" == "" ]; then
echo -n "No branch found"
exit 22;
fi
GIT_HASH=$(git ls-remote git@github.com:gopherhut/core $BRANCH | awk -F' ' '{print $1}')
@manigandand
manigandand / list_directory.go
Last active August 6, 2021 18:22
List files in a directory using golang
package main
import (
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
)
@manigandand
manigandand / main.go
Last active April 29, 2021 20:23
Maximum common substring multi lang - codesignal test
import (
"strings"
"sort"
)
type meta struct {
count int
matchWords map[string]bool
}
@manigandand
manigandand / concurrency.go
Created January 28, 2020 06:28
simple buffered concurrency golang
package main
import (
"fmt"
"sync"
)
func main() {
input := []int{1, 2, 3, 4, 5}
in := make(chan int)
@manigandand
manigandand / word_count.go
Created November 19, 2019 14:12
find words count in a given string
// To execute Go code, please declare a func main() in a package "main"
package main
import (
"fmt"
// "strings"
)

Create a secrets file:

touch ~/.secret

Make sure it looks like this:

#!/bin/bash
@manigandand
manigandand / test.sh
Last active September 26, 2018 12:48
Tmuxinator & Shell script to automate deployment
#!/bin/sh
#
DEPENDENCY_XDOTOOL=xdotool
DEPENDENCY_TMUXINATOR=tmuxinator
# Dependencies:
if ! type "$DEPENDENCY_XDOTOOL" > /dev/null; then
echo "$DEPENDENCY_XDOTOOL not found. installing it..."
sudo apt install xdotool
fi
if ! type "$DEPENDENCY_TMUXINATOR" > /dev/null; then