Skip to content

Instantly share code, notes, and snippets.

View JavadBahoosh's full-sized avatar

Javad Bahoosh JavadBahoosh

View GitHub Profile
@JavadBahoosh
JavadBahoosh / myiplocatiom.py
Created November 24, 2018 09:19
Get public ip and origin country in terminal
#! /usr/bin/python3
import os
import urllib.request
import json
ip = os.popen("dig TXT +short o-o.myaddr.l.google.com @ns1.google.com | awk -F'\"' '{ print $2}'").readlines(-1)[0].strip()
response = urllib.request.urlopen('http://ipinfo.io/{}/'.format(ip)).read()
print(json.dumps(json.loads(response), indent=2))
@JavadBahoosh
JavadBahoosh / my-public-ip.sh
Created October 21, 2018 08:25
this script lookup TXT record from o-o.myaddr.l.google.com and return your public IP address on the internet
#!/bin/bash
myip="$(dig TXT +short o-o.myaddr.l.google.com @ns1.google.com | awk -F'"' '{ print $2}')"
echo "My WAN/Public IP address: ${myip}"
@JavadBahoosh
JavadBahoosh / openconnect-vpn.sh
Last active May 19, 2020 08:42
this script start/stop openconnect in the background with provided configuration.
#!/bin/bash
username="filan"
password="bahman"
url="bisar.com"
cert="sha256:1234567890xxxxxxxxxxxxxxxxx"
pidfile="/home/filani/vpn-pid"
case "$1" in
start)
@JavadBahoosh
JavadBahoosh / avd.sh
Created August 19, 2017 05:25
A bash script for start android virtual device with optimum settings in ubuntu
#!/bin/bash
ANDROID_HOME=/home/javad/Android/Sdk
AVD_NAME=Nexus_6_API_23
if [ $# -gt 0 ]; then
AVD_NAME=$1
shift
fi