Skip to content

Instantly share code, notes, and snippets.

View souvikhaldar's full-sized avatar
🌴
On vacation

Souvik Haldar souvikhaldar

🌴
On vacation
View GitHub Profile
@souvikhaldar
souvikhaldar / setupUbuntu.sh
Last active April 25, 2024 16:09
setup-ubuntu
#!env bash
sh -c "$(curl -fsLS chezmoi.io/get)"
sudo mv ./bin/chezmoi /usr/local/bin/
sudo snap install chezmoi --classic
sudo apt install git
mkdir -p ~/.local/share/
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
rsync -avzP --exclude .git souvik@souvikhaldar.in:~/.local/share/chezmoi ~/.local/share/
chezmoi apply
chezmoi cd
@souvikhaldar
souvikhaldar / redisSET.go
Created October 25, 2018 11:25
Setting key value pair in redis using go-redis
import "github.com/go-redis/redis"
// Client is setting connection with redis
var redisClient = redis.NewClient(&redis.Options{
Addr: "localhost:6379",
Password: "", // no password set
DB: 0, // use default DB
})
// SetValue sets the key value pair
func SetValue(key string, value string, expiry time.Duration) error {
{
"basics": {
"name": "Souvik Haldar",
"email": "souvikhaldar32@gmail.com",
"phone": "+91-8653149116",
"photo": {
"url": "https://cdn.rxresu.me/uploads/24594/201329/1666257221446.jpg",
"filters": {
"size": 128,
"shape": "square",
" install vim-plug
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
" Plug installed plugins
call plug#begin('~/.vim/plugged')
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin "arcticicestudio/nord-tmux"
set -g @plugin 'swaroopch/tmux-pomodoro'
# force Vi mode
# really you should export VISUAL or EDITOR environment variable, see manual
# Output warning on match but continue
warn:
- '(?i)user(name)?\W*[:=,]\W*.+$'
- '\/Users\/\w+\/'
# Fail immediately upon match
fail:
- '(?i)db_(user(name)?|pass(word)?|name)\W*[:=,]\W*.+$'
- '(?i)pass(word)?\W*[:=,]\W*.+$'
- '\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b'
@souvikhaldar
souvikhaldar / inf.go
Created April 24, 2021 19:07
interface in golang
package main
import "fmt"
type human interface {
walk()
talk()
}
type person struct {
firstName string
1. Install vim-plug `sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'`
2. clone `souvikhaldar/dotfiles` repo and run `copyToSystem.sh`.
2. Open `vimrc` file and do `:PlugInstall` (ignore the `autocmd` error the first time you open vimrc)
@souvikhaldar
souvikhaldar / map.go
Created July 28, 2020 18:48
Sort a map of string to int type, by decending order of the value of the map.
package main
func ConvertMapToKVSlice(m map[string]int) (kv []KV) {
for k, v := range m {
kv = append(kv, KV{k, v})
}
return
}
type KV struct {
@souvikhaldar
souvikhaldar / qr.py
Last active January 27, 2020 17:15
How to generate QR code of any text data in python3
# Importing the module pyqrcode
import pyqrcode
# data for the QR code
s = input("Enter the data to be put in the QR code: ")
# Generate QR code by the help of create function
url = pyqrcode.create(s)
# name of the geneated file
name = input("Enter name for the generated image file: ")
filename = name + ".svg"
url.svg(filename, scale = 8)