• Stars
    star
    110
  • Rank 316,770 (Top 7 %)
  • Language
    Shell
  • License
    MIT License
  • Created over 9 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Random shell scripts for different tasks

scripts License GitHub Stars GitHub Forks GitHub Watchers Tweet

by Rafał Pocztarski Follow on GitHub Follow on Twitter

https://github.com/rsp/scripts

Random shell scripts for different tasks, written mostly for answers on Stack Overflow:
Follow on Stack Exchange

Examples

Some common command shortcuts for Git et al.:

  • auu - apt-get update and upgrade for Debian or Ubuntu
  • ga - git add
  • gcm - git commit with message quoted automatically
  • gpod - 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 address
  • externalip - get your external IP address
  • sound - play a sound a wait to finish
  • soundbg - play a sound in background
  • sn1/sn2/sn3 - good sounds for notifications
  • ok - prints OK/ERROR if the last command succeeded/failed
  • oks - like ok but with different sounds played on success/failure

Details

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:

Functions

ok-functions

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.

Scripts

ga

Usage: ga file [file ...]

Source: https://rawgit.com/rsp/scripts/master/ga

Runs: git add file [file ...]

See ga.md for more info.

gcm

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.

gpodn

Usage: gpodn

Source: https://rawgit.com/rsp/scripts/master/gpodn

Runs: git push origin develop (no tags)

See gpodn.md for more info.

gpodt

Usage: gpodt

Source: https://rawgit.com/rsp/scripts/master/gpodt

Runs: git push origin develop --tags

See gpodt.md for more info.

gpod

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.

gpomn

Usage: gpomn

Source: https://rawgit.com/rsp/scripts/master/gpomn

Runs: git push origin master (no tags)

See gpomn.md for more info.

gpomt

Usage: gpomt

Source: https://rawgit.com/rsp/scripts/master/gpomt

Runs: git push origin master --tags

See gpomt.md for more info.

gpom

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.

auu

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.

internalip

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.

externalip

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.

externalip-benchmark

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.

Installation

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.

Installing scripts

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.

Installing functions

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.

Issues

For any bug reports or feature requests please post an issue on GitHub.

Author

Rafał Pocztarski
Follow on GitHub Follow on Twitter
Follow on Stack Exchange

License

MIT License (Expat). See LICENSE.md for details.

More Repositories

1

node-websocket-vs-socket.io

Comparing WebSocket and Socket.IO on Node.js with Express.js
HTML
102
star
2

node-static-http-servers

Examples of serving static files with HTTP using Node.js
JavaScript
35
star
3

gh-pages-no-extension

GitHub Pages test with no .html extentson
HTML
21
star
4

deno-clipboard

The clipboard copy/paste API for Deno
TypeScript
16
star
5

travis-hello-modern-cpp

Simple Travis example using C++ with modern compilers
Shell
14
star
6

node-caught

A function to avoid UnhandledPromiseRejectionWarning and PromiseRejectionHandledWarning
JavaScript
10
star
7

node-tco

Tail call optimization in Node
JavaScript
9
star
8

deno-dirname

Node-style __dirname and __filename polyfill for Deno
TypeScript
8
star
9

node-express-static-example

Example for Stack Overflow
HTML
7
star
10

docker-experiments

See what tools are available by default in Docker images and other Docker experiments
Shell
6
star
11

node-live-color

Changing website background color live with Node/Express/Socket.io
JavaScript
5
star
12

node-is-not-letter

JavaScript
5
star
13

pg-scott

Classical Scott database (EMP, DEPT, SALGRADE) for PostgreSQL
PLpgSQL
5
star
14

ts-no-new

TypeScript constructors without 'new' keyword - several attempts by @rsp
TypeScript
5
star
15

node-socket.io-remote

An example of remotely controlled web page with Node and Socket.IO
HTML
4
star
16

t.ts

A t.ts standard for adding TypeScript type definitions to JavaScript modules alternative to d.ts files
TypeScript
4
star
17

nw1

Node Workshop - Lesson 1
3
star
18

warsawjs-workshop-22-unit-converter

Unit Converter Project for WarsawJS Workshop 22 Group 1 by @rsp
JavaScript
3
star
19

node-hapi-helpers

Define hapi.js routes with less code
JavaScript
2
star
20

deno-wabt

A Deno port of https://github.com/AssemblyScript/wabt.js which is a JS port of https://github.com/WebAssembly/wabt
JavaScript
2
star
21

git-experiments

Some experiments with git commits, hashes and collisions
Shell
2
star
22

node-promise-monofill

A module that exports native Promise. Always.
JavaScript
2
star
23

node-nested-project-structure-example

Node.js nested module structure example
JavaScript
1
star
24

nodekeeper-4-test

Test repo for nodekeeper-4
1
star
25

docker-pg-scott

PostgreSQL with a classical Scott database (EMP, DEPT, SALGRADE) in Docker
PLpgSQL
1
star
26

warsawjs-workshop-31-calendar

warsawjs-workshop-31-calendar
JavaScript
1
star
27

node-isoso

isoso - ISO 8601 Simple Operations - CLI date manipulation
JavaScript
1
star
28

rsp

README for @rsp
1
star
29

cmi

cmi
CSS
1
star
30

node-the-global-object

The global object in Node or in the browser
JavaScript
1
star
31

travis-hello-cpp

Simple Travis example using C++
Shell
1
star
32

scripting-wars

A competition between scripting languages
1
star
33

warsawjs-workshop-23-unit-converter

Unit Converter Project for WarsawJS Workshop 23 Group 1 by @rsp
JavaScript
1
star
34

node-immoment

Immutable Moment - Like Moment.js but without surprises
JavaScript
1
star
35

node-rsp

Radically Simplifed Promises - call methods on values in the future
JavaScript
1
star
36

ppj

random Java examples
Java
1
star
37

warsawjs-workshop-23-warmup

WarsawJS Workshop #23 - Warmup Project
JavaScript
1
star
38

nodekeeper-20

Makes Greenkeeper re-run your tests on new Node.js 20.x releases
1
star
39

deno-rand

Random utilities for getting random numbers in Deno
TypeScript
1
star
40

nw2

Node Workshop - Lesson 2
JavaScript
1
star
41

node-filt

filt is for simple filters: node -e 'require("filt")(line => line.toUpperCase())'
JavaScript
1
star
42

ajax-cdn-speed-test

a speed test for free CDNs hosting JavaScript libraries
Shell
1
star