Skip to content

Instantly share code, notes, and snippets.

Avatar
🌴
On vacation

Souvik Haldar souvikhaldar

🌴
On vacation
View GitHub Profile
View gist:5dbfac7e93dcb3018c5ade677f9da9e1
" 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' }
View gist:132a2d45ff03b9fb0d3fe3a1534b6ecf
# 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
View gist:e40f83b026ea04522a7993dda5785ed3
# 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 Apr 24, 2021
interface in golang
View inf.go
package main
import "fmt"
type human interface {
walk()
talk()
}
type person struct {
firstName string
View gist:005c5ac101df30ee5dd6edae487a900f
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 Jul 28, 2020
Sort a map of string to int type, by decending order of the value of the map.
View map.go
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 Jan 27, 2020
How to generate QR code of any text data in python3
View qr.py
# 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)
View nodeExporterPromConfig
scrape_configs:
- job_name: 'node'
static_configs:
- targets: ['<TARGET_IP>:9100']
View prometheusConfig
global:
scrape_interval: 15s
# By default, scrape targets every 15 seconds.
# Attach these labels to any time series or alerts when communicating with
# external systems (federation, remote storage, Alertmanager).
external_labels:
monitor: 'codelab-monitor'
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
View prometheusUnitFile
[Unit]
Description=Prometheus
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
ExecStart=/usr/local/bin/prometheus --config.file=/etc/prometheus.yml
[Install]
WantedBy=multi-user.target