Skip to content

Instantly share code, notes, and snippets.

View murarisumit's full-sized avatar
🎩
Welcome here

Sumit Murari murarisumit

🎩
Welcome here
View GitHub Profile
@murarisumit
murarisumit / firefox_tricks.md
Last active June 3, 2018 07:19
Firefox tricks that I find useful.
  • Search from bookmarks only:

    1. Press F6 i.e. goto search/url bar
    2. Press *[_]search_text i.e. star space search_text
  • Restart the firefox without losing current tabs or context:

    1. Press Shift+f2, a shell at bottom of screen will show up.
    2. Type restart
  • Find your profile folder location from firefox itself.

    1. Press F6 i.e. goto search/url bar
@murarisumit
murarisumit / find_sed.sh
Created May 16, 2018 07:39
Change the string1 to string2 in files with given name param #bash #sed #gnu-utils
# change file content in all the given file
find . -type f -name '*file-name*' -exec sed -i 's/str1/str2/g' {} \;
@murarisumit
murarisumit / kms_decrypt.py
Created April 27, 2018 05:03
kms_decrypt #kms #aws
from base64 import b64decode
import boto3
unencrypted_url = "https://" + boto3.client('kms').decrypt(
CiphertextBlob=b64decode(config['encrypted_token']))['Plaintext'].decode('utf-8')
@murarisumit
murarisumit / get_recent_ami.tf
Last active April 26, 2018 03:54
terraform get latest ubuntu or amazon-linux ami #terraform #ami #ec2
data "aws_ami" "amazon_linux" {
most_recent = true
filter {
name = "name"
values = [
"amzn-ami-hvm-*-x86_64-gp2",
]
}
@murarisumit
murarisumit / kubernetes_namespace.md
Last active May 15, 2018 03:04
Kubernetes Namespace #kubernetes
  • Namespace are for logical division of resources in kubernetes.

  • Get all namespace:

    • kubectl get namespaces o kubectl get namespaces --show-labels

Creating namespaces

  • To create namespace:
    • Create json file namespace-dev with content:
@murarisumit
murarisumit / kubectl_cheatsheet.md
Last active August 19, 2018 21:24
kubectl cheatsheet #kubernetes
  • Label:

    • Labels are key/value pairs that are attached to objects, such as pods.
    • Labels can be attached to objects at creation time and subsequently added and modified at any time.
    • Each object can have a set of key/value labels defined. Each Key must be unique for a given object.
  • Service:

    • A Kubernetes Service is an abstraction which defines a logical set of Pods and a policy by which to access them - sometimes called a micro-service.
    • Behind a service, pods come and go with autoscaling but service is by which we communicate.
  • Namespace:

@murarisumit
murarisumit / docker_cheatsheet.md
Last active December 30, 2022 00:27
docker cheatsheet #docker #cheatsheet

Docker cheatsheet, usually has one-lines to delete containers.

  • Create a image from docker file: docker build -t image-name .
  • Run a container: docker run -it --name container-name image-name:latest
  • Run docker in backgroud: docker run --name container-name --hostname container-hostname -t -d container-name:latest
  • Connect to container: docker exec -it container_name bash
  • Remove all Exited containers: sudo docker ps -a | grep Exit | cut -d ' ' -f 1 | xargs sudo docker rm
  • Remove all dangling images: docker rmi $(docker images -f 'dangling=true' -q)
@murarisumit
murarisumit / docker_on_mac.md
Last active April 20, 2018 09:16
docker on mac #docker #docker-machine #virtualbox
  • On macOS the docker binary is only a client and you cannot use it to run the docker daemon, because Docker daemon uses Linux-specific kernel features, therefore you can’t run Docker natively in OS X.

  • So another tool was created, Docker-Machine, which creates a virtual machine (using yet another tool, e.g. Oracle VirtualBox), runs Docker on that VM, and helps coordinate between the host OS and the Docker VM.

  • Since Docker isn't running on your actual host OS, docker-machine needs to deal with IP addresses and ports and volumes and such. And its settings are saved in environment variables, which means you have to run commands like this every time you open a new shell.

  • To create a new docker machine : docker-machine create --driver virtualbox vm-name-here

@murarisumit
murarisumit / brew-cheatsheet.md
Created April 16, 2018 02:53
Brew cheatsheet #work-in-progress #brew #mac
  • List all packages : brew list
  • List all top-level packages: brew leaves
  • List packages with dependencies tree: brew deps --tree --installed

Do not update brew installed package, while installing other packages

  • Set export HOMEBREW_NO_AUTO_UPDATE=1
@murarisumit
murarisumit / irssi.markdown
Last active April 15, 2018 22:07
IRC #gnu/linux #irc #irssi

IRC Networks are made of servers, and servers have channels. The default config has a few predefined networks, to list them:

  • List network: /NETWORK LIST

  • Connect to one of network: /CONNECT oftc

  • To join channels: /JOIN #bash-completion

  • To highlight lines with your nickname: /HILIGHT nick or /SET hilight_nick_matches_everywhere ON