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 | |
# 7am-9am,5pm-9pm | |
ek_peak_current="0.2213" | |
# 9am-5pm, 9pm-11pm | |
ek_off_peak_shoulder_current="0.1372" | |
# 11pm to 7am | |
ek_off_peak_night_current="0.1107" | |
ek_daily_current="1.99" |
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
abable | |
abacreling | |
abactufficken | |
abaling | |
abange | |
abansery | |
abild | |
abilecially | |
abinallimocreserve | |
abincength |
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
__complete_ssh_host() { | |
local ssh_known_file ssh_known_list partial_word | |
ssh_known_file="${HOME}/.ssh/known_hosts" | |
[[ -r "${ssh_known_file}" ]] || return 1 | |
ssh_known_list=$(awk '{print $1}' "${HOME}"/.ssh/known_hosts | tr ',' '\n' | sort | uniq) | |
partial_word="${COMP_WORDS[COMP_CWORD]}"; | |
mapfile -t COMPREPLY < <(compgen -W "${ssh_known_list}" -- "${partial_word}") | |
return 0 | |
} |
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
# Because $SHELL is an unreliable thing to test against, we provide this function | |
# This won't work for 'fish', which needs 'ps -p %self' or similar | |
# non-bourne-esque syntax. | |
# TO-DO: Investigate application of 'export PS_PERSONALITY="posix"' | |
get_shell() { | |
if [ -r "/proc/$$/cmdline" ]; then | |
# We use 'tr' because 'cmdline' files have NUL terminated lines | |
# TO-DO: Possibly handle multi-word output e.g. 'busybox ash' | |
printf -- '%s\n' "$(tr '\0' ' ' </proc/"$$"/cmdline)" | |
elif ps -p "$$" >/dev/null 2>&1; then |
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 | |
# check_user_lastseen - report on users who have not logged in for a while | |
# Purpose: | |
# This script tries to find idle accounts and any orphaned homedirs | |
# Currently is Linux biased but capacity for portability is there | |
# Author: Rawiri Blundell | |
# Copyright: See provided LICENCE file | |
############################################################################### | |
# Source the config mapping library | |
# Provides variables "${thisHost}", "${thisJob}" and |
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 | |
# Regenerate your known_hosts file after rotating your keys | |
# Generate a list of hosts that we're more likely to care about, divined from our shell history | |
# Adjust filtering in the final 'grep -Ev' to suit your needs | |
# n.b. typos and stale entries will fail in subsequent steps, so don't sweat this too much | |
get_historical_hosts() { | |
grep "^ssh " "${HOME}/.bash_history" | | |
tr " " "\n" | | |
grep -Ev '^ssh$|^-v+|^-[a-zA-Z]$|^.*.pem$|^".*.pem"$|^raw$|^$|^~|^.$' | |
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 | |
while read -r file; do | |
printf -- '%s;%s\n' "$(md5sum < "${file}" | awk '{print $1}')" "$(stat -c "%a;%U;%G;%n" "${file}")" | |
done < <(find . -type f -print) > data.manifest | |
51e7d30fab63ba29f86bcf6f807b88cf;674;jenkins;jenkins;./org.jenkinsci.plugins.gitclient.JGitApacheTool.xml | |
0a363d9165e56856e0f693152fc0fe88;644;jenkins;jenkins;./queue.xml.bak | |
d99c0a9f0563b0203c6ce7d778a14338;674;jenkins;jenkins;./hudson.plugins.disk_usage.DiskUsageProperty.xml | |
671c3c9ef67c47d75f73d4d9280e2b28;674;jenkins;jenkins;./org.jenkinsci.plugins.workflow.libs.GlobalLibraries.xml |
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 | |
table_max_width="${2:-80}" | |
# TO-DO: Add some smarts at this point to minimise issues caused by uneven column widths | |
# Subtract for our pipechars | |
# ---------|-----|------|-----|------|-----|------| | |
# ^ ^ ^ ^ These particular guys | |
columns_max_width="$(( table_max_width - 4 ))" |
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
apt() { | |
case "${1}" in | |
(history) | |
mapfile -t apt_hist < <(zgrep -A 1 "^Start-Date" /var/log/apt/history.log* | grep -v -- "^--$") | |
left_col_width="$(( "${COLUMNS:-$(tput cols)}" - 30 ))" | |
# The format of this printf invocation needs to be tweaked | |
printf -- "| %-${left_col_width}s | %s\\n" "Command line" "Date and time" | |
printf -- '%*s\n' "${COLUMNS:-$(tput cols)}" | tr ' ' "-" | |
for (( i=0; i<"${#apt_hist[@]}"; i++ )); 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
#!/bin/bash | |
# check_linux_lastpatched - Check when a Linux host was last patched and warn | |
# if a specified time period is exceeded | |
# Purpose: checkmk local check to ensure we keep Linux hosts patched | |
# Author: Rawiri Blundell | |
# Copyright: See provided LICENCE file | |
# Date: 20211102 partial rewrite, originally written 20170828 | |
# Usage: ./check_linux_lastpatched [warn threshold (days)] [crit threshold (days)] | |
# n.b. warn threshold defaults to 9 months, crit threshold to 12. |
NewerOlder