https://github.com/rsp/scripts
Random shell scripts for different tasks,
written mostly for answers on Stack Overflow:
Some common command shortcuts for Git et al.:
auu
- apt-get update and upgrade for Debian or Ubuntuga
- git addgcm
- git commit with message quoted automaticallygpod
- git push origin develop (with/without tags)gpom
- git push origin master (with/without tags)
Some other tools and commands:
internalip
- get your internal IP addressexternalip
- get your external IP addresssound
- play a sound a wait to finishsoundbg
- play a sound in backgroundsn1
/sn2
/sn3
- good sounds for notificationsok
- prints OK/ERROR if the last command succeeded/failedoks
- likeok
but with different sounds played on success/failure
Those commands are mostly for Linux but I would like them to work on as many systems as possible - certainly on all POSIX systems. If anything doesn't work, please post an issue.
Work in progress - more to come. See:
Some of those scripts were written for my answers on Stack Exchange:
- Make a sound once process is complete (on Ask Ubuntu)
- How can I get my external IP address in bash? (on Unix & Linux)
- How do I find my internal ip address? (on Ask Ubuntu) Some are just for my own conveniece. Maybe they would be useful to someone else.
Usage:
sn1
sn2
sn3
ok
oks
For example to hear when a long-running command finishes and to hear a different sound on success and on failure:
Example with success:
ls / && ls /bin && ls /usr; oks
example with error:
ls / && ls /bim && ls /usr; oks
See ok-functions.md for more info.
Usage: ga file [file ...]
Source: https://rawgit.com/rsp/scripts/master/ga
Runs: git add file [file ...]
See ga.md for more info.
Usage: gcm your message
(no quoting needed)
Source: https://rawgit.com/rsp/scripts/master/gcm
Runs: git commit message -m ...
Running: gcm your message
is equivalent to: git commit -m "your message"
(note the automatic quoting)
See gcm.md for more info.
Usage: gpodn
Source: https://rawgit.com/rsp/scripts/master/gpodn
Runs: git push origin develop
(no tags)
See gpodn.md for more info.
Usage: gpodt
Source: https://rawgit.com/rsp/scripts/master/gpodt
Runs: git push origin develop --tags
See gpodt.md for more info.
Usage: gpod
Source: https://rawgit.com/rsp/scripts/master/gpod
Runs: git push origin develop --tags
(by default it's the same as gpodt
)
See gpod.md for more info.
Usage: gpomn
Source: https://rawgit.com/rsp/scripts/master/gpomn
Runs: git push origin master
(no tags)
See gpomn.md for more info.
Usage: gpomt
Source: https://rawgit.com/rsp/scripts/master/gpomt
Runs: git push origin master --tags
See gpomt.md for more info.
Usage: gpom
Source: https://rawgit.com/rsp/scripts/master/gpom
Runs: git push origin master --tags
(by default it's the same as gpomt
)
See gpom.md for more info.
Usage: sudo auu
Source: https://rawgit.com/rsp/scripts/master/auu
Update and upgrade a Debian, Ubuntu or other APT-based Linux system.
See auu.md for more info.
Usage: internalip [TARGET]
Source: https://rawgit.com/rsp/scripts/master/internalip
Get internal IP address used for outgoing Internet connections.
TARGET is an IP address, 8.8.8.8
by default,
or a host name (if gethostip
or getent
are available on the system).
See internalip.md for more info.
Usage: externalip [METHOD]
Source: https://rawgit.com/rsp/scripts/master/externalip
Get external IP address that is visible by servers that you connect to over Internet.
METHOD can be: dns (default), http, https, ftp, telnet.
See externalip.md for more info.
Usage: externalip-benchmark
Source: https://rawgit.com/rsp/scripts/master/externalip-benchmark
Find what services providing external IP address via http and https are the fastest.
See externalip-benchmark.md for more info.
Most of those scripts should be stand-alone and can be copied in any place. Those commands describes as functions need to be installed differently, see below.
My recommendation is to make a ~/bin
or ~/scripts
directory:
mkdir ~/bin
and put this in your ~/.bashrc
or ~/.profile
:
[ -d "$HOME/bin" ] && PATH="$HOME/bin:$PATH"
That way it's easy to put any script there:
cd ~/bin
wget https://rawgit.com/rsp/scripts/master/example
less example # see what was downloaded
chmod a+x example
And use it at will. Of course always see what was downloaded first.
Those commands described as functions need to be sourced to work,
either manually or in a file like .profile
, .bashrc
etc.
They don't have to be in your PATH and they don't have to be executable. You can download them whenever you want, for example in your $HOME directory:
cd ~
wget https://rawgit.com/rsp/scripts/master/example-functions
less example-functions # see what was downloaded
Now you source them with .
(dot) or source
command:
. example-functions
If you put the sourcing line in your .profile
or .bashrc
they will be
available after all logins.
For any bug reports or feature requests please post an issue on GitHub.
MIT License (Expat). See LICENSE.md for details.