Skip to content

Instantly share code, notes, and snippets.

@lyndell
lyndell / OSTYPE test
Last active May 16, 2023 04:06
test for the OS with the shell environment variable $OSTYPE
#!/bin/bash -x
#
# From: http://stackoverflow.com/questions/394230/detect-the-os-from-a-bash-script
PLATFORM=$(uname)
case "$PLATFORM" in
"Darwin")
# macOS
;;
"Linux")
@lyndell
lyndell / pingtimer.sh
Last active November 7, 2017 23:23
Monitor network, gathering ping and HTTP headers
#!/bin/bash
#
# Name: pingtimer.sh
# Desc: Monitor network, gathering ping and HTTP headers
# URL: https://gist.github.com/lyndell/21d7ada9774784b03da1
#
# Author: Lyndell Rottmann
# WWW: http://Lyndell.US
# Copyright (c) 2015 Lyndell Rottmann
#
@lyndell
lyndell / rmkey.sh
Last active November 25, 2024 05:10
rmkey
#!/bin/bash
#
# Name: rmkey.sh
# Desc: Remove an IP's fingerprint from the SSH known_hosts file
# URL: https://gist.github.com/lyndell/c2f53d0c3e3c0e37af70
#
# Author: Lyndell Rottmann
# WWW: http://Lyndell.US
# Copyright (c) 2015 Lyndell Rottmann
#
@lyndell
lyndell / tarNdate.sh
Last active December 16, 2015 08:21
tarNdate
#!/bin/bash -x
#
# Name: tarNdate
# Desc: Wrap up a directory in a tar file with the directy's date.
# URL: https://gist.github.com/lyndell/853a2ade7e579f281933
#
# Author: Lyndell Rottmann
# WWW: http://Lyndell.US
# Copyright (c) 2015 Lyndell Rottmann
#
@lyndell
lyndell / fping.sh
Last active December 16, 2015 05:31
Ping multiple IPs
#/bin/bash -x
#
# Copyright (c) 2015 Lyndell Rottmann
#
# Debug mode on/off: (default off)
set +x
if [ -z "$@" ];then
echo "I can haz IPs?"
@lyndell
lyndell / backup-home
Last active August 29, 2015 14:05
Backup-home
#!/bin/bash
#
# Author: Lyndell
# URL: http://www.Lyndell.US/
# gist: https://gist.github.com/6f864b63759153eee197.git
#
#
#
# Quick script to backup the home directory in \*nix environment to other servers.
#
@lyndell
lyndell / du-logs.sh
Last active October 23, 2015 04:44
Disk usage from logs.
#!/bin/bash
#
# Example output:
#
# ```bash
# root@server [~]# df -h /usr
# Filesystem Size Used Avail Use% Mounted on
# /dev/sda3 7.8G 7.4G 112K 100% /usr
# root@server [~]#
# root@server [~]# cd /usr/local/
@lyndell
lyndell / traceme.sh
Last active December 18, 2015 02:21
collect traceroutes
#!/bin/bash -x
trap exit SIGINT
while (true)
do
echo
echo
curl -D - http://icanhaztrace.com
@lyndell
lyndell / by.sh
Last active July 10, 2016 02:49
Open a new file in ByWord
#/bin/bash -x
#
# Copyright (c) 2015 Lyndell Rottmann
#
# Debug mode on/off: (default off)
set +x
if [[ "$OSTYPE" == "darwin"* ]]; then
if [ ! $1 ]
@lyndell
lyndell / GOTO.php
Last active December 30, 2015 15:57
Home sweet home infinite loop
<?php
header('Content-Type: text/plain');
# GOTO
echo "\n\n";
echo "with GOTO:\n";
home: