You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
shownotes-w3m-rice/alias_functions_examples.txt

100 lines
2.5 KiB
Plaintext

# this is notes for video: http://www.youtube.com/watch?v=oNKOXk18-cM
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
alias ls='ls --color=auto'
PS1='[\u@ \W]\$ '
alias hello='echo "hello youtube"'
# reload bashrc file
alias brc='source ~/.bashrc'
alias editbrc='leafpad ~/.bashrc &'
alias ff="feh -B white -g 800x600"
# functions
pix() { feh -B white -g 800x600 $1 ;}
function name { code ;}
name() { code ;}
name() {
block of code
}
alias mount='mount | column -t'
alias nvlc='nvlc --no-color'
alias weechat='weechat-curses'
alias trash='trash-put'
alias wget='wget -c'
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias ......="cd ../../../../.."
youtube-listen() { youtube-viewer -n $@ ;} # no video, music/audio only
py-help27() { python2.7 -c "help('$1')" ;}
function :h { vim +":h $1" +'wincmd o' +'nnoremap q :q!<CR>' ;}
calc() { python -ic "from __future__ import division; from math import *; from random import *" ;}
cmdfu() { curl "http://www.commandlinefu.com/commands/matching/$(echo "$@" \
| sed 's/ /-/g')/$(echo -n $@ | base64)/plaintext" ;}
down4me() { curl -s "http://www.downforeveryoneorjustme.com/$1" | sed '/just you/!d;s/<[^>]*>//g';}
# uses ip or ifconfig, good on older or newer system
m-ip() {
echo "--------------- Network Information ---------------"
# newer system like arch
ip addr | awk '/global/ {print $1,$2}' | cut -d\/ -f1
ip addr | awk '/global/ {print $3,$4}'
ip addr | awk '/ether/ {print $1,$2}'
ip addr | awk '/scope link/ {print $1,$2}' | cut -d\/ -f1
# older system like debian
ifconfig | awk '/inet addr/ {print $1,$2}' | awk -F: '{print $1,$2}'
ifconfig | awk '/Bcast/ {print $3}' | awk -F: '{print $1,$2}'
ifconfig | awk '/inet addr/ {print $4}' | awk -F: '{print $1,$2}'
ifconfig | awk '/HWaddr/ {print $4,$5}'
ifconfig | awk '/Scope:Link/ {print $1,$3}' | cut -d\/ -f1
echo Current IP $(curl -s http://checkip.dyndns.org/ | grep -o "[[:digit:].]\+")
echo "---------------------------------------------------"
}
say() {
mplayer -user-agent Mozilla \
"http://translate.google.com/translate_tts?ie=UTF-8&tl="$1"&q=$(echo "$@" \
| cut -d ' ' -f2- | sed 's/ /\+/g')" > /dev/null 2>&1 ;}
say-translation() {
lang=$1
trans=$(translate {=$lang} "$(echo "$@" | cut -d ' ' -f2- | sed 's/ /\+/g')" )
echo $trans
mplayer -user-agent Mozilla \
"http://translate.google.com/translate_tts?ie=UTF-8&tl=$lang&q=$trans" > /dev/null 2>&1 ;}
#}}}