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 | |
declare -A currentAnswer=() | |
declare -A lastAnswer=() | |
while getopts ":s" opt; do | |
case $opt in | |
s) silent=true ;; | |
esac | |
done | |
shift "$((OPTIND-1))" | |
query=${1:-"autodiscover.wip.company.com."} |
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 | |
# Run this script once to set up ACME.sh as a non-root user. After this script is done, it can be removed if you want. The script also can be run multiple times safely such that it will not create multiples of anything. | |
#CFG_ACME_USERNAME='acme' # What do you want to call the user who will fetch certificates? | |
#CFG_CERT_DOMAIN='tst-server.virtual.example.com' # What fully qualified domain name should the certificate be for? | |
#CFG_ACME_SERVER='https://acme-v02.api.letsencrypt.org/directory' # What is the ACME server we should get certificates from? | |
verbosity=2 # Start counting at 2 so that any increase to this will result in a minimum of file descriptor 3. You should leave this alone. | |
maxverbosity=5 # The highest verbosity we use / allow to be displayed. Feel free to adjust. | |
while getopts ":vr" 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
#!/bin/bash | |
# Define variables for adjustable verbosity | |
verbosity=2 #Start counting at 2 so that any increase to this will result in a minimum of file descriptor 3. You should leave this alone. | |
maxverbosity=5 #The highest verbosity we use / allow to be displayed. Feel free to adjust. | |
# Parse requested verbosity level and whether we're logging or not | |
while getopts ":vl" opt; do | |
case $opt in | |
v) (( verbosity=verbosity+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
#!/bin/bash | |
string_searching="Searching..." | |
while read -r -p '? ' name; do | |
printf '%s\r' "$string_searching" >&2 | |
curl --netrc -s -X POST -d 'header=yes' --data-urlencode 'query=SELECT d.name as device_name, SUBSTRING(a.alias_name,1,10) as alias, i.ip_address, d.cpucount as sockets, d.cpucore as cores, d.ram, d.ram_size_type, d.hard_disk_size, d.hard_disk_size_type, REGEXP_REPLACE(SUBSTRING(d.notes,1,100),'"'[\n\r]'"','"' '"','"'g'"') as notes, d.first_added, s.name as subnet from view_device_v1 d left join view_ipaddress_v1 i on i.device_fk = d.device_pk left join view_devicealias_v1 a on a.device_fk = d.device_pk inner join view_subnet_v1 s on i.subnet_fk = s.subnet_pk WHERE LOWER( d.name ) like '"'%${name}%'"' OR LOWER ( a.alias_name ) LIKE '"'%${name}%'"' OR LOWER ( d.notes) LIKE '"'%${name}%'"' order by d.name' 'https://ipam.xxxxxxxxxx.com/services/data/v1.0/query/' 2>&1 | column --table --separator , | |
echo |
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 | |
if [[ "${1,,}" == "install" ]]; then | |
# Call this script with argument 'install' to generate a systemd unit file. | |
cat <<-EOF | sudo dd of=/etc/systemd/system/docker-logs2journal.service | |
[Unit] | |
Description=This service reads from specified log files and outputs to systemd-journald | |
After=network.target | |
[Service] |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<BES xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BES.xsd"> | |
<Task> | |
<Title>Randomize local root user password (Linux) v2</Title> | |
<Description><![CDATA[<P>This task will generate a random passphrase, and set the local root user's password. The passphrase will be encrypted using a public key, base64 encoded, then stored in the properties of the computer object in BigFix. </P> | |
<P>To obtain the password, find the BigFix Client Setting named "bes_random_token", base64 decode it, and decrypt it using the private key.</P> | |
<P><EM>Example 1</EM>:<BR><FONT face=Terminal>user@prd-calypso$</FONT><FONT face=Terminal> <STRONG>echo QIU4bhwiQ0OevCiXcoNmJoPFxpxY5cFkUegCqPd8nkqZdxvVSmIFndp+30n61pT7nMXrYpYypZgHyMVnCoxg0A== | \<BR>openssl enc -d -base64 | openssl rsautl -decrypt -inkey rsa-priv.key</STRONG></FONT></P> | |
<P>You can also add this to your <FONT face=Terminal>~/.bashrc</FONT> file and then run `<FONT face=Terminal>decryptPas |
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 | |
# made this to test the impact of changing a small part of the whole screen versus script(1) file size | |
export rows=$(tput lines); export cols=$(tput cols); | |
while :; do | |
( exec > .tmp-screen-changer.sh; | |
for r in $(seq 1 $rows); do | |
for i in $(seq 1 $cols); do | |
if (( $r == $rows / 2 )); then | |
if (( $i > $cols / 2 - 10 && $i < $cols / 2 + 10 )); then | |
printf '%s' $(head -c 1 <(tr -d -c '[:alpha:]' </dev/urandom)) |
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 | |
# Create: 2014-03-12 John C. Petrucci | |
# Modify: 2014-03-13 John C. Petrucci | |
# http://johncpetrucci.com | |
# Purpose: See usage() | |
# Usage: See usage() | |
usage (){ | |
cat <<EOF | |
$(basename $0) - Converts hexadecimal to IP addresses. |
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 | |
if [[ "${1,,}" == "install" ]]; then | |
# Call this script with argument 'install' to generate a systemd unit file. | |
cat <<-EOF | sudo dd of=/etc/systemd/system/vnc-alive-check.service | |
[Unit] | |
Description=VNC-ALIVE-CHECK: Make sure VNC is connected and restart it if needed. | |
After=network.target | |
[Service] | |
ExecStart=${PWD}/$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 | |
while read VLAN_ID VLAN_NAME SUBNET MASKLEN; do | |
export MEMBER_A_IP=${SUBNET%.*}.252/${MASKLEN} | |
export MEMBER_B_IP=${SUBNET%.*}.253/${MASKLEN} | |
export VIP=${SUBNET%.*}.254/${MASKLEN} | |
for member in A B; do | |
printf 'For member %s:\n' $member | |
printf 'create net vlan %s interfaces add { internal { tagged } } tag %s\n' $VLAN_NAME $VLAN_ID | |
printf 'create net self me.%s { address %s traffic-group traffic-group-local-only vlan %s }\n' $VLAN_NAME $(eval echo '$MEMBER_'$member'_IP') $VLAN_NAME | |
printf 'create net self float.%s { address %s traffic-group traffic-group-1 vlan %s }\n' $VLAN_NAME $VIP $VLAN_NAME |
NewerOlder