Skip to content

Instantly share code, notes, and snippets.

View thesaadarshad's full-sized avatar
💭
おめでとう

saad. thesaadarshad

💭
おめでとう
View GitHub Profile
@thesaadarshad
thesaadarshad / codes.json
Last active February 7, 2018 14:07
country code list
[{"country":"United States of America (US)","code":"01"},{"country":"United Kingdom (UK)","code":"02"},{"country":"Canada (CA)","code":"03"},{"country":"Germany (DE)","code":"04"},{"country":"Netherlands (NL)","code":"05"},{"country":"Sweden (SE)","code":"06"},{"country":"Romania (RO)","code":"07"},{"country":"Switzerland (CH)","code":"08"},{"country":"Panama (PA)","code":"09"},{"country":"Russia (RU)","code":"10"},{"country":"Malaysia (MY)","code":"11"},{"country":"Singapore (SG)","code":"12"},{"country":"Ireland (IE)","code":"13"},{"country":"Luxembourg (LU)","code":"14"},{"country":"Australia (AU)","code":"15"},{"country":"Turkey (TR)","code":"16"},{"country":"France (FR)","code":"17"},{"country":"Brazil (BR)","code":"18"},{"country":"Costa Rica (CR)","code":"19"},{"country":"Hungary (HU)","code":"20"},{"country":"Egypt (EG)","code":"21"},{"country":"Latvia (LV)","code":"22"},{"country":"Ukraine (UA)","code":"23"},{"country":"Hong Kong (HK)","code":"24"},{"country":"Italy (IT)","code":"25"},{"country":"Bul

Keybase proof

I hereby claim:

  • I am thesaadarshad on github.
  • I am thesaadarshad (https://keybase.io/thesaadarshad) on keybase.
  • I have a public key whose fingerprint is EC8A 9E36 2687 E9FB 6A94 B296 E114 2F9B AE3D 5330

To claim this, I am signing this object:

@thesaadarshad
thesaadarshad / iptables.sh
Created March 28, 2018 08:23
bootstrap iptable rules
#!/bin/bash
#!/bin/bash
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -F -t nat
iptables -F -t mangle
iptables -F
@thesaadarshad
thesaadarshad / python-requests.py
Last active March 28, 2018 08:40
Python Curl Request Json
#!/usr/bin/python
import requests
import json
import re
url = "https://reqres.in/api/users"
querystring = { "demovar": "testvalue" }
headers = { 'auth': "FGtbAXGT4QbBLQj97j2P" }
@thesaadarshad
thesaadarshad / datetime.py
Last active March 31, 2018 15:01
python datetime
import datetime
now = datetime.datetime.now()
print
print "Current date and time using str method of datetime object:"
print str(now)
print
print "Current date and time using instance attributes:"
@thesaadarshad
thesaadarshad / web-servers.md
Created December 24, 2018 13:16 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC/0AC9TYx37Mdg8yi8Uju1s3tW1a5mkc9MxSICVCFYAyEhUcCclVJ9qZtpLj98I0xV6FMTeMpb7XH1m2jQfhNYL/RMHQBsrZ7D7ey/hYx+7jKImS66MCFH4KPfpJGCaDxnAqYz0Bjbb7+9EHgVo0DV/B/xQ6yyhLYVMpDOdmbDrfyBcD3modsecaSllIHnkNdcX3yklVnbwxyNjfBKNoVbZBanFIofr5Me+/uFKKAkLHbCiUkFTjTE2NxsWiHTQCE7Nfm9/ZHvBQGZAmlmP4ZCIYAspgO0MPjoz8kUWXXtm0ZewSu22NAHxHZNs8hVT7/aFC5NGIApv5E5JKawbNk9 root@saadmachine
@thesaadarshad
thesaadarshad / run.py
Created January 26, 2020 19:22
python image resize with ratio
#!/usr/bin/env python
import PIL
from PIL import Image
import os, sys
mywidth = 1200
path = "/pathtofolder/"
dirs = os.listdir( path )
@thesaadarshad
thesaadarshad / run.py
Last active September 18, 2022 10:04
pictures_downscale
from PIL import Image
import os
from pathlib import Path
import PIL
def convert(filepath,fixed_height=1200):
path = Path(filepath)
filename = filepath.split("/")[-1:][0]
newfilebasefolder = path.parent.absolute()
newfilename = str(newfilebasefolder)+"/"+filename
################################# KUBERNETES CHEAT SHEET #############################################
########### VIEWING RESOURCE INFORMATION ###############
# nodes
kubectl get no
kubectl get no -o wide
kubectl describe no
kubectl get no -o yaml
kubectl get node --selector=[label_name]
kubectl get nodes -o jsonpath='{.items[*].status.addresses[?(@.type=="ExternalIP")].address}'