Skip to content

Instantly share code, notes, and snippets.

junaidk

Block or report user

Report or block junaidk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@junaidk
junaidk / tunnel.md
Last active Jan 14, 2020
creat ssh tunnel
View tunnel.md
@junaidk
junaidk / deleteRole.sh
Created Nov 7, 2019
Delete Roles in AWS
View deleteRole.sh
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}
View KubectlCommands.md

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 Jan 19, 2020
Download images and videos from reddit saved posts
View reddit-download.go
package main
import (
"fmt"
"github.com/anaskhan96/soup"
"github.com/dustin/go-humanize"
"io"
"io/ioutil"
"net/http"
"os"
View deleteRoles.sh
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 Aug 31, 2019
go application remote debug
View go-remote.md
  • 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 Nov 7, 2019
Delete vpc and its dependencies from AWS
View deleteVPC.sh
#!/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 |
@junaidk
junaidk / signedUrl.go
Last active Jan 4, 2019
get signed url for S3 object
View signedUrl.go
package main
import (
"cluster-manager/constants"
"crypto/tls"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/urfave/cli"
@junaidk
junaidk / server.txt
Created Oct 14, 2017
ssh helper utility
View server.txt
srv1 = ssh -i key-file-path ubuntu@10.10.10.10
srv2 = ssh -i key-file-path ubuntu@10.10.10.11
srv3 = ssh -i key-file-path ubuntu@10.10.10.12
@junaidk
junaidk / ec2.sh
Last active Jan 19, 2020
Get List of EC2 instances from All regions
View ec2.sh
# install aws cli first and configure it with credentials and default region
# the script will iterate over all regions of AWS
for region in `aws ec2 describe-regions --output text | cut -f4`
do
echo -e "\nListing Instances in region:'$region'..."
aws ec2 describe-instances --query "Reservations[*].Instances[*].{IP:PublicIpAddress,ID:InstanceId,Type:InstanceType,State:State.Name,Name:Tags[0].Value}" --output=table --region $region
done
You can’t perform that action at this time.