Add shared shell files to shared directory
This commit is contained in:
parent
f17a01625f
commit
83adf42719
5 changed files with 2 additions and 2 deletions
161
shells/shared/aliases
Normal file
161
shells/shared/aliases
Normal file
|
@ -0,0 +1,161 @@
|
|||
# These alow me to easily set the file and folder permissions for a wordpress instilation.
|
||||
alias folder-perms='find . -type d -not -path "./.git/*" -not -path "./.git" -not -path "./node_modules/*" -not -path "./node_modules" -not -perm 775 -exec chmod 775 {} \;'
|
||||
alias file-perms='find . -type f -not -path "./.git/*" -not -path "./.git" -not -path "./node_modules/*" -not -path "./node_modules" -not -perm 664 -exec chmod 664 {} \;'
|
||||
alias wp-perms='folder-perms; file-perms'
|
||||
alias magentoPerms='cd ${PWD%/public_html*}/public_html;sudo chown -R jonathan:http .; folder-perms; file-perms; chmod +x bin/*; cd -'
|
||||
alias upgr='magento setup:upgrade && magento setup:di:compile && magentoPerms'
|
||||
#
|
||||
# Make ls add Indicator#s to file names and colour the output
|
||||
alias ls='ls -F --color=auto'
|
||||
|
||||
# Make tree add indicators and color
|
||||
alias tree='tree -F -C'
|
||||
|
||||
# Make qmv open on 1 column mode
|
||||
alias qmv='qmv -f do'
|
||||
|
||||
alias msfconsole="msfconsole --quiet -x \"db_connect msf@msf\""
|
||||
|
||||
#Start cups
|
||||
alias cups='sudo systemctl start org.cups.cupsd.service'
|
||||
|
||||
#Start network manager
|
||||
alias net='sudo systemctl start NetworkManager.service'
|
||||
|
||||
# Alias lampp because I don't want to clog my PATH
|
||||
alias lampp='/opt/lampp/lampp'
|
||||
alias glampp='gksudo /opt/lampp/manager-linux-x64.run'
|
||||
alias php='/opt/lampp/bin/php'
|
||||
alias php-cgi='/opt/lampp/bin/php-cgi'
|
||||
alias php-config='/opt/lampp/bin/php-config'
|
||||
|
||||
#Always make all directories necesary
|
||||
alias mkdir='mkdir -p'
|
||||
|
||||
# Shortcut for rewriting wp permalinks
|
||||
alias perms='wp rewrite flush'
|
||||
|
||||
#Clear terminal and try to get moon phase. If it takes longer than .5 seconds then it will show neofetch
|
||||
alias cls='clear; timeout 0.5s weather moon || neofetch'
|
||||
|
||||
#An alias for my standard less configuration
|
||||
#I don't set it to lessc because sometimes I don't use this config and I always forget how to ignore an alias
|
||||
#alias myless='lessc --clean-css --source-map-basepath=/home/jonathan/Sites/charts/public_html --source-map --autoprefix="last 3 versions, ie >= 9" styles.less styles.min.css'
|
||||
alias myless='lessc --clean-css --source-map --autoprefix="last 3 versions, ie >= 11" styles.less styles.min.css'
|
||||
|
||||
# Git shortcuts
|
||||
alias status='git status '
|
||||
alias st='git status'
|
||||
alias checkout='git checkout'
|
||||
alias ch='git checkout'
|
||||
alias push='git push '
|
||||
alias pull='git pull '
|
||||
alias bb='git open'
|
||||
alias merge='git merge'
|
||||
alias mg='git merge'
|
||||
|
||||
# Always make grep ouput color
|
||||
alias grep="grep --color=auto"
|
||||
|
||||
# Shortcuts to sites folder
|
||||
alias sites="cd ~/Sites"
|
||||
alias s="cd ~/Sites"
|
||||
|
||||
# Shortcuts to documents folder
|
||||
alias documents="cd ~/Documents/"
|
||||
alias d="cd ~/Documents/"
|
||||
|
||||
# Shortcuts to hack the box folder
|
||||
alias htb="cd ~/Documents/htb/"
|
||||
|
||||
# Shortcuts to documents folder
|
||||
alias db="cd ~/Dropbox/"
|
||||
|
||||
# Shortcuts to home folder
|
||||
alias home="cd ~/"
|
||||
alias ~="cd ~/"
|
||||
|
||||
#Goes up to the public_html folder
|
||||
alias ph='cd ${${PWD%/public_html*}%/wiki*}/public_html'
|
||||
alias wiki='cd ${${PWD%/public_html*}%/wiki*}/wiki'
|
||||
|
||||
#Edit wp-config.php using $EDITOR
|
||||
alias conf='$EDITOR ${PWD%/public_html*}/public_html/wp-config.php'
|
||||
|
||||
# Quit the terminal using :q (The same as Vi/Vim)
|
||||
alias :q='exit;'
|
||||
alias q='exit;'
|
||||
|
||||
# Not sure why and how but this makes sudo work with my aliases
|
||||
alias sudo='sudo '
|
||||
|
||||
#Make the cal command default to start on Sunday
|
||||
alias cal='cal -s'
|
||||
|
||||
# update the third party wordpress plugins we are mirroring
|
||||
alias u3p='update3rdPartyPlugins'
|
||||
|
||||
# Edit my bashrc
|
||||
alias brc='$EDITOR ~/.bashrc'
|
||||
|
||||
# Edit my vimrc
|
||||
alias vrc='$EDITOR ~/.vimrc'
|
||||
|
||||
# Go to my .vim folder
|
||||
alias .v='cd ~/.vim/'
|
||||
|
||||
alias df='cd ~/.dotfiles'
|
||||
|
||||
#Make vim start in server mode
|
||||
alias vim='vim --servername jab2870'
|
||||
|
||||
# moon phase
|
||||
alias moonphase='weather moon'
|
||||
|
||||
#Get arch news
|
||||
alias archNews='w3m https://www.archlinux.org/ | sed -n "/Latest News/,/Older News/ p" | head -n -1 | less'
|
||||
|
||||
#Radio Stations
|
||||
AUDIO="mpv --input-ipc-server=/tmp/mpvsocket"
|
||||
alias radio2="$AUDIO http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/sbr_med/llnw/bbc_radio_two.m3u8"
|
||||
alias radio4="$AUDIO http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/sbr_med/llnw/bbc_radio_fourfm.m3u8"
|
||||
alias classic="$AUDIO http://icy-e-bab-04-cr.sharp-stream.com/absoluteradio.mp3"
|
||||
alias absolute="$AUDIO 'http://network.absoluteradio.co.uk/core/audio/mp3/live.pls?service=vrbb'"
|
||||
alias magic="$AUDIO 'http://www.radiofeeds.co.uk/bauer.pls?station=magicnational.mp3.m3u'"
|
||||
|
||||
alias bs="curl -s http://cbsg.sourceforge.net/cgi-bin/live | grep -Eo '^<li>.*</li>' | sed -r -e 's/<\/?li>//g' | shuf -n 1 | cowsay"
|
||||
|
||||
alias jq="jq -C"
|
||||
|
||||
alias debugBuild='node --inspect-brk /usr/bin/grunt build'
|
||||
|
||||
alias lc="colorls -r"
|
||||
|
||||
alias open="$TERMINAL & disown"
|
||||
|
||||
#audiable to mp3
|
||||
alias aa2mp3='ffmpeg -f concat -safe 0 -i <(for f in *.aa; do echo "file '"'"'$(pwd)/$f'"'"'";done) output.mp3'
|
||||
|
||||
# Fix Typos
|
||||
alias cim="vim"
|
||||
alias vom="vim"
|
||||
alias vin="vim"
|
||||
alias vi="vim"
|
||||
alias v="vim"
|
||||
|
||||
#Servers Memory
|
||||
alias servermem='toilet -w 200 "VPS 01" && ssh shires free -h && toilet -w 200 "VPS 02" && ssh abc free -h && toilet -w 200 "VPS 03" && ssh cdc2 free -h && toilet -w 200 "VPS 04" && ssh blacksheep free -h && toilet -w 200 "Freightliner" && ssh freightliner free -h && toilet -w 200 "NHS" && ssh nhs free -h'
|
||||
|
||||
# Updates time using ntp
|
||||
alias updateTime="sudo ntpd -qg"
|
||||
|
||||
# Keyboard - reset
|
||||
# Sometimes, if I turn the screens off, the keyboard resets itself to defaults. Not sure why but this will put my keyboard back to how I like it
|
||||
alias kb="xmodmap ~/.Xmodmap; xset r rate 200 70; xcape"
|
||||
|
||||
alias colemak="setxkbmap -layout gb,gb -variant \"colemak,\" -option grp:shifts_toggle"
|
||||
alias qwerty="setxkbmap -layout gb"
|
||||
|
||||
alias ol="open-local"
|
||||
|
||||
alias globalip="drill myip.opendns.com @resolver1.opendns.com | sed -n '/ANSWER SECTION/,/AUTHORITY SECTION/ p' | sed -n '2 p' | awk '{print \$5}'"
|
240
shells/shared/functions
Normal file
240
shells/shared/functions
Normal file
|
@ -0,0 +1,240 @@
|
|||
function big-chromium () {
|
||||
chromium --force-device-scale-factor=$1
|
||||
}
|
||||
|
||||
function big-new-chromium () {
|
||||
chromium-snapshot-bin --force-device-scale-factor=$1
|
||||
}
|
||||
|
||||
# make xclip work as I would expect. Copy to clipboard if piped data. Paste from otherwise
|
||||
function clip(){
|
||||
if command -v /usr/bin/xclip 1>/dev/null; then
|
||||
if [[ -p /dev/stdin ]] ; then
|
||||
# stdin is a pipe
|
||||
# stdin -> clipboard
|
||||
/usr/bin/xclip -i -selection clipboard
|
||||
else
|
||||
# stdin is not a pipe
|
||||
# clipboard -> stdout
|
||||
/usr/bin/xclip -o -selection clipboard
|
||||
fi
|
||||
else
|
||||
echo "Remember to install xclip"
|
||||
fi
|
||||
}
|
||||
|
||||
#Swap two files
|
||||
function swap() {
|
||||
mv $1 $1._tmp;
|
||||
mv $2 $1;
|
||||
mv $1._tmp $2;
|
||||
}
|
||||
|
||||
function old() {
|
||||
mv "$1" "$1.old"
|
||||
}
|
||||
|
||||
function mycd() {
|
||||
cd "$@" 2> /dev/null
|
||||
if [ $? = 0 ]; then
|
||||
# If we get here cd was successful
|
||||
#if [ ! $TMUX ]; then
|
||||
# pwd > ~/.current-folder
|
||||
#fi
|
||||
ls
|
||||
else
|
||||
# If we get here, cd was not successful
|
||||
if [ -f "$1" ]; then
|
||||
$EDITOR "$1"
|
||||
else
|
||||
echo "Can't cd"
|
||||
fi
|
||||
fi
|
||||
updatePath
|
||||
}
|
||||
alias cd="mycd"
|
||||
|
||||
function mkcd() {
|
||||
mkdir -p "$1"
|
||||
cd "$1"
|
||||
}
|
||||
|
||||
function createLetter(){
|
||||
if [ "$1" ]; then
|
||||
if [ "$2" ]; then
|
||||
newFile="$2"
|
||||
else
|
||||
newFile="$1"
|
||||
newFile="${newFile%.*}.pdf"
|
||||
fi
|
||||
pandoc --template template-letter.tex $1 -o $newFile
|
||||
else
|
||||
echo "Oops. You need to suply a file"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function createFPLreport(){
|
||||
if [ "$1" ]; then
|
||||
if [ "$2" ]; then
|
||||
newFile="$2"
|
||||
else
|
||||
newFile="$1"
|
||||
newFile="${newFile%.*}.pdf"
|
||||
fi
|
||||
pandoc --template fellowship.latex --listings --highlight-style=pygments --pdf-engine=xelatex $1 -o $newFile
|
||||
else
|
||||
echo "Oops. You need to suply a file"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
#Takes you to the parent theme
|
||||
function ptheme() {
|
||||
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"
|
||||
theme=$(dirname $(wp --path="$wpPath" --url="$domain" theme path $(wp --path="$wpPath" --url="$domain" theme list 2> /dev/null | grep "parent" | awk '{print $1}') 2> /dev/null ))
|
||||
if [ -d $theme ]; then
|
||||
if [ -d "$theme" ]; then
|
||||
cd $theme
|
||||
else
|
||||
echo " Can't find theme folder "
|
||||
fi
|
||||
else
|
||||
echo " Can't find theme folder "
|
||||
fi
|
||||
else
|
||||
echo " Can't find public_html folder."
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#Takes you to the child theme
|
||||
function theme() {
|
||||
if [ ! -z "$1" ]; then
|
||||
ctheme=$(getthemepath "$1" 2> /dev/null)
|
||||
else
|
||||
ctheme=$(getthemepath 2> /dev/null)
|
||||
fi
|
||||
if [ ! -z "$ctheme" ]; then
|
||||
cd $ctheme
|
||||
fi
|
||||
}
|
||||
|
||||
#Takes you to the js folder child theme
|
||||
function js() {
|
||||
ctheme=$(getthemepath)
|
||||
if [ ! -z "$ctheme" ]; then
|
||||
cd $ctheme/js
|
||||
fi
|
||||
}
|
||||
|
||||
#Takes you to the css folder child theme
|
||||
function css() {
|
||||
ctheme=$(getthemepath)
|
||||
if [ ! -z "$ctheme" ]; then
|
||||
cd $ctheme/css
|
||||
fi
|
||||
}
|
||||
|
||||
#Takes you to the plugin directory
|
||||
function plugins() {
|
||||
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
|
||||
cd $(wp --path="$wpPath" plugin path)
|
||||
else
|
||||
echo " Can't find public_html folder."
|
||||
fi
|
||||
}
|
||||
|
||||
#Takes you to the woocommece plugin directory
|
||||
function woo() {
|
||||
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
|
||||
cd $(dirname $(wp --path="$wpPath" plugin path woocommerce))
|
||||
else
|
||||
echo " Can't find public_html folder."
|
||||
fi
|
||||
}
|
||||
|
||||
#Takes you to the woocommerce templates plugin directory
|
||||
function wooTemplates() {
|
||||
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
|
||||
cd $(dirname $(wp --path="$wpPath" plugin path woocommerce))/templates
|
||||
else
|
||||
echo " Can't find public_html folder."
|
||||
fi
|
||||
}
|
||||
|
||||
#Takes you to the theme directory
|
||||
function themes() {
|
||||
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
|
||||
cd $(wp --path="$wpPath" theme path)
|
||||
else
|
||||
echo " Can't find public_html folder."
|
||||
fi
|
||||
}
|
||||
|
||||
function todo() {
|
||||
wikidir=${${PWD%/public_html*}%/wiki*}/wiki
|
||||
if [ -d "$wikidir" ]; then
|
||||
$EDITOR "$wikidir/ToDo.md"
|
||||
fi
|
||||
}
|
||||
|
||||
#This function toggles debug in wp-config
|
||||
function debugToggle(){
|
||||
public_html=${PWD%/public_html*}/public_html
|
||||
if [ -d $public_html ]; then
|
||||
current=$(egrep "'WP_DEBUG'" "$public_html/wp-config.php" | egrep -o "(true|false)")
|
||||
[[ $current == true ]] && newvalue=false || newvalue=true
|
||||
sed -i "s/'WP_DEBUG'.*/'WP_DEBUG', $newvalue\)\;/g" "$public_html/wp-config.php"
|
||||
echo "WP_DEBUG is now $newvalue";
|
||||
fi
|
||||
}
|
||||
|
||||
# Adds sub folders in by .bin directory to the PATH if they are not already in it
|
||||
# Also adds .bin to the path adjacent to any public_html folder
|
||||
function updatePath(){
|
||||
# Reset the path
|
||||
PATH=$(echo $PATH | sed -E "s/:\/home\/jonathan\/\.bin\/.*//g")
|
||||
for d in ~/.bin/*/; do
|
||||
if [[ :$PATH: != *:"$d":* ]] ; then
|
||||
PATH+=":$d"
|
||||
fi
|
||||
done
|
||||
public_html=${PWD%/public_html*}/public_html
|
||||
if [ -d $public_html ]; then
|
||||
PATH+=":${PWD%/public_html*}/.bin"
|
||||
fi
|
||||
|
||||
}
|
||||
|
20
shells/shared/profile
Normal file
20
shells/shared/profile
Normal file
|
@ -0,0 +1,20 @@
|
|||
export LANG="en_GB.UTF-8"
|
||||
export TERMINAL=/usr/local/bin/st
|
||||
export TERM=xterm-256color
|
||||
export PATH=~/.bin:$PATH:/opt/lampp/bin:~/.config/composer/vendor/bin:.
|
||||
export EDITOR='vim'
|
||||
export READER='zathura'
|
||||
export CDPATH=.:~:~/Sites
|
||||
|
||||
#Ruby things
|
||||
GEM_HOME=$(ls -t -U | ruby -e 'puts Gem.user_dir')
|
||||
GEM_PATH=$GEM_HOME
|
||||
export PATH=$PATH:$GEM_HOME/bin
|
||||
export GEM_HOME=$(ruby -e 'print Gem.user_dir')
|
||||
|
||||
# Adds sub folders in by .bin directory to the PATH
|
||||
for d in ~/.bin/*/; do
|
||||
PATH+=":$d"
|
||||
done
|
||||
|
||||
#echo -e "Please don't sabotage my computer while I'm away \n\nTo turn on the print server, run the command 'cups'" | /usr/bin/cowsay -f tux -W 80
|
Loading…
Add table
Add a link
Reference in a new issue