Skip to content

Instantly share code, notes, and snippets.

View rsvp's full-sized avatar
🎧
say hi ! https://gitter.im/rsvp/pub

Adriano rsvp

🎧
say hi ! https://gitter.im/rsvp/pub
View GitHub Profile
@rsvp
rsvp / uniqnosort
Created January 17, 2011 03:13
uniqnosort : uniq replacement -- shell script to get unique lines WITHOUT prior sort -- preserves original ordering where any subsequent duplicates are removed. Duplicates do NOT have to be adjacent to each other!
#!/usr/bin/env bash
# bash 4.1.5(1) Linux Ubuntu 10.04 Date : 2011-01-16
#
# _______________| uniqnosort : get unique lines WITHOUT sorting.
#
# Usage: uniqnosort [file, or use as pipe]
#
# NB: More famous "uniq" requires duplicates on adjacent lines.
# If you really want to sort and get uniques,
# try "sort -u" rather than "sort | uniq".
@rsvp
rsvp / httpstatus
Created August 25, 2011 18:00
httpstatus : bash script to get HTTP response code with optional status message (includes verbose definitions in comment)
#!/usr/bin/env bash
# bash 4.1.5(1) Linux Ubuntu 10.04 Date : 2011-08-25
#
# _______________| httpstatus : get HTTP status code
#
# Usage: httpstatus URL [timeout] [--code or --status] [see 4.]
# ^message with code (default)
# ^code (numeric only)
# ^in secs (default: 3)
# ^URL without "http://" prefix works fine.
@rsvp
rsvp / noise.sh
Last active April 18, 2024 14:18
noise : relaxing ambient Brown noise generator (cf. white noise) | Linux bash script using sox | CogSci notes
#!/usr/bin/env bash
# bash 4.1.5(1) Linux Ubuntu 10.04 Date : 2019-01-02
#
# _______________| noise : ambient Brown noise generator (cf. white noise).
#
# Usage: noise [minutes=59] [band-pass freq center=1786] [wave]
# ^minutes can be any positive integer.
# Command "noise 1" will display peak-level meter.
#
# Dependencies: play (from sox package)
@rsvp
rsvp / netspeed.sh
Last active May 13, 2020 15:08
netspeed.sh : check download speed rate via command line | Linux bash script
#!/usr/bin/env bash
# bash 4.1.5(1) Linux Ubuntu 10.04 Date : 2013-07-11
#
# _______________| netspeed : check download speed via command line.
#
# Usage: netspeed [tokyo, london, usw, use, east, west, URL]
# ^default U.S. west coast.
# [ -speed_KB/sec ]
# ^negation activates the Mbps converter.
#
@rsvp
rsvp / flippar.sh
Created December 10, 2011 04:17
flippar.sh : reverse the order of paragraph blocks where such blocks are delimited by two or more newlines.
#!/usr/bin/env bash
# bash 4.1.5(1) Linux Ubuntu 10.04 Date : 2011-12-10
#
# _______________| flippar : reverse order of paragraph blocks
# (delimited by two or more newlines;
# last block is exempt from this rule).
#
# Usage: flippar [filename (pipe acceptable)]
#
# Dependencies: tac (from package 'coreutils' in main)
@rsvp
rsvp / prepend.sh
Created December 14, 2011 16:12
prepend.sh : insert text above given line number (the first by default) or pattern. Bash script.
#!/usr/bin/env bash
# bash 4.1.5(1) Linux Ubuntu 10.04 Date : 2011-12-14
#
# _______________| prepend : insert text above given line number or pattern.
#
# Usage: prepend ["text"] [filename=stdin] [linenum=1 OR pattern]
#
# Example: prepend "TEST1\nTEST2" foo 3
# # insert two test lines above the third line in file foo.
# sort foo | prepend "Sorted result:"
@rsvp
rsvp / country.sh
Created January 22, 2012 01:42
country.sh : look-up country name, its ISO code or foreign exchange currency symbol. Necessary data is contained within this Linux bash script, so it's very fast.
#!/usr/bin/env bash
# bash 4.1.5(1) Linux Ubuntu 10.04 Date : 2012-01-15
#
# _______________| country : look-up country ISO code or currency symbol.
#
# Usage: country [term] ["iso"|"fx"]
# where "fx" is foreign exchange,
# "iso" is the default option,
# term is case-insensitive regular expression.
#
@rsvp
rsvp / lstest.sh
Created February 8, 2012 03:41
lstest.sh : list files by type (regular, directory, symbolic link, named pipe, etc.), and optionally show detailed information unavailable via the ls command (while also properly handling dot files). Linux bash script.
#!/usr/bin/env bash
# bash 4.1.5(1) Linux Ubuntu 10.04 Date : 2012-02-04
#
# _______________| lstest : list files by type, optionally show further info.
#
# Usage: lstest [test flag] [-0|-1|-A|-i|-I|-a] [--count]
#
# ^attributes
# ^terse "stat"
# ^info via "stat"
@rsvp
rsvp / digy.sh
Created February 14, 2012 06:26
digy.sh : tame DNS utility dig with reasonable options. Linux bash HOWTO use dig script, get WAN public IP address, check local network status, and contact who is behind sites.
#!/usr/bin/env bash
# bash 4.1.5(1) Linux Ubuntu 10.04 Date : 2012-02-17
#
# _______________| digy : tame DNS utility dig with reasonable options.
#
# Usage: digy [address] [rev|name|short|mail|all|long|longa|who]
#
# Examples: % digy friendfeed.com
# 69.63.180.52
# # default second argument is 'short'
@rsvp
rsvp / freqy.sh
Created February 18, 2012 15:43
freqy.sh : sort lines by their frequency count -- a very useful idiom as Linux bash script.
#!/usr/bin/env bash
# bash 3.2.25(1) Ubuntu 7.10 Date : 2012-02-15
#
# _______________| freqy : sort and order lines by frequency of appearance.
#
# Usage: freqy [optional: file(s)]
#
# Notes: Will work in a pipe.
# Does not alter the file(s) themselves.
#