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 | |
ARGS="" | |
function usage() { | |
echo "Usage:" | |
echo " $0 [-c|--count] [-h|--help]" | |
echo "" | |
echo "Lists the folders currently known to LastPass." | |
echo "If the [-c|--count] argument is given, also lists a count per folder." |
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 | |
# Import apt keys into GPG keyring for ease of use. | |
apt-key list | grep ^/ | xargs -n1 gpg --import > /dev/null 2>&1 | |
bad=0 | |
# Check the signature on each apt list. | |
for file in /var/lib/apt/lists/{*_Release,*_InRelease}; do | |
gpg --verify $file > /dev/null 2>&1 |
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
# sudo maas-region shell | |
>>> from maasserver.models import Interface | |
>>> unknown_interfaces = Interface.objects.filter(type='unknown') | |
>>> unknown_interfaces.delete() | |
>>> quit() |
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
maas refresh | |
profile=$(maas list | head -1 | awk '{ print $1 }') | |
# This generates a single JSON object. | |
maas $PROFILE machines read | jq '[.[] | {hostname:.hostname, system_id: .system_id, status:.status}]' | |
... | |
maas $PROFILE machines read | jq '.[] | {hostname:.hostname, system_id: .system_id, status:.status}' --compact-output | |
{"hostname":"pxe-bond1","system_id":"xrey6h","status":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
SELECT | |
sip.ip, | |
CASE | |
WHEN sip.alloc_type = 0 THEN 'AUTO' | |
WHEN sip.alloc_type = 1 THEN 'STICKY' | |
WHEN sip.alloc_type = 4 THEN 'USER_RESERVED' | |
WHEN sip.alloc_type = 5 THEN 'DHCP' | |
WHEN sip.alloc_type = 6 THEN 'DISCOVERED' | |
ELSE CAST(sip.alloc_type as CHAR) | |
END "alloc_type", |
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 -e | |
# Check if we believe the VM has started after this number of samples. | |
CHECK_EVERY=500 | |
# Consider the machine to be idle if MIN_IDLE_PCT% of sampled program counters | |
# were identical after at least MIN_IDLE_SAMPLES. | |
# | |
MIN_IDLE_SAMPLES=450 | |
MIN_IDLE_PCT=60 |
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 -e | |
# This script attempts to dump (non-personal) information about the current | |
# hardware platform. It expects to be run on a modern Linux distribution | |
# (such as Ubuntu). | |
DMI_OUTFILE="$(mktemp)" | |
function finish { | |
rm -f "$DMI_OUTFILE" |
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 | |
OUTFILE=/root/dmi.bin | |
dmidecode -u --dump-bin $OUTFILE && ( | |
echo "-----BEGIN DMI DATA-----" ; | |
base64 $OUTFILE | |
echo "-----END DMI DATA-----" | |
) || (echo "Unable to read DMI information."; exit 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
#!/bin/bash | |
# via http://git.savannah.nongnu.org/cgit/dmidecode.git/tree/dmiopt.c#n142 | |
DMI_STRINGS=" | |
bios-vendor | |
bios-version | |
bios-release-date | |
system-manufacturer | |
system-product-name | |
system-version |
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
CONTAINER=mirror | |
lxc launch ubuntu:x $CONTAINER | |
# Wait for the container to come online. | |
wait-for-systemd-container.sh $CONTAINER | |
# Ensure packages are up to date and install dependencies. | |
lxc exec $CONTAINER -- apt-get update | |
lxc exec $CONTAINER -- apt-get dist-upgrade -yu |