This file contains hidden or 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 | |
| # Fetch machines | |
| echo "=== Fetching machines (excluding vms) ===" | |
| ALL_MACHINES=$(maas root machines read | jq -r '.[] | select(.virtualmachine_id==null) | .system_id') | |
| echo "=====================================" | |
| # Check what is the current default route | |
| echo "=== Printing the current gateways before change ===" | |
| maas root machines read | jq -r '.[] | select(.virtualmachine_id==null) | [.hostname,.default_gateways.ipv4.gateway_ip] | join(" ")'; | |
| echo "=====================================" |
This file contains hidden or 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 -Eeuo pipefail | |
| AUTH_SERVER_URL="" | |
| RSAUSER="" | |
| usage() { | |
| echo "Usage: $0 -s <auth_server_url> -u <username>" | |
| echo | |
| echo "Options:" |
This file contains hidden or 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
| # add to /var/snap/maas/current/preseeds/curtin_userdata | |
| late_commands: | |
| 00_maas: [wget, '--no-proxy', {{node_disable_pxe_url|escape.json}}, '--post-data', {{node_disable_pxe_data|escape.json}}, '-O', '/dev/null'] | |
| 10_adduser: ["curtin", "in-target", "--", "sh", "-c", "adduser --disabled-password --gecos '' maas"] | |
| 20_addpwd: ["curtin", "in-target", "--", "sh", "-c", "echo 'maas:maas' | chpasswd"] | |
| 30_addsudo: ["curtin", "in-target", "--", "sh", "-c", "usermod -aG sudo maas"] |
This file contains hidden or 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
| ldapsearch -x -y ldap-password.txt -H ldaps://<server>:636 -D 'CN=....' -E 'pr=10000/noprompt' -b 'OU=....' -W '(&(objectClass=User)(memberOf=CN=))' sAMAccountName | |
| # Remember that ldap-password.txt cannot have newline in the end, so use echo -n 'password' > ldap-password.txt |
This file contains hidden or 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" ]]; then | |
| echo "Provide the original image ISO" | |
| exit 1 | |
| fi | |
| sudo snap install distrobuilder --classic | |
| sudo apt install -y libguestfs-tools wimtools genisoimage |
This file contains hidden or 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 | |
| set +e | |
| backup() { | |
| if [[ -e "$1.backup" ]]; then | |
| echo "Backup file already exists! Remove if necessary." | |
| exit 10 | |
| fi | |
| echo "Creating backup of $1 in $1.backup" >&2 |
This file contains hidden or 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
| # create damn simple TFTP dasemon | |
| IFACE='ens0p25' | |
| sudo dnsmasq -i $IFACE --dhcp-range=192.168.69.100,192.168.69.150 --enable-tftp --tftp-root=/home/$USER/tftdir -d -u $USER -p0 -K --log-dhcp --bootp-dynamic |
This file contains hidden or 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
| import argparse | |
| def f(x): | |
| print(x) | |
| class Fusion: | |
| """ |
This file contains hidden or 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 python3 | |
| """ | |
| Generates land register codes in Poland for given court symbol | |
| """ | |
| from itertools import starmap | |
| import operatortype command to continue | |
| import argparse |
NewerOlder