Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View junaidk's full-sized avatar

Junaid Khalid junaidk

  • Mirantis
  • Berlin
View GitHub Profile
@junaidk
junaidk / signedUrl.go
Last active January 4, 2019 11:19
get signed url for S3 object
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 October 14, 2017 14:24
ssh helper utility
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 July 7, 2023 04:55
Get List of EC2 instances from All regions
# 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

Keybase proof

I hereby claim:

  • I am junaidk on github.
  • I am junaidk (https://keybase.io/junaidk) on keybase.
  • I have a public key whose fingerprint is A8C1 F384 12DE CDE6 A761 F837 279E 502A 669B DD2C

To claim this, I am signing this object:

@junaidk
junaidk / show_wifi_clients.sh
Created October 28, 2016 09:48
Show Clients connected to Hotspot
#!/bin/bash
# show_wifi_clients.sh
# Shows MAC, IP address and any hostname info for all connected wifi devices
# written for openwrt 12.09 Attitude Adjustment
# modified by romano@rgtti.com from http://wiki.openwrt.org/doc/faq/faq.wireless#how.to.get.a.list.of.connected.clients
echo "# All connected wifi devices, with IP address,"
echo "# hostname (if available), and MAC address."
printf "# %-20s %-30s %-20s\n" "IP address" "lease name" "MAC address"
@junaidk
junaidk / gist:64ee1ef2677102101689
Last active September 9, 2015 13:40
.desktop file
[Desktop Entry]
Type=Application
Terminal=false
Name=Intellij Idea
Icon= path to icon
Exec= path to .sh file
-----------------

Developer Cheat Sheets

This are my cheat sheets that I have compiled over the years. Tired of searching Google for the same things, I started adding the information here. As time went on, this list has grown. I use this almost everyday and this Gist is the first bookmark on my list for quick and easy access.

I recommend that you compile your own list of cheat sheets as typing out the commands has been super helpful in allowing me to retain the information longer.

TxnID UserID TimeStampe ItemID Quantity UnitPrice
1 4122 17-09-2011 1:25 47 34 52.48
2 273 17-09-2011 1:53 278 24 82.62
3 3305 17-09-2011 1:55 183 50 52.49
4 3561 17-09-2011 9:37 343 46 55.94
5 1477 17-09-2011 10:07 313 44 56.19
6 1850 17-09-2011 11:30 361 22 89.13
7 1532 17-09-2011 11:48 304 22 78.63
8 3055 17-09-2011 15:16 174 41 39.46
9 1176 17-09-2011 17:40 130 32 73.18
@junaidk
junaidk / Unix.sh
Last active October 31, 2015 15:01
count character in each line of a file
# if number of occurrences of " , " is > 5 print the number
tr -d -c ',\n' < Users.csv | awk '{ if ( length >= 5) {print length;} }'
# if number of occurrences of " , " is > 5 print line number
tr -d -c ',\n' < Users.csv | awk '{ if ( length >= 5) {print NR;} }'
# read nth line from file
awk ' NR == 5' Users.csv
@junaidk
junaidk / user.md
Last active August 29, 2015 14:12
create user linux

create a new user

create user and add in group
sudo useradd -G 1000 user
make directory for user
mkdir /home/user