shownotes-w3m-rice/alias_functions_examples.txt

100 lines
2.5 KiB
Plaintext
Raw Normal View History

2013-05-24 22:14:09 +00:00
# this is notes for video: http://www.youtube.com/watch?v=oNKOXk18-cM
2013-04-23 06:54:51 +00:00
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
alias ls='ls --color=auto'
PS1='[\u@ \W]\$ '
2013-04-28 18:09:26 +00:00
alias hello='echo "hello youtube"'
2013-04-23 06:54:51 +00:00
2013-04-28 18:09:26 +00:00
# reload bashrc file
2013-04-23 06:54:51 +00:00
alias brc='source ~/.bashrc'
2013-04-28 18:09:26 +00:00
alias editbrc='leafpad ~/.bashrc &'
2013-04-23 06:54:51 +00:00
2013-04-28 18:09:26 +00:00
alias ff="feh -B white -g 800x600"
2013-04-23 06:54:51 +00:00
2013-04-28 18:09:26 +00:00
# functions
2013-04-23 06:54:51 +00:00
2013-04-28 18:09:26 +00:00
pix() { feh -B white -g 800x600 $1 ;}
2013-04-23 06:54:51 +00:00
2013-04-28 18:09:26 +00:00
function name { code ;}
name() { code ;}
2013-04-23 06:54:51 +00:00
name() {
2013-04-28 18:09:26 +00:00
block of code
2013-04-23 06:54:51 +00:00
}
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 ../../../../.."
2013-04-28 18:09:26 +00:00
youtube-listen() { youtube-viewer -n $@ ;} # no video, music/audio only
2013-04-23 06:54:51 +00:00
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 "---------------------------------------------------"
}
2013-04-28 18:09:26 +00:00
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 ;}
#}}}
2013-04-23 06:54:51 +00:00