help metadata for base plugin
parent
a8fcf9f18c
commit
a3c3caa0ab
|
|
@ -2,20 +2,30 @@
|
||||||
|
|
||||||
# For generic functions.
|
# For generic functions.
|
||||||
|
|
||||||
function ips {
|
ips ()
|
||||||
|
{
|
||||||
|
about display all ip addresses for this host
|
||||||
ifconfig | grep "inet " | awk '{ print $2 }'
|
ifconfig | grep "inet " | awk '{ print $2 }'
|
||||||
}
|
}
|
||||||
|
|
||||||
function down4me() {
|
down4me ()
|
||||||
|
{
|
||||||
|
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'
|
curl -s "http://www.downforeveryoneorjustme.com/$1" | sed '/just you/!d;s/<[^>]*>//g'
|
||||||
}
|
}
|
||||||
|
|
||||||
function myip {
|
myip ()
|
||||||
|
{
|
||||||
|
about displays your ip address, as seen by the Internet
|
||||||
res=$(curl -s checkip.dyndns.org | grep -Eo '[0-9\.]+')
|
res=$(curl -s checkip.dyndns.org | grep -Eo '[0-9\.]+')
|
||||||
echo -e "Your public IP is: ${echo_bold_green} $res ${echo_normal}"
|
echo -e "Your public IP is: ${echo_bold_green} $res ${echo_normal}"
|
||||||
}
|
}
|
||||||
|
|
||||||
pass() {
|
pass ()
|
||||||
|
{
|
||||||
|
about generates password from random dictionary words
|
||||||
which gshuf &> /dev/null
|
which gshuf &> /dev/null
|
||||||
if [ $? -eq 1 ]
|
if [ $? -eq 1 ]
|
||||||
then
|
then
|
||||||
|
|
@ -28,9 +38,11 @@ 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
|
||||||
|
param 1: markdown file
|
||||||
|
example $ pmdown README.md
|
||||||
if command -v markdown &>/dev/null
|
if command -v markdown &>/dev/null
|
||||||
then
|
then
|
||||||
markdown $1 | browser
|
markdown $1 | browser
|
||||||
|
|
@ -39,47 +51,65 @@ function pmdown() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Make a directory and immediately 'cd' into it
|
mkcd ()
|
||||||
|
{
|
||||||
function mkcd() {
|
about make a directory and cd into it
|
||||||
|
param path to create
|
||||||
|
example $ mkcd foo
|
||||||
|
example $ mkcd /tmp/img/photos/large
|
||||||
mkdir -p "$*"
|
mkdir -p "$*"
|
||||||
cd "$*"
|
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 () {
|
pman ()
|
||||||
|
{
|
||||||
|
about view man documentation in Preview
|
||||||
|
param 1: man page to view
|
||||||
|
example $ pman bash
|
||||||
man -t "${1}" | open -f -a $PREVIEW
|
man -t "${1}" | open -f -a $PREVIEW
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pcurl() {
|
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
|
curl "${1}" | open -f -a $PREVIEW
|
||||||
}
|
}
|
||||||
|
|
||||||
pri() {
|
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
|
ri -T "${1}" | open -f -a $PREVIEW
|
||||||
}
|
}
|
||||||
|
|
||||||
quiet() {
|
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,8 +126,11 @@ usage ()
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# One thing todo
|
t ()
|
||||||
function t() {
|
{
|
||||||
|
about one thing todo
|
||||||
|
param if not set, display todo item
|
||||||
|
param 1: todo text
|
||||||
if [[ "$*" == "" ]] ; then
|
if [[ "$*" == "" ]] ; then
|
||||||
cat ~/.t
|
cat ~/.t
|
||||||
else
|
else
|
||||||
|
|
@ -105,14 +138,17 @@ function t() {
|
||||||
fi
|
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
|
||||||
|
|
||||||
|
|
@ -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