Skip to content

Instantly share code, notes, and snippets.

@atreya2011
atreya2011 / main.go
Created November 3, 2020 08:02
Go Context Example
package main
import (
"context"
"fmt"
"time"
)
func main() {
ctx := context.Background()
@atreya2011
atreya2011 / .zshrc
Created October 13, 2020 01:21 — forked from thisivan/.zshrc
Enable Vim mode in ZSH
# Enable Vim mode in ZSH
bindkey -v
autoload -U edit-command-line
zle -N edit-command-line
bindkey '^E' edit-command-line # Opens Vim to edit current command line
bindkey '^R' history-incremental-search-backward # Perform backward search in command line history
bindkey '^S' history-incremental-search-forward # Perform forward search in command line history
bindkey '^P' history-search-backward # Go back/search in history (autocomplete)
bindkey '^N' history-search-forward # Go forward/search in history (autocomplete)
@atreya2011
atreya2011 / mysql-docker.sh
Created October 11, 2020 08:34 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@atreya2011
atreya2011 / main.go
Created September 20, 2019 11:45 — forked from prantoran/main.go
graceful-server
package main
import (
"context"
"fmt"
"log"
"net/http"
"os"
"os/signal"
"time"