Skip to content

Instantly share code, notes, and snippets.

@junaidk
junaidk / README.md
Created February 18, 2021 07:31
GlusterFS with virtual disk

step 0

sudo apt-get install -y xfsprogs

sudo apt install software-properties-common sudo add-apt-repository ppa:gluster/glusterfs-7 sudo apt update sudo apt install -y glusterfs-server

step 1

sudo mkdir /mnt/disks

@junaidk
junaidk / Dockerfile
Created January 29, 2021 07:20
Jenkins Image with Docker
FROM jenkins/jenkins:2.263.1
USER root
RUN apt-get update && apt-get install -y sudo
RUN echo "jenkins ALL=NOPASSWD: ALL" >> /etc/sudoers
RUN apt-get install -y rsync && apt-get install -y curl
RUN curl -sSL https://get.docker.com/ | sh
RUN usermod -a -G staff jenkins
@junaidk
junaidk / overview.md
Last active March 2, 2020 07:51
Docker overview
  • Docker overview

    Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly.

    The Docker platform

    Docker provides the ability to package and run an application in a loosely isolated environment called a container. The isolation and security allow you to run many containers simultaneously on a given host. Containers are lightweight because they don’t need the extra load of a hypervisor, but run directly within the host machine’s kernel.

Docker provides tooling and a platform to manage the lifecycle of your containers:

@junaidk
junaidk / tunnel.md
Last active January 14, 2020 06:18
creat ssh tunnel
@junaidk
junaidk / deleteRole.sh
Created November 7, 2019 09:27
Delete Roles in AWS
for ROLEIN in $(cat remaining-roles-2 | jq -r ".Roles[] | .RoleName"); do
## filter role on pattern
ROLE=$(echo $ROLEIN | grep -E "\-SR|\-MR|M-CP-X|M-CP-Y")
if [ -z "$ROLE" ]
then
echo ""
else
echo role ${ROLE}
@junaidk
junaidk / KubectlCommands.md
Created November 7, 2019 09:25
Kubectl Commands

get pods

kubectl get pods -n cloudplex-system | grep $1- | awk '{print $1}'

delete pod

kubectl delete po $( getpo $1 )
@junaidk
junaidk / reddit-download.go
Last active January 11, 2021 15:15
Download images and videos from reddit saved posts
package main
import (
"fmt"
"github.com/anaskhan96/soup"
"github.com/dustin/go-humanize"
"io"
"io/ioutil"
"net/http"
"os"
for ROLEIN in $(cat remaining-roles-2 | jq -r ".Roles[] | .RoleName"); do
## filter role on pattern
ROLE=$(echo $ROLEIN | grep -E "\-SR|\-MR|M-CP-X|M-CP-Y")
if [ -z "$ROLE" ]
then
echo ""
else
echo role ${ROLE}
@junaidk
junaidk / go-remote.md
Last active August 31, 2019 13:29
go application remote debug
  • install dlv debugger inside build image

    RUN go get github.com/go-delve/delve/cmd/dlv

  • copy dlv to final docker image

    COPY --from=build-env /go/bin/dlv /app/dlv

  • build go binary with these flags

@junaidk
junaidk / deleteVPC.sh
Last active November 7, 2019 09:26
Delete vpc and its dependencies from AWS
#!/bin/bash
#name=${1:-docundotapvpc1}
#region=${2:-us-east-1}
#id=${1:-vpc-08343443447ef34b}
#aws ec2 describe-vpcs --region ${region} | jq -r ".Vpcs[] | select(.VpcId | contains(\"${id}\")) | .VpcId" 2>/dev/null |
name=testingnetwork
region=ap-southeast-1
aws ec2 describe-vpcs --region ${region} | jq -r ".Vpcs[] | select(.Tags[].Value | contains(\"${name}\")) | .VpcId" 2>/dev/null |