This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Usage: cas-get.sh {url} {username} {password} # If you have any errors try removing the redirects to get more information | |
# The service to be called, and a url-encoded version (the url encoding isn't perfect, if you're encoding complex stuff you may wish to replace with a different method) | |
DEST="$1" | |
ENCODED_DEST=`echo "$DEST" | perl -p -e 's/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg' | sed 's/%2E/./g' | sed 's/%0A//g'` | |
#IP Addresses or hostnames are fine here | |
CAS_HOSTNAME="login.iiit.ac.in" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/python3 | |
import re | |
from pprint import pprint | |
# Parameters | |
in_file = "nw-metrics" | |
out_file = "nw-parsed" | |
delimiters = '["\n ]' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Change file names here | |
PRIMARY=primary.ovpn | |
BACKUP=backup.ovpn | |
# Trap signal handler | |
trap_end() { | |
sudo rm .tmp-pass | |
exit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Credit: https://unix.stackexchange.com/a/397914/469786 | |
# https://askubuntu.com/questions/902998/how-to-check-which-tty-im-currently-using | |
# | |
# This command is useful when ssh connection drops and the ssh sessions still presist. | |
function kssh { | |
allshs=$(w | tail -n+3 | awk '{print $2}') | |
curshs=$(who am i | head -n1 | awk '{print $2}') |