help metadata for base plugin
parent
a8fcf9f18c
commit
a3c3caa0ab
|
|
@ -2,84 +2,114 @@
|
||||||
|
|
||||||
# For generic functions.
|
# For generic functions.
|
||||||
|
|
||||||
function ips {
|
ips ()
|
||||||
ifconfig | grep "inet " | awk '{ print $2 }'
|
{
|
||||||
|
about display all ip addresses for this host
|
||||||
|
ifconfig | grep "inet " | awk '{ print $2 }'
|
||||||
}
|
}
|
||||||
|
|
||||||
function down4me() {
|
down4me ()
|
||||||
curl -s "http://www.downforeveryoneorjustme.com/$1" | sed '/just you/!d;s/<[^>]*>//g'
|
{
|
||||||
|
about checks whether a website is down for you, or everybody
|
||||||
|
param 1: website url
|
||||||
|
example $ down4me http://www.google.com
|
||||||
|
curl -s "http://www.downforeveryoneorjustme.com/$1" | sed '/just you/!d;s/<[^>]*>//g'
|
||||||
}
|
}
|
||||||
|
|
||||||
function myip {
|
myip ()
|
||||||
res=$(curl -s checkip.dyndns.org | grep -Eo '[0-9\.]+')
|
{
|
||||||
echo -e "Your public IP is: ${echo_bold_green} $res ${echo_normal}"
|
about displays your ip address, as seen by the Internet
|
||||||
|
res=$(curl -s checkip.dyndns.org | grep -Eo '[0-9\.]+')
|
||||||
|
echo -e "Your public IP is: ${echo_bold_green} $res ${echo_normal}"
|
||||||
}
|
}
|
||||||
|
|
||||||
pass() {
|
pass ()
|
||||||
which gshuf &> /dev/null
|
{
|
||||||
if [ $? -eq 1 ]
|
about generates password from random dictionary words
|
||||||
then
|
which gshuf &> /dev/null
|
||||||
echo "Error: shuf isn't installed!"
|
if [ $? -eq 1 ]
|
||||||
return 1
|
then
|
||||||
fi
|
echo "Error: shuf isn't installed!"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
pass=$(shuf -n4 /usr/share/dict/words | tr '\n' ' ')
|
pass=$(shuf -n4 /usr/share/dict/words | tr '\n' ' ')
|
||||||
echo "With spaces (easier to memorize): $pass"
|
echo "With spaces (easier to memorize): $pass"
|
||||||
echo "Without (use this as the pass): $(echo $pass | tr -d ' ')"
|
echo "Without (use this as the pass): $(echo $pass | tr -d ' ')"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function for previewing markdown files in the browser
|
pmdown ()
|
||||||
|
{
|
||||||
function pmdown() {
|
about preview markdown file in a browser
|
||||||
if command -v markdown &>/dev/null
|
param 1: markdown file
|
||||||
then
|
example $ pmdown README.md
|
||||||
markdown $1 | browser
|
if command -v markdown &>/dev/null
|
||||||
else
|
then
|
||||||
echo "You don't have a markdown command installed!"
|
markdown $1 | browser
|
||||||
fi
|
else
|
||||||
|
echo "You don't have a markdown command installed!"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Make a directory and immediately 'cd' into it
|
mkcd ()
|
||||||
|
{
|
||||||
function mkcd() {
|
about make a directory and cd into it
|
||||||
mkdir -p "$*"
|
param path to create
|
||||||
cd "$*"
|
example $ mkcd foo
|
||||||
|
example $ mkcd /tmp/img/photos/large
|
||||||
|
mkdir -p "$*"
|
||||||
|
cd "$*"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Search through directory contents with grep
|
lsgrep ()
|
||||||
|
{
|
||||||
function lsgrep(){
|
about search through directory contents with grep
|
||||||
ls | grep "$*"
|
ls | grep "$*"
|
||||||
}
|
|
||||||
|
|
||||||
# View man documentation in Preview
|
|
||||||
pman () {
|
|
||||||
man -t "${1}" | open -f -a $PREVIEW
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pcurl() {
|
pman ()
|
||||||
curl "${1}" | open -f -a $PREVIEW
|
{
|
||||||
|
about view man documentation in Preview
|
||||||
|
param 1: man page to view
|
||||||
|
example $ pman bash
|
||||||
|
man -t "${1}" | open -f -a $PREVIEW
|
||||||
}
|
}
|
||||||
|
|
||||||
pri() {
|
|
||||||
ri -T "${1}" | open -f -a $PREVIEW
|
pcurl ()
|
||||||
|
{
|
||||||
|
about download file and Preview it
|
||||||
|
param 1: download URL
|
||||||
|
example $ pcurl http://www.irs.gov/pub/irs-pdf/fw4.pdf
|
||||||
|
curl "${1}" | open -f -a $PREVIEW
|
||||||
}
|
}
|
||||||
|
|
||||||
quiet() {
|
pri ()
|
||||||
|
{
|
||||||
|
about display information about Ruby classes, modules, or methods, in Preview
|
||||||
|
param 1: Ruby method, module, or class
|
||||||
|
example $ pri Array
|
||||||
|
ri -T "${1}" | open -f -a $PREVIEW
|
||||||
|
}
|
||||||
|
|
||||||
|
quiet ()
|
||||||
|
{
|
||||||
$* &> /dev/null &
|
$* &> /dev/null &
|
||||||
}
|
}
|
||||||
|
|
||||||
banish-cookies() {
|
banish-cookies ()
|
||||||
|
{
|
||||||
|
about redirect .adobe and .macromedia files to /dev/null
|
||||||
rm -r ~/.macromedia ~/.adobe
|
rm -r ~/.macromedia ~/.adobe
|
||||||
ln -s /dev/null ~/.adobe
|
ln -s /dev/null ~/.adobe
|
||||||
ln -s /dev/null ~/.macromedia
|
ln -s /dev/null ~/.macromedia
|
||||||
}
|
}
|
||||||
|
|
||||||
# disk usage per directory
|
|
||||||
# in Mac OS X and Linux
|
|
||||||
usage ()
|
usage ()
|
||||||
{
|
{
|
||||||
|
about disk usage per directory, in Mac OS X and Linux
|
||||||
|
param 1: directory name
|
||||||
if [ $(uname) = "Darwin" ]; then
|
if [ $(uname) = "Darwin" ]; then
|
||||||
if [ -n $1 ]; then
|
if [ -n $1 ]; then
|
||||||
du -hd $1
|
du -hd $1
|
||||||
|
|
@ -96,25 +126,31 @@ usage ()
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# One thing todo
|
t ()
|
||||||
function t() {
|
{
|
||||||
if [[ "$*" == "" ]] ; then
|
about one thing todo
|
||||||
cat ~/.t
|
param if not set, display todo item
|
||||||
else
|
param 1: todo text
|
||||||
echo "$*" > ~/.t
|
if [[ "$*" == "" ]] ; then
|
||||||
fi
|
cat ~/.t
|
||||||
|
else
|
||||||
|
echo "$*" > ~/.t
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Checks for existence of a command
|
command_exists ()
|
||||||
command_exists () {
|
{
|
||||||
|
about checks for existence of a command
|
||||||
|
param 1: command to check
|
||||||
|
example $ command_exists ls && echo 'exists'
|
||||||
type "$1" &> /dev/null ;
|
type "$1" &> /dev/null ;
|
||||||
}
|
}
|
||||||
|
|
||||||
# List all plugins and functions defined by bash-it
|
plugins-help ()
|
||||||
function plugins-help() {
|
{
|
||||||
|
about list all plugins and functions defined by bash-it
|
||||||
echo "bash-it Plugins Help-Message"
|
echo "bash-it Plugins Help-Message"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
set | grep "()" \
|
set | grep "()" \
|
||||||
| sed -e "/^_/d" | grep -v "BASH_ARGC=()" \
|
| sed -e "/^_/d" | grep -v "BASH_ARGC=()" \
|
||||||
|
|
@ -128,10 +164,12 @@ function plugins-help() {
|
||||||
| grep -v "COMPREPLY=()" | sed -e "s/()//"
|
| grep -v "COMPREPLY=()" | sed -e "s/()//"
|
||||||
}
|
}
|
||||||
|
|
||||||
# back up file with timestamp
|
|
||||||
# useful for administrators and configs
|
# useful for administrators and configs
|
||||||
buf () {
|
buf ()
|
||||||
filename=$1
|
{
|
||||||
filetime=$(date +%Y%m%d_%H%M%S)
|
about back up file with timestamp
|
||||||
|
param filename
|
||||||
|
local filename=$1
|
||||||
|
local filetime=$(date +%Y%m%d_%H%M%S)
|
||||||
cp ${filename} ${filename}_${filetime}
|
cp ${filename} ${filename}_${filetime}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue