Skip to content

Instantly share code, notes, and snippets.

View swarupdonepudi's full-sized avatar
🎯
Focusing

Swarup Donepudi swarupdonepudi

🎯
Focusing
View GitHub Profile
@swarupdonepudi
swarupdonepudi / bash-new.sh
Created February 13, 2020 04:00
New bash programs
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
# Set magic variables for current file & dir
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
echo "info : __dir is ${__dir}"
__file="${__dir}/$(basename "${BASH_SOURCE[0]}")"
echo "info : __file is ${__file}"
@swarupdonepudi
swarupdonepudi / varnish-commands.md
Last active June 20, 2019 21:16
varnish-commands

list vcls

varnishadm -n /var/run/varnish-home vcl.list

Show a full vcl

varnishadm -n /var/run/varnish-home vcl.show <vcl-id>

Compile a vcl on varnish - make sure to provide absolute path

@swarupdonepudi
swarupdonepudi / keybase.sh
Created May 9, 2019 00:36
Terraform output keybase key
terraform output -json | jq --raw-output '."aws-iam_creds-iam_admin".value.encrypted_secret'| base64 -D | keybase pgp decrypt
@swarupdonepudi
swarupdonepudi / pri-to-pub.sh
Created May 8, 2019 23:08
Command to create a public key from private key
ssh-keygen -yf private-key.pem > public-key.pub

Keybase proof

I hereby claim:

  • I am swarupdonepudi on github.
  • I am swarupdonepudi (https://keybase.io/swarupdonepudi) on keybase.
  • I have a public key whose fingerprint is 5F27 22C1 EFD3 E109 3DDB 94EC 2713 5434 9AF7 F01D

To claim this, I am signing this object:

@swarupdonepudi
swarupdonepudi / git-clone-browser-url.sh
Last active February 5, 2019 20:49
git clone using browser url
#copy the below script to your local machine
#create an alias for this script and put it in your profile load file like ~/.zshrc or ~/.bashrc
function clone() {
echo ${1} > clone-url
hostname=$(perl -F'/' -lane 'print $F[2]' clone-url)
hn_github="github.com"
if [[ "$hostname" == ${hn_github} ]];
then
#browser url: https://github.com/swarupdonepudi/hypriot-k8s-userdata
#ssh url: git@github.com:swarupdonepudi/hypriot-k8s-userdata.git
@swarupdonepudi
swarupdonepudi / dns-resolver.py
Created June 28, 2018 04:33
Python DNS Resolver
import dns.resolver
my_resolver = dns.resolver.Resolver()
for data in my_resolver.query("test.db.cforcoins.com", 'cname'):
print(data.target)
Output :
test-db-cluster.cluster-criapcajhism.ap-south-1.rds.amazonaws.com.
@swarupdonepudi
swarupdonepudi / flush-dns.sh
Created May 23, 2018 14:47
Flush DNS cache on MacOS via Terminal
sudo killall -HUP mDNSResponder
@swarupdonepudi
swarupdonepudi / cors-check-using-curl.sh
Created May 5, 2018 23:47
Checking for CORS using curl
curl -H "Origin: https://<origin-host-utl>" \
-H "Access-Control-Request-Method: GET" \
-H "Access-Control-Request-Headers: X-Requested-With" \
-X OPTIONS --verbose \
https://<target-url>
@swarupdonepudi
swarupdonepudi / st-to-string.java
Created April 19, 2018 14:55
Converting Java stack trace to a string
public static String convertStackTraceToString(Exception e) {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
return sw.toString();
}