Skip to content

Instantly share code, notes, and snippets.

@shubhamoli
shubhamoli / delete_remote_merged.sh
Last active February 4, 2020 07:57
Remove Merged branches in remote
#!/bin/sh
// cut -d '/' -f 2- : this will remove "origin/" from output of first command
//
// I've excluded master, staging and development branches for safety
// But You can change this to suit your use-case
git branch -r --merged | cut -d ‘/’ -f 2- | grep -v ’master\|staging\|development’ | xargs git push --delete origin
@shubhamoli
shubhamoli / go-bootstrap
Last active March 9, 2020 09:57
Bootstrap Directory Structure for fresh GoLang project
#!/bin/sh
# Go project bootstrap file
# It creates required directory structure and files
#
# Author: Shubham Oli <oli.shubham@gmail.com>
# Date: 09-03-2020
# Inspired by: https://github.com/golang-standards/project-layout
# Rounded Corners - Python's pillow v7.1.1
# Ref: https://stackoverflow.com/a/11291419/7416198
from PIL import Image, ImageDraw
# im Image() Image object
# rad int radius of curve
def add_corners(im, rad):
circle = Image.new('L', (rad * 2, rad * 2), 0)
@shubhamoli
shubhamoli / todo.vim
Created June 18, 2020 09:58 — forked from huytd/todo.vim
A Todo list syntax in Vim, with an actual checkbox
" Vim syntax file
" Language: Todo
" Maintainer: Huy Tran
" Latest Revision: 14 June 2020
if exists("b:current_syntax")
finish
endif
" Custom conceal
@shubhamoli
shubhamoli / install-polybar.md
Created July 11, 2020 12:58 — forked from kuznero/install-polybar.md
Install polybar on Ubuntu 18.03

Polybar for i3

Installation in Ubuntu 18.04

sudo apt-get install \
  cmake cmake-data libcairo2-dev libxcb1-dev libxcb-ewmh-dev \
  libxcb-icccm4-dev libxcb-image0-dev libxcb-randr0-dev \
  libxcb-util0-dev libxcb-xkb-dev pkg-config python-xcbgen \
  xcb-proto libxcb-xrm-dev i3-wm libasound2-dev libmpdclient-dev \
@shubhamoli
shubhamoli / nginx_deployment.yaml
Created January 21, 2021 07:58 — forked from petitviolet/nginx_deployment.yaml
sample Nginx configuration on Kubernetes using ConfigMap to configure nginx.
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-conf
data:
nginx.conf: |
user nginx;
worker_processes 3;
error_log /var/log/nginx/error.log;
events {
@shubhamoli
shubhamoli / cloudflare-ddns-update.sh
Created April 3, 2021 18:38 — forked from Tras2/cloudflare-ddns-update.sh
A bash script to update a Cloudflare DNS A record with the external IP of the source machine
#!/bin/bash
# A bash script to update a Cloudflare DNS A record with the external IP of the source machine
# Used to provide DDNS service for my home
# Needs the DNS record pre-creating on Cloudflare
# Proxy - uncomment and provide details if using a proxy
#export https_proxy=http://<proxyuser>:<proxypassword>@<proxyip>:<proxyport>
# Cloudflare zone is the zone which holds the record
# Put this file in /etc/nginx/conf.d/ directory
# This will listen for media.<domain>.<tld>
# as it listens on 443 HTTPS Port so you'll also need SSL certificate for your domain.
server {
listen 80;
listen [::]:80;
server_name media.<domain>.<tld>;
return 301 https://$host$request_uri;
}
@shubhamoli
shubhamoli / optional-maps.tf
Created July 11, 2021 17:28
terraform optional keys in maps
locals {
required_value = {
RequiredValue = "${var.required}"
}
optional_value = {
exists = {
OptionalValue = "${var.optional}"
}
not_exists = {}