Remove aliases and functions that I don't use.
Signed-off-by: Jacob Kiers <jacob@alphacomm.nl>
This commit is contained in:
parent
035dad86c6
commit
bba2f8edac
@ -8,12 +8,6 @@ alias -- -="cd -" # The alias is `-`, not `--`
|
||||
|
||||
# Shortcuts
|
||||
alias c="composer"
|
||||
alias dr="cd ~/Dropbox"
|
||||
alias pj="cd ~/Dropbox/Projects"
|
||||
alias pjr="cd ~/Dropbox/Projects/_Repos"
|
||||
alias prj="pjr"
|
||||
alias pjf="cd ~/Dropbox/Projects/_Forks"
|
||||
alias pjm="cd ~/Dropbox/Projects/!"
|
||||
alias o="open"
|
||||
alias oo="open ."
|
||||
alias e=$EDITOR
|
||||
@ -95,21 +89,6 @@ alias path='echo -e ${PATH//:/\\n}'
|
||||
# Say what’s in the clipboard
|
||||
alias sayit="pbpaste | say"
|
||||
|
||||
# NPM
|
||||
alias npm-patch='npm version patch -m "%s"'
|
||||
alias npm-release='npm version minor -m "%s"'
|
||||
|
||||
# Tâmia
|
||||
tm() { yo tamia:$@; }
|
||||
|
||||
# Virtualenv
|
||||
alias venv='test -d ENV && source ./ENV/bin/activate || echo "No Virtualenv in the current folder."'
|
||||
alias venv-init='test -d ENV && echo "Virtualenv already exists." || virtualenv --no-site-packages ENV; venv'
|
||||
|
||||
# Django
|
||||
alias dm="python manage.py"
|
||||
alias dms="python manage.py runserver"
|
||||
|
||||
# Restart Linux service
|
||||
rstrt() { sudo service $@ restart; }
|
||||
|
||||
@ -118,10 +97,6 @@ function proj { cd "$("$HOME/dotfiles/bin/opener.py" "$HOME/Dropbox/Projects" $1
|
||||
function repo { cd "$("$HOME/dotfiles/bin/opener.py" "$HOME/Dropbox/Projects" $1 -w repo $2)"; }
|
||||
function wptheme { cd "$("$HOME/dotfiles/bin/opener.py" "$HOME/Dropbox/Projects" $1 -w wptheme $2)"; }
|
||||
|
||||
# Color conversion
|
||||
alias hex2hsl="color.js $1 $2"
|
||||
alias hex2rgb="color.js --rgb $1 $2"
|
||||
|
||||
# Dotfiles help
|
||||
alias dot-bash="killall Marked; open -a marked --args $HOME/dotfiles/docs/Bash.md"
|
||||
alias dot-git="killall Marked; open -a marked --args $HOME/dotfiles/docs/Git.md"
|
||||
|
@ -49,18 +49,6 @@ function headers() {
|
||||
cut -c3-
|
||||
}
|
||||
|
||||
# Escape UTF-8 characters into their 3-byte format
|
||||
function escape() {
|
||||
printf "\\\x%s" $(printf "$@" | xxd -p -c1 -u)
|
||||
echo
|
||||
}
|
||||
|
||||
# Get a character’s Unicode code point: £ → \x00A3
|
||||
function codepoint() {
|
||||
perl -e "use utf8; print sprintf('\x%04X', ord(\"$@\"))"
|
||||
echo
|
||||
}
|
||||
|
||||
# Remove screenshots from desktop
|
||||
function cleandesktop() {
|
||||
header "Cleaning desktop..."
|
||||
@ -147,22 +135,6 @@ ssh-add-host() {
|
||||
fi
|
||||
}
|
||||
|
||||
# Upload current directory to special directory on my hosting
|
||||
function yay() {
|
||||
server="seal"
|
||||
dir=`basename "$(pwd)"`
|
||||
remote="~/sites/yay.sapegin.me/htdocs/$dir"
|
||||
url="http://yay.sapegin.me/$dir/"
|
||||
|
||||
tar cp --exclude '.git' --exclude 'node_modules' . | gzip | ssh $server "mkdir -p "$remote"; gzip -cd | tar x -C "$remote""
|
||||
|
||||
echo "Current directory uploaded to $url."
|
||||
if command -v pbcopy >/dev/null 2>&1; then
|
||||
echo -n "$url" | pbcopy
|
||||
echo "URL copied to clipboard."
|
||||
fi
|
||||
}
|
||||
|
||||
# Find files with Windows line endings (and convert then to Unix in force mode)
|
||||
# USAGE: crlf [file] [--force]
|
||||
function crlf() {
|
||||
@ -185,123 +157,6 @@ function _crlf_file() {
|
||||
grep -q $'\x0D' "$1" && echo "$1" && [ $2 ] && dos2unix "$1"
|
||||
}
|
||||
|
||||
# Backup remote MySQL database to ~/Backups/hostname/dbname_YYYY-MM-DD.sql.gz
|
||||
# USAGE: mysql-dump <ssh_hostname> <mysql_database> [mysql_username] [mysql_host]
|
||||
mysql-dump() {
|
||||
local ssh_hostname=$1
|
||||
local mysql_database=$2
|
||||
local mysql_username=$3
|
||||
local mysql_host=$4
|
||||
local location="$HOME/Backups"
|
||||
local suffix=$(date +'%Y-%m-%d')
|
||||
|
||||
if [[ $ssh_hostname == "" ]] || [[ $mysql_database == "" ]]; then
|
||||
echo "Usage: mysql-dump <ssh_hostname> <mysql_database> [mysql_username] [mysql_host]"
|
||||
else
|
||||
header "Backing up $mysql_database@$ssh_hostname..."
|
||||
|
||||
if [[ $mysql_username != "" ]]; then
|
||||
mysql_username="-u $mysql_username -p "
|
||||
fi
|
||||
|
||||
if [[ $mysql_host != "" ]]; then
|
||||
mysql_host=" -h $mysql_host"
|
||||
fi
|
||||
|
||||
# Ensure backup directory
|
||||
local backup_dir="$location/$ssh_hostname"
|
||||
mkdir -p $backup_dir
|
||||
|
||||
# Give the user a warning if the file already exists
|
||||
local basename=$mysql_database"_"$suffix
|
||||
local local_filepath="$backup_dir/$basename.sql.gz"
|
||||
if [ -f "$local_filepath" ]; then
|
||||
echo -e $RED"WARNING: Backup file '$local_filepath' already exists.$NOCOLOR\nOwerwrite? (Y/N)"
|
||||
read proceed
|
||||
|
||||
if [[ $proceed != "y" ]]; then
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
ssh -C $ssh_hostname "mysqldump --opt --compress $mysql_username$mysql_database$mysql_host | gzip -c" > "$local_filepath"
|
||||
|
||||
echo
|
||||
echo "Done: $local_filepath"
|
||||
fi
|
||||
}
|
||||
|
||||
# Save page screenshot to file
|
||||
# USAGE: rasterize <URL> <filename>
|
||||
# Based on https://github.com/oxyc/dotfiles/blob/master/.bash/commands
|
||||
function rasterize() {
|
||||
local url="$1"
|
||||
local filename="$2"
|
||||
if [[ $url == "" ]] || [[ $filename == "" ]]; then
|
||||
echo "Usage: rasterize <URL> <filename>"
|
||||
else
|
||||
header "Rasterizing $url..."
|
||||
|
||||
[[ $url != http* ]] && url="http://$url"
|
||||
[[ $filename != *png ]] && filename="$filename.png"
|
||||
phantomjs <(echo "
|
||||
var page = new WebPage();
|
||||
page.viewportSize = { width: 1280 };
|
||||
page.open('$url', function (status) {
|
||||
if (status !== 'success') {
|
||||
console.log('Unable to load the address.');
|
||||
phantom.exit();
|
||||
}
|
||||
else {
|
||||
window.setTimeout(function() {
|
||||
page.render('$filename');
|
||||
phantom.exit();
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
")
|
||||
|
||||
echo "Screenshot saved to: $filename"
|
||||
fi
|
||||
}
|
||||
|
||||
# Add note to Notes.app (OS X 10.8)
|
||||
# Usage: note "foo" or echo "foo" | note
|
||||
function note() {
|
||||
local text
|
||||
if [ -t 0 ]; then # Argument
|
||||
text="$1"
|
||||
else # Pipe
|
||||
text=$(cat)
|
||||
fi
|
||||
body=$(echo "$text" | sed -E 's|$|<br>|g')
|
||||
osascript >/dev/null <<EOF
|
||||
tell application "Notes"
|
||||
tell account "iCloud"
|
||||
tell folder "Notes"
|
||||
make new note with properties {name:"$text", body:"$body"}
|
||||
end tell
|
||||
end tell
|
||||
end tell
|
||||
EOF
|
||||
}
|
||||
|
||||
# Start an HTTP server from a directory, optionally specifying the port (default: 8000)
|
||||
# Usage: server [port]
|
||||
function server() {
|
||||
local port="${1:-8000}"
|
||||
echo "Access from network: http://$(myip):$port"
|
||||
echo
|
||||
open "http://localhost:${port}/"
|
||||
# Set the default Content-Type to `text/plain` instead of `application/octet-stream`
|
||||
# And serve everything as UTF-8 (although not technically correct, this doesn’t break anything for binary files)
|
||||
python -c $'import SimpleHTTPServer;\nmap = SimpleHTTPServer.SimpleHTTPRequestHandler.extensions_map;\nmap[""] = "text/plain";\nfor key, value in map.items():\n\tmap[key] = value + ";charset=UTF-8";\nSimpleHTTPServer.test();' "$port"
|
||||
}
|
||||
|
||||
function sayit() {
|
||||
pbpaste | say
|
||||
}
|
||||
|
||||
function git-work()
|
||||
{
|
||||
if [ -s ~/.gitlocal ]; then
|
||||
|
Loading…
Reference in New Issue
Block a user