This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function wait4tcp () { | |
local nc opt silence op host port ret failed limit tries | |
local OPTIND OPTARG | |
limit=100 | |
op="open" | |
while getopts ":csw:" opt; do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
shopt -s dotglob | |
function filecount { | |
DIR=$(dirname "${1:-.}/nonexistentfile") | |
for item in "${DIR}"/*; do | |
COUNT=$(($(find "${item}" | wc -l)-1)) | |
if [[ $COUNT -gt 0 ]]; then | |
echo "${COUNT}: ${item}"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Fail on any error | |
set -e | |
# Debug | |
# set -x | |
########################################################################### | |
####### Set below as appropropriate for your environment ################## |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# set -x | |
## | |
## DNS timing "one-liner" | |
## | |
function _dns_timing() { | |
local EMAIL='[email protected]' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# set -e | |
SERVER='<<myserver>>._afpovertcp._tcp.local' | |
VOLUMES=( 'share1' 'share2' ) | |
echo "" | |
echo "$(date)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# From: https://stackoverflow.com/questions/7474354/include-jquery-in-the-javascript-console?noredirect=1&lq=1 | |
javascript:(function(e,s){e.src=s;e.onload=function(){jQuery.noConflict();console.log('jQuery injected')};document.head.appendChild(e);})(document.createElement('script'),'//code.jquery.com/jquery-latest.min.js') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Download all photos from an Instagram page | |
var jq = document.createElement('script'); | |
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"; | |
document.getElementsByTagName('head')[0].appendChild(jq); | |
// ... give time for script to load, then type (or see below for non wait option) | |
jQuery.noConflict(); | |
$('img').each(function(i, el) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
DISK="Moody Mona" # Name of a directory mounted in /Volumes | |
INTERVAL=15 | |
while true; do | |
s1=$(df -m | grep "$DISK" | awk '{print $3}') | |
echo "s1=$s1" >&2 | |
sleep $INTERVAL | |
s2=$(df -m | grep "$DISK" | awk '{print $3}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# List all packages on an Ubuntu system sorted by size they take up on disk | |
sudo dpkg-query --list | awk '{print $2}' | xargs -I% -n1 dpkg-query --status % 2>/dev/null | egrep 'Package: |Installed-Size:' | sed '$!N;s/\n/\t/' | head -n 100 | sort -r -n -k4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
WWW_DIR=/var/www/html | |
mkdir -p $WWW_DIR/vnstat | |
# Generate some graphs now | |
sudo -u www-data bash -c ' | |
/usr/bin/vnstati -vs -o $WWW_DIR/vnstat/vnstat.png -i ens3 && |
NewerOlder