diff --git a/README.html b/README.html index e16d93f6..8ffe0aa0 100644 --- a/README.html +++ b/README.html @@ -7,3 +7,23 @@ chmod +x ./install.sh WARNING! DO NOT USE INSTALL.SH TO UPDATE OR YOU WILL LOSE AUTOMATIC BACKUP, WHICH WAS TAKEN WHEN YOU RAN INSTALLATION SCRIPT. + +Notices: +bashrc: I have uncommented line 42. +bash_exports: The default editor is nano (line 4). +bashrc_exports: Timezone is Europe/Helsinki, line 14. + +DISCLAIMER: +Author of this git repository is not responsible for any data loss or any other harms, which might be +because of these files. + +Author: Mika Suomalainen (Mkaysi). + +License: +There aren't any license, but please mention that I created this and where did you get this file. +If something is copy-pasted here from somewhere, it reads in that file. + +Original sources: +GitHub gist: This first appeared here: https://gist.github.com/1142884 +GitHub: I am currently creating this. I think that it might be better to have normal git repo, because +this repo includes 9 files. I will put link here soon. (NOTICE: I will continue pushing to both places. diff --git a/bash_exports b/bash_exports index f2b4bc28..ba4b86cf 100644 --- a/bash_exports +++ b/bash_exports @@ -1,4 +1,4 @@ -echo "Your ~/.bash_imports needs your attention." +echo "Your ~/.bash_imports needs your attention. By the way, comment line 1 in it." # Sets the default editor. Currently nano. export EDITOR=nano @@ -6,7 +6,7 @@ export EDITOR=nano # Sets user specifig PYTHONPATH. Replace 2.X with your Python version. For example with Python 2.7 you replace X with 7. #export PYTHONPATH=$HOME/.packages/lib/python2.X/site-packages -# Fixes locale problems (for example) when SSHing in with different locale. +# Fixes locale problems (for example) when SSHing in with different locale. (Another example: Hailo plugin for supybot gives locale errors, this fixes it.) LC_ALL=C export LC_ALL @@ -14,5 +14,3 @@ export LC_ALL export TZ="/usr/share/zoneinfo/Europe/Helsinki" echo "Please change your timezone in line 14 of ~/.bash_exports . It's currently set to Europe/Helsinki." echo "If you life in Finland, you can safely uncomment lines 15 and 16 without even looking at them." - - diff --git a/bash_functions b/bash_functions new file mode 100644 index 00000000..e9e674dd --- /dev/null +++ b/bash_functions @@ -0,0 +1,51 @@ +# To disable function, just comment everything after description. + +# GEOIP lookup, copied from the ultimate bashrc http://goo.gl/qGK5j +function geoip() { +geoiplookup $1 +} + +# MYIP, copied from the ultimate bashrc http://goo.gl/qGK5j . I think that it requires lynx. +function myip() +{ +lynx -dump -hiddenlinks=ignore -nolist http://checkip.dyndns.org:8245/ | awk '{ print $4 }' | sed '/^$/d; s/^[ ]*//g; s/[ ]*$//g' +} + +# 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}" ;} + +# ROT13, copied from the ultimate bashrc http://goo.gl/qGK5j +function rot13() +{ + if [ $# -lt 1 ] || [ $# -gt 1 ]; then + echo "Seriously? You don't know what rot13 does?" + else + echo $@ | tr A-Za-z N-ZA-Mn-za-m + fi +} + +# 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 +} diff --git a/bashrc b/bashrc index c2c08160..67878afb 100644 --- a/bashrc +++ b/bashrc @@ -1,16 +1,5 @@ -# This is ~/.bashrc file by Mika Suomalainen (Mkaysi) -# This file also contains the default things. - -# Feel free to redistribute and copy-paste parts of this bashrc, but if you can, please mention -# where did you get this or part of this file. If it's originally copy-pasted from somewhere else -# (The Ultimate bashrc), mention that original source (which is mentioned in this file). - -## WARNING! Author of this file is not responsible for any harms which might happen because of -## file. Use this file with your own responsiblity! - -echo "You must comment lines 11, 12 and 13 in your ~/.bashrc and if you don't live in Finland, -you must set correct timezone in line 136 (or comment it). Otherwise you will notice that the 'date' -command will give you the current time at Finland ;)" +echo "Hi, thanks for using this bashrc. You must now comment lines 1 and 2 in ~/.bashrc +WARNING: DO NOT BLINDLY APPLY THIS!" # ~/.bashrc: executed by bash(1) for non-login shells. # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) @@ -119,68 +108,7 @@ fi # End of default things. # Start of my additions. -# Uses nano as default editor. -export EDITOR=nano - -# Exports my user specifig PYTHONPATH -export PYTHONPATH=$HOME/.packages/lib/python2.7/site-packages - -# Sources my aliases +# Sources everything. source ~/.bash_aliases - -# Fixes locale problems when SSHing in with different locale. -LC_ALL=C -export LC_ALL - -# Sets correct timezone. NOTICE: You will probably want to change this, unless you live in Finland. -export TZ="/usr/share/zoneinfo/Europe/Helsinki" - -# GEOIP lookup, copied from the ultimate bashrc http://goo.gl/qGK5j -function geoip() { -geoiplookup $1 -} - -# MYIP, copied from the ultimate bashrc http://goo.gl/qGK5j . I think that it requires lynx. -function myip() -{ -lynx -dump -hiddenlinks=ignore -nolist http://checkip.dyndns.org:8245/ | awk '{ print $4 }' | sed '/^$/d; s/^[ ]*//g; s/[ ]*$//g' -} - -# 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}" ;} - -# ROT13, copied from the ultimate bashrc http://goo.gl/qGK5j -function rot13() -{ - if [ $# -lt 1 ] || [ $# -gt 1 ]; then - echo "Seriously? You don't know what rot13 does?" - else - echo $@ | tr A-Za-z N-ZA-Mn-za-m - fi -} - -# 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 -} +source ~/.bash_exports +source ~/.bash_functions diff --git a/install.sh b/install.sh index 8fac98f1..946c597a 100755 --- a/install.sh +++ b/install.sh @@ -8,8 +8,8 @@ touch ~/.bash_aliases # Creates .bash_aliases if you don't have one. cat ~/.bash_aliases > ~/.bash_aliases.default.backup # Backups your current .bash_aliases touch ~/.bash_profile # Creates .bash_profile if you don't have it already. cat ~/.bash_profile > ~/.bash_profile.default.backup # Back ups your current bash_profile. -touch ~/.bash_imports # Creates .bash_imports (this is my idea, I am surprised if you have it.) -cat ~/.bash_imports > ~/.bash_imports.default.backup # Backs up .bash_import. +touch ~/.bash_exports # Creates .bash_exports (this is my idea, I am surprised if you have it.) +cat ~/.bash_exports > ~/.bash_exports.default.backup # Backs up .bash_exports. touch ~/.bash_functions # I am surprised if you have this, see above. cat ~/.bash_functions > ~/.bash_functions.default.backup # Backs up .bash_functions . echo "Done!" @@ -21,11 +21,13 @@ cat bash_profile > ~/.bash_profile echo "bash_profile installed." echo "Installing bashrc." cat bashrc > ~/.bashrc -echo "Installing bash_imports" -cat bash_imports > ~/.bash_imports +echo "bashrc installed." +echo "Installing bash_exports" +cat bash_exports > ~/.bash_exports +echo "bash_exports installed." echo "Installing bash_functions" cat bash_functions > ~/.bash_functions -echo "bashrc installed." +echo "bash_functions installed." #echo "Sourcing bash_aliases..." #source ~/.bash_aliases #echo "Sourcing bashrc..." @@ -33,4 +35,4 @@ echo "bashrc installed." # echo "Sourcing bash_profile..." # source bash_profile ## The above is not required, because my bash_profile only sources bashrc. -echo "Installation has completed. Now run source ~/.bashrc to enable the new things." +echo "Installation has completed. Now run 'source ~/.bashrc' to enable the new things."