2012-12-31 10:44:32 +01:00
UNAME = ` uname`
2011-10-29 10:02:22 +02:00
# TOC
# Defaults etc... M0TZLS
# Environment 7RS56S
# Aliases RJ706I
# Functions ZGC5QQ
2011-10-29 15:52:37 +02:00
# For Mac OS X + SSH sessions. bashrc must be sourced by hand at least once.
echo " if [ -f ~/.bashrc ]; then
source ~/.bashrc
2011-11-25 13:10:39 +01:00
fi " > ~/.bash_profile
2011-10-29 15:52:37 +02:00
2011-10-29 10:02:22 +02:00
##### Defaults etc... M0TZLS #####
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z " $PS1 " ] && return
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
2012-12-31 22:00:59 +01:00
HISTCONTROL = ignoredups
2011-10-29 10:02:22 +02:00
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
2012-12-31 22:00:59 +01:00
export HISTSIZE =
export HISTFILESIZE =
export HISTTIMEFORMAT = '%F %T '
HISTFILE = ~/.history
export APPEND_HISTORY =
export SHARE_HISTORY =
2011-10-29 10:02:22 +02:00
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval " $( SHELL = /bin/sh lesspipe) "
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z " $debian_chroot " ] && [ -r /etc/debian_chroot ] ; then
debian_chroot = $( cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, unless we know we "want" color)
case " $TERM " in
xterm-color) color_prompt = yes; ;
esac
force_color_prompt = yes
if [ -n " $force_color_prompt " ] ; then
if which tput >& /dev/null && tput setaf 1 >& /dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt = yes
else
color_prompt =
fi
fi
if [ " $color_prompt " = yes ] ; then
PS1 = '${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1 = '${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
2012-12-21 12:58:32 +01:00
# Red colour for root, thanks nyuszika7h
2012-04-24 16:30:37 +02:00
# Check if we're root
2011-10-29 11:31:14 +02:00
if [ [ $EUID = = 0 ] ] ; then
PS1 = '\033[1;31m\u@\h:\w\$\033[0m '
else
PS1 = '\033[1;32m\u@\h:\w\$\033[0m '
fi
2011-10-29 10:02:22 +02:00
# If this is an xterm set the title to user@host:dir
case " $TERM " in
xterm*| rxvt*)
PS1 = " \[\e]0; ${ debian_chroot : +( $debian_chroot ) } \u@\h: \w\a\] $PS1 "
; ;
*)
; ;
esac
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ] ; then
test -r ~/.dircolors && eval " $( dircolors -b ~/.dircolors) " || eval " $( dircolors -b) "
2012-12-21 14:11:11 +01:00
alias ls = 'ls --color=always'
alias dir = 'dir --color=always'
alias vdir = 'vdir --color=always'
2011-10-29 10:02:22 +02:00
2012-12-21 14:11:11 +01:00
alias grep = 'grep --color=always'
alias fgrep = 'fgrep --color=always'
alias egrep = 'egrep --color=always'
2011-10-29 10:02:22 +02:00
fi
# some more ls aliases
2012-12-31 10:44:32 +01:00
if [ [ $UNAME != Darwin ] ] ; then
2012-12-31 21:07:43 +01:00
alias ll = 'ls -alFh --color=always' && alias la = 'ls -A --color=always' && alias l = 'ls -CF --color=always'
2012-12-31 10:44:32 +01:00
fi
2011-10-29 10:02:22 +02:00
# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
alias alert = 'notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e ' \' 's/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//' \' ')"'
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
if [ -f ~/.bash_aliases ] ; then
. ~/.bash_aliases
fi
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi
#Shopt settings.
#shopt -s autocd
2012-08-06 19:04:58 +02:00
# Show the hostname and uptime on shell start
hostname && uptime
2011-10-29 10:02:22 +02:00
##### Environment 7RS56S #####
2012-12-31 10:44:32 +01:00
# Environment should be placed to .environment or .bash_environment.
2011-10-29 10:02:22 +02:00
# Source before mentioned locations if they exist.
# .environment
if [ -f ~/.environment ] ; then
source ~/.environment
fi
# .bash_environment
if [ -f ~/.bash_environment ] ; then
source ~/.bash_environment
fi
2012-09-16 14:24:34 +02:00
# Enable core files.
ulimit -c unlimited
2011-12-29 10:18:28 +01:00
# More colours :D
if [ [ $TERM = = 'xterm' ] ] ; then
export TERM = xterm-256color
fi
2011-12-29 10:20:01 +01:00
if [ [ $TERM = = 'screen' ] ] ; then
export TERM = screen-256color
fi
2011-12-29 10:18:28 +01:00
# Things after this are just examples and should be put to some other file, which is sourced above.
2011-10-29 10:02:22 +02:00
2011-12-31 20:11:57 +01:00
# Sets the default editor. I am vim user, so I want it to be vim. If you don't like terminal based text editors, change "" to gedit (Gnome) or Kate (KDE).
2012-12-21 13:32:33 +01:00
#export EDITOR=vim # MKAYSIGREP MKAYSIGREPENVIRONMENT
2011-10-29 10:02:22 +02:00
# Sets locale. You can get list of locales with "locale -a" command. This should be something which ends to .utf8
2012-12-21 13:01:22 +01:00
#export LC_ALL=fi_FI.utf8 # MKAYSIGREP # MKAYSIGREPENVIRONMENT
2011-10-29 10:02:22 +02:00
# Sets your timezone. Set in format <Region/City>, or just timezone like UTC.
2012-12-21 13:01:22 +01:00
#export TZ="/usr/share/zoneinfo/Europe/Helsinki" # MKAYSIGREP #MKAYSIGREPENVIRONMENT
2011-10-29 10:02:22 +02:00
# Sets PATH. To add another path, add :</path/to/new/path> to string below.
2013-02-02 17:26:32 +01:00
PATH = $HOME /.local/bin:$HOME /.local/sbin:$HOME /.local/games:$HOME /bin:$HOME /sbin:$HOME /games:/opt/local/bin:/opt/local/sbin:/opt/local/games:/usr/local/bin:/usr/local/sbin:/usr/local/games:/bin:/sbin:/games:/usr/bin:/usr/sbin:/usr/games:$PATH
2011-10-29 10:02:22 +02:00
# "Changes" home directory without root. Uncomment both lines below this.
#export HOME=<path to new home>
#cd
2012-12-21 14:24:51 +01:00
# Colours to less
# Copied from http://nion.modprobe.de/blog/archives/572-less-colors-for-man-pages.html
export LESS_TERMCAP_mb = $'\E[01;31m'
export LESS_TERMCAP_md = $'\E[01;31m'
export LESS_TERMCAP_me = $'\E[0m'
export LESS_TERMCAP_se = $'\E[0m'
export LESS_TERMCAP_so = $'\E[01;44;33m'
export LESS_TERMCAP_ue = $'\E[0m'
export LESS_TERMCAP_us = $'\E[01;32m'
2011-10-29 10:02:22 +02:00
2012-12-24 17:59:14 +01:00
# Sets environment variable CPUARCH to output of "uname -p" & UNAME to "uname"
UNAME = ` uname`
2012-12-21 11:44:13 +01:00
CPUARCH = ` uname -p`
2012-12-24 17:59:14 +01:00
# If we are on Mac, show hidden files in Finder and enable AirDrop over Ethernet and on unsupported (by Apple) Macs
if [ $UNAME = "Darwin" ] ; then
defaults write com.apple.finder AppleShowAllFiles TRUE && defaults write com.apple.NetworkBrowser BrowseAllInterfaces 1
fi
2012-12-24 18:15:02 +01:00
# If we are on Mac, set update check interval to 1 day
if [ [ $UNAME = "Darwin" && $USER = "root" ] ] ; then
defaults write /Library/Preferences/com.apple.SoftwareUpdate ScheduleFrequency 1
fi
# The above requires at least Mountain Lion.
2012-12-26 18:02:58 +01:00
# I have only one display
export DISPLAY = :0
2011-10-29 10:02:22 +02:00
##### Aliases RJ706I #####
# To get sudo work with aliases.
alias sudo = "sudo "
# Moving between directories:
alias ..= "cd .."
# Use htop instead of top, it's better. Requires htop.
2012-12-21 13:01:22 +01:00
#alias top="htop" # MKAYSIGREP # MKAYSIGREPALIAS
2011-10-29 10:02:22 +02:00
# Automaticly adds title to Youtube-dl when downloading videos with it. Requires youtube-dl.
alias youtube-dl= "youtube-dl -t"
# git specific. This is the command which I use when git asks me to commit something and says that I have modified files, even when I haven't.
alias gdrop = "git stash && git stash drop"
2012-12-21 13:01:22 +01:00
#alias gitk="gitg" # Requires gitg . I just think that it looks nicer than gitk. #MKAYSIGREP # MKAYSIGREPALIAS
2011-10-29 10:02:22 +02:00
# If I run nautilus, I want it to open in folder where I am.
2012-04-30 18:06:34 +02:00
#alias nautilus="nautilus ./"
2011-10-29 10:02:22 +02:00
# Why I must write "weechat-curses" to start it?
alias weechat = "weechat-curses"
#NMAP specific. All nmap things should be run as root, so it's probably best to copy these aliases to root's .bashrc. Things which don't run without root ask for sudo password.
alias nmap-intense= "nmap -T4 -A -v -PE -PS22,25,80 -PA21,23,80,3389 "
alias nmap-intense-udp= "sudo nmap -sS -sU -T4 -A -v -PE -PS22,25,80 -PA21,23,80,3389 "
alias nmap-intense-all-tcp= "nmap -p 1-65535 -T4 -A -v -PE -PS22,25,80 -PA21,23,80,3389 "
alias nmap-intense-no-ping= "nmap -T4 -A -v -PN "
alias nmap-ping= "nmap -sP -PE -PA21,23,80,3389 "
alias nmap-quick= "nmap -T4 -F "
alias nmap-quick-plus= "sudo nmap -sV -T4 -O -F --version-light "
alias nmap-traceroute= "sudo nmap -sP -PE -PS22,25,80 -PA21,23,80,3389 -PU -PO --traceroute "
alias nmap-regular= "nmap "
alias nmap-comprehensive= "sudo nmap -sS -sU -T4 -A -v -PE -PP -PS21,22,23,25,80,113,31339 -PA80,113,443,10042 -PO --script all "
# Little "safer" scan as connecting to only HTTP and HTTPS ports doesn't look so attacking. Copy-paste to .bash_custom and remove " -p 80,443" if you want to scan all ports which nmap scans by default.
alias nmap-osscan= "sudo nmap -p 80,443 -O -v --osscan-guess --fuzzy "
2012-12-21 13:01:22 +01:00
#alias netcat="ncat " # MKAYSIGREP # MKAYSIGREPALIAS
2011-10-29 10:02:22 +02:00
2012-04-30 18:06:34 +02:00
# Tor (The Onion Router) specific.
2012-12-21 13:01:22 +01:00
#alias usewithtor="proxychains " # MKAYSIGREP # MKAYSIGREPALIAS
#alias torsocks="proxychains " # MKAYSIGREP # MKAYSIGREPALIAS
2011-10-29 10:02:22 +02:00
# This should allow aliases to work with proxychains.
2012-12-21 13:01:22 +01:00
#alias proxychains="proxychains " # MKAYSIGREP # MKAYSIGREPALIAS
2011-10-29 10:02:22 +02:00
# Downloads folder over SSH. Usage: rdownload <host>:<remotefolder> <local_destination> | TIP: use ~/ssh/config to configure hosts.
2012-01-10 15:54:10 +01:00
alias rdownload = "rsync -h --progress -avz "
2011-10-29 10:02:22 +02:00
# TMUX specific
2012-04-21 13:40:16 +02:00
alias attach = "tmux -u attach-session"
2011-10-29 10:02:22 +02:00
alias detach = "tmux -u detach"
2012-04-21 13:40:16 +02:00
alias tmux = "tmux -u"
2011-10-29 10:02:22 +02:00
# I am always typoing "aptitude" with my phone...
alias aptitute = "aptitude "
# This is the checkinstall rule which I like to use.
2012-12-21 13:01:22 +01:00
#alias checkinstall="make install " # MKAYSIGREP # MKAYSIGREPALIAS
2011-10-29 10:02:22 +02:00
# The Battle for Wesnoth specific, http://wesnoth.org/
# It seems to be an good idea to have debug logs on terminal with svn version.
alias wesnoth = "wesnoth --debug"
# For copy-pasting directly from somewhere
alias %= " "
2012-12-21 12:58:32 +01:00
alias \# = " "
# Supybot specifig. Why to write long command, if you can write short command?
2011-10-29 10:02:22 +02:00
alias supybot-config-reload= "killall -HUP supybot "
alias supybot-owner-quit= "killall -INT supybot "
# Translating plugins in Limnoria
2012-04-15 17:46:00 +02:00
alias supybot-generate-messages.pot= "pygettext --docstrings config.py plugin.py"
2011-12-23 09:41:15 +01:00
alias supybot-generate-messages.pot-xgettext= "xgettext --language=Python config.py plugin.py && mv -f messages.po messages.pot"
2012-08-04 14:26:07 +02:00
alias supybot-check-plugin-trans= "sandbox/check_trans.py plugins/"
2012-10-07 17:25:38 +02:00
alias supybot-generate-messages.pot-mass= "find . -type d -exec sh -c '(cd {} && pygettext --docstrings config.py plugin.py)' ';'"
2011-10-29 10:02:22 +02:00
## -- Start of aliases which are saved from Ubuntu default bashrc. --
# enable color support of ls and also add handy aliases
2012-12-31 10:44:32 +01:00
if [ [ $UNAME != Darwin ] ] ; then
alias ls = 'ls --color=always'
fi
2012-12-21 14:11:11 +01:00
alias dir = 'dir --color=always'
alias vdir = 'vdir --color=always'
alias grep = 'grep --color=always'
alias fgrep = 'fgrep --color=always'
alias egrep = 'egrep --color=always'
2011-10-29 10:02:22 +02:00
# some more ls aliases
2012-12-31 10:44:32 +01:00
if [ [ $UNAME != Darwin ] ] ; then
2012-12-31 21:07:43 +01:00
alias ll = 'ls -alFh --color=always' && alias la = 'ls -A --color=always' && alias l = 'ls -CF --color=always'
2012-12-31 10:44:32 +01:00
fi
2011-10-29 10:02:22 +02:00
## -- End of aliases which are saved from Ubuntu default bashrc. --
# Copying command in Supybot (Internet.DNS)
alias dns = "nslookup "
alias dns6 = "nslookup -type=AAAA "
alias nslookup6 = "nslookup -type=AAAA "
# If I have nslookup6...
alias dig6 = "dig AAAA "
# SSHGuard specific
alias sshguard-show-bans= "sudo iptables -L sshguard --line-numbers"
# Enter ban number as arguement. You can see ban numbers with previous command.
alias sshguard-unban= "sudo iptables -D sshguard "
2011-11-12 19:42:26 +01:00
# This needs something which makes it easy to remember.
alias KILL = "killall -KILL "
2011-12-25 16:51:34 +01:00
# For locally rsync copying folder1 to folder2.
2012-01-10 15:54:10 +01:00
alias rsync-folder= "rsync -h --progress -azvv "
2011-12-25 16:51:34 +01:00
2011-12-31 21:11:01 +01:00
# SSHGuard seems to prefer users to run this always when connecting with keys in ssh-agent...
alias ssh-add= "\ssh-add -D && \ssh-add "
2012-04-01 16:21:38 +02:00
# Use GPG2 instead of GPG!
2012-12-21 13:01:22 +01:00
# alias gpg=gpg2 # MKAYSIGREP # MKAYSIGREPALIAS
2012-04-01 16:21:38 +02:00
2012-05-03 16:26:50 +02:00
# For userspecific installation of mosh on remote server.
alias lmosh = "mosh --server=~/.local/bin/mosh-server "
2012-05-19 11:58:51 +02:00
# Secure cat
alias scat = "gpg --decrypt "
2012-06-24 08:33:23 +02:00
# To check are keys, which apt uses changed
alias apt-key-refresh-keys= "apt-key adv --keyserver pool.sks-keyservers.net --refresh-keys"
2012-06-29 19:28:50 +02:00
# To see which mirror http.debian.net puts you to. The file which has the latest update time is the mirror which you are using.
2012-08-19 11:08:09 +02:00
alias http.debian.net= "curl -sL http://http.debian.net/debian/project/trace/|pandoc -f html -t markdown"
2012-06-29 19:28:50 +02:00
2012-07-25 09:51:05 +02:00
# Amount of keys in GPG keyring.
alias gpg-key-amount= "gpg --list-keys|grep '^pub'|wc -l"
2012-07-25 10:00:52 +02:00
alias gpg-key-count= "gpg --export -a|gpg --import"
2012-07-25 09:51:05 +02:00
2012-08-04 15:45:05 +02:00
alias follow = "tail -f "
2012-08-18 10:37:19 +02:00
#myip shows current IP. This was a function.
2012-08-18 10:57:20 +02:00
alias myip = "curl -s http://icanhazip.com"
alias myip4 = "curl -s4 http://icanhazip.com"
alias myip6 = "curl -s6 http://icanhazip.com"
2012-08-18 10:37:19 +02:00
2012-08-20 13:09:22 +02:00
# Curl instead of wget with warning
2012-12-21 13:01:22 +01:00
# alias wget="echo Running curl -LO instead of wget && curl -LO " # MKAYSIGREP # MKAYSIGREPALIAS
2012-08-20 13:09:22 +02:00
2012-08-30 18:55:53 +02:00
# Update groups without logging out. Requires entering password. Source: http://blog.edwards-research.com/2010/10/linux-refresh-group-membership-without-logging-out/
2012-08-31 16:48:55 +02:00
alias refreshgroups = " exec su -l $USER "
# Incasesensitive grepping
alias grep = "grep -i"
2012-08-30 18:55:53 +02:00
2012-09-15 09:12:17 +02:00
# Get public key lenght of (public) SSH key
alias ssh-pubkey-length= "ssh-keygen -lf "
# MSDOS commands. MSDOS is after every alias line to get these lines easily by grepping.
alias cls = clear # MSDOS
alias help = man # MSDOS
alias ipconfig = ifconfig # MSDOS
2012-09-15 09:25:39 +02:00
alias copy = cp # MSDOS
alias move = mv # MSDOS
2012-09-15 09:12:17 +02:00
2012-09-15 10:01:06 +02:00
# List git committers of repository
alias git-committers= "git shortlog -s"
2012-09-23 09:27:29 +02:00
# Line ending converting with flip
alias unixle = "flip -ub "
alias msdosle = "flip -mb "
2012-12-09 13:08:31 +01:00
# Making .iso bootable from CD/DVD/USB. Cat it to /dev/<DEVICE>
# MaKe Hybrid ISO
alias mkhiso = isohybrid
# Yum
alias yum-unlock= "rm -rf /var/run/yum.pid"
2012-12-21 11:44:13 +01:00
alias yum-rm-timedhosts= " rm /var/cache/yum/ $CPUARCH /17/timedhost* "
2013-01-01 20:13:27 +01:00
alias yummy = "yum -y "
alias yummn = "yum -n "
alias yumy = yummy
alias yumn = yummn
2012-12-09 13:08:31 +01:00
2012-12-21 11:54:59 +01:00
# Archiving and extracting with tar
# This is tartar to avoid conflict with tar
alias tartar = "tar cfv "
alias targz = "tar cfvz "
alias tarbz2 = "tar cfvj "
# I have function ex so these are ex-* to avoid conflict.
# ex-tartar and ex-tar, because there is alias tartar and command tar
alias ex-tar= "tar xfv "
alias ex-tartar= "tar xfv "
alias ex-targz= "tar xfvz "
alias ex-tarbz2= "tar xfvj "
2012-12-22 20:17:56 +01:00
alias info = "echo 'I don't know anyone who likes and uses info pages, so I aliased this to pinfo. If you don't have it installed, you should install it! To override this alias run: \info <document>' && pinfo "
# To have less handle ls colours
alias less = "less -R "
2013-02-04 09:52:58 +01:00
# "su -" with/without sudo
2013-01-01 10:30:37 +01:00
alias ssu = "sudo -i "
2013-02-04 09:52:58 +01:00
alias suu = "su -"
2013-01-01 10:30:37 +01:00
2013-01-14 17:13:46 +01:00
# systemd runlevels/targets
alias currenttargets = "systemctl list-units --type=target"
alias telsystemd = "systemctl isolate "
alias defaulttarget = "systemctl enable "
2013-01-19 10:21:31 +01:00
# Fedora Utils http://satya164.github.com/fedorautils/
alias fedorautils = "\fedorautils -c"
2013-01-19 11:30:25 +01:00
alias fedorautils-install= 'su -c "curl http://download.opensuse.org/repositories/home:/satya164:/fedorautils/Fedora_17/home:satya164:fedorautils.repo -Lo /etc/yum.repos.d/fedorautils.repo && yum -y install fedorautils"'
2013-01-19 10:21:31 +01:00
2011-10-29 10:02:22 +02:00
# Allow custom aliases to be put in .aliases or .bash_aliases .
# .aliases
if [ -f ~/.aliases ] ; then
source ~/.aliases
fi
# .bash_aliases
if [ -f ~/.bash_aliases ] ; then
source ~/.bash_aliases
fi
##### Functions ZGC5QQ #####
# GEOIP lookup, copied from the ultimate bashrc http://goo.gl/qGK5j
function geoip( ) {
geoiplookup $1
}
# Checks which package the command comes from. Copied from the ultimate bashrc http://goo.gl/qGK5j
function cmdpkg( ) { PACKAGE = $( dpkg -S $( which $1 ) | cut -d':' -f1) ; echo " [ ${ PACKAGE } ] " ; dpkg -s " ${ PACKAGE } " ; }
# Down for everyone or just me? Copied from the ultimate bashrc http://goo.gl/qGK5j
function downforme( ) {
RED = '\e[1;31m'
GREEN = '\e[1;32m'
YELLOW = '\e[1;33m'
NC = '\e[0m'
if [ $# = 0 ]
then
echo -e " ${ YELLOW } usage: ${ NC } downforme website_url "
else
JUSTYOUARRAY = ( ` lynx -dump http://downforeveryoneorjustme.com/$1 | grep -o "It's just you" ` )
if [ ${# JUSTYOUARRAY } != 0 ]
then
echo -e " ${ RED } It's just you. \n ${ NC } $1 is up. "
else
echo -e " ${ GREEN } It's not just you! \n ${ NC } $1 looks down from here. "
fi
fi
}
# Topt10 commands, copied from the ultimate bashrc http://goo.gl/qGK5j
function top10( ) {
# copyright 2007 - 2010 Christopher Bratusek
history | awk '{a[$2]++ } END{for(i in a){print a[i] " " i}}' | sort -rn | head
}
# ex command. Copied from bashrc of bioterror ( http://ricecows.org/configs/bash/.bashrc ). Original comment below:
## for unit193 ;)
## use command "ex" to extract any archive files.
## "ex package.zip" for example
function ex ( )
{
if [ -f " $1 " ] ; then
case " $1 " in
*.tar) tar xvf $1 ; ;
*.tar.bz2 | *.tbz2 ) tar xjvf $1 ; ;
*.tar.gz | *.tgz ) tar xzvf $1 ; ;
*.bz2) bunzip2 $1 ; ;
*.rar) unrar x $1 ; ;
*.gz) gunzip $1 ; ;
*.zip) unzip $1 ; ;
*.Z) uncompress $1 ; ;
*.7z) 7z x $1 ; ;
*.xz) tar xJvf $1 ; ;
*.deb)
DIR = ${ 1 %%_*.deb }
ar xv $1
mkdir ${ DIR }
tar -C ${ DIR } -xzvf data.tar.gz ; ;
*.rpm) rpm2cpio $1 | cpio -vid ; ;
*) echo "" ${ 1 } " cannot be extracted via extract()"
; ;
esac
else
echo "" ${ 1 } " is not a valid file"
fi
}
2012-01-06 19:24:36 +01:00
# Given by nyuszika7h. Shortens GitHub URLs with git.io
2012-04-24 16:30:37 +02:00
function gitio( ) {
curl -s -i http://git.io -F " url= $1 " | grep --color= never -P '^Location: ' | awk '{ print $2 }'
}
function mkcd( ) {
if [ [ $# -gt 1 ] ] ; then
echo 'Warning: All directories will be created, but will change to first specified directory.' 1>& 2
fi
2012-04-24 16:43:19 +02:00
mkdir -p " $* " && cd " $1 "
2012-04-24 16:30:37 +02:00
}
function gribble-gpg-everify( ) {
# Set which command to use for gpg. You
# probably want to use gpg2 here.
local gpg = gpg2
2012-04-24 16:43:19 +02:00
echo -n 'Enter Bitcoin OTC URL: '
read REPLY
lynx -hiddenlinks= ignore -dump $REPLY > bitcoin_otc.txt.asc
$gpg --decrypt-file bitcoin_otc.txt.asc
echo -en '\e[1;32m;;everify '
cat bitcoin_otc.txt
echo -e '\e[0m'
rm -rf bitcoin_otc.txt bitcoin_otc.txt.asc
2012-04-24 16:30:37 +02:00
}
2012-01-06 19:24:36 +01:00
2011-10-29 10:02:22 +02:00
# .custom
if [ -f ~/.custom ] ; then
source ~/.custom
fi
# .bash_custom
if [ -f ~/.bash_custom ] ; then
source ~/.bash_custom
fi