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
# This command will refresh all installed snaps in parallel. | |
# If snap was installed with classic confinment, but snap list | |
# does not report that fact, just put that snap in the first awk | |
# if statement (pipe separated) | |
snap list|awk '/^[a-z]/{if (/classic|charm/) print $1 " --classic";if (!/classic/) print $1}'|xargs -L1 -P0 sudo snap refresh |
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
sp() { printf "%0.0s " $(seq 1 $1); } | |
Example: | |
# Say you need to add two lines near the end of /etc/security/limits.conf | |
Orig file: | |
#<domain> <type> <item> <value> | |
# | |
#* soft core 0 | |
#root hard core 100000 |
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 | |
# This script creates a systemd service to turn up | |
# the keyboard backlight at startup as it's not | |
# respecting the last setting | |
# In order to do this, we have to change the perms, | |
# then echo a value into the brightness file. | |
# The latter has to be done via a script as just | |
# running the echo from systemd does not work. |
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
#Consider we have the following csv and we want to use it to create subnets and vlans in MAAS using the cli | |
VLAN (name+tag),cidr,subnet name | |
v501,10.183.128.0/24,fa-POD5-v501 | |
v503,10.183.129.0/24,fa-POD5-v503 | |
v505,10.183.130.0/24,fa-POD5-v505 | |
v507,10.183.131.0/24,fa-POD5-v507 | |
v509,10.183.132.0/24,fa-POD5-v509 | |
v511,10.183.133.0/24,fa-POD5-v511 | |
v513,10.183.134.0/24,fa-POD5-v513 |
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
#### Run commands as root, not via sudo #### | |
sudo su - | |
yum --enablerepo="base" -y install yum-utils | |
yum install yum-plugin-copr epel-release -y | |
yum install wget curl sqlite-devel dnsmasq squashfs-tools libacl-devel python-pthreading glibc-utils glibc-devel glibc-headers glibc-static rsync librsync librsync-devel -y | |
yum groupinstall "Development Tools" "Development Libraries" -y | |
wget -O go1.11.1.linux-amd64.tar.gz https://dl.google.com/go/go1.11.1.linux-amd64.tar.gz | |
tar -C /usr/local -xzf go1.11.1.linux-amd64.tar.gz | |
export PATH=$PATH:/usr/local/go/bin |
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 | |
command -v jq &>/dev/null || sudo apt install jq -yqq | |
(maas admin machines read|jq -r '.[]|select(.status_name=="Deployed").hostname')| \ | |
xargs -n1 -P0 bash -c 'ssh $0 '"'"'printf "$HOSTNAME: " && [[ -d /sys/firmware/efi ]] && echo UEFI || echo BIOS'"'"'' |
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
#TODO: Create exclude args for platforms | |
download-splunk() { | |
# Where to store the platform and forwarder packages | |
local SPLUNK_BIN_DIR=/srv/splunk-platform | |
local SPLUNK_UF_DIR=/srv/splunk-uf | |
[[ -d ${SPLUNK_BIN_DIR} ]] || mkdir -p ${SPLUNK_BIN_DIR} | |
[[ -d ${SPLUNK_UF_DIR} ]] || mkdir -p ${SPLUNK_UF_DIR} |
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
CLASS|FLAG|DESC | |
AMD-EXTENDED|3dnowprefetch|3DNow prefetch instructions | |
AMD-EXTENDED|abm|Advanced bit manipulation | |
AMD-EXTENDED|bpext|Data breakpoint extension | |
AMD-EXTENDED|cmp_legacy|If yes HyperThreading not valid | |
AMD-EXTENDED|cr8_legacy|CR8 in | |
AMD-EXTENDED|extapic|Extended APIC space | |
AMD-EXTENDED|fma4|4 operands MAC instructions | |
AMD-EXTENDED|ibs|Instruction Based Sampling | |
AMD-EXTENDED|lahf_lm|LAHF/SAHF in long mode |
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
#Using table here: https://bit.ly/gh-cpu-flags | |
show-common-cpu-flags() { | |
declare -ag COL_LEN=($(wget -qO- http://bit.ly/cpu_flags|awk -F\| 'BEGIN { NR==1;getline; H1=$1; H2=$2; H3=$3 } { for (i=1; i<=NF; i++) { max[i] = length($i) > max[i] ? length($i) : max[i] ;ncols = i > ncols ? i : ncols }} END { {print H2":"max[2]"\n"H3":"max[3]"\n"H1":"max[1]"\n"}}')) | |
export LS='─' | |
(printf "%s\n" ${COL_LEN[@]%%:*}|paste -sd\| && printf "%s\n" ${COL_LEN[@]##*:}|xargs -n1 bash -c 'eval printf "%.3s" ${LS}{1..${0}};echo'|paste -sd"|" | |
wget -qO- http://bit.ly/cpu_flags|awk -F\| '/AMD-EXTENDED\||AMD\||INTEL\||V12N\|/{print $2"|"$3"|"$1}')|column -nexts'|'|sed '1,2s/.*$/'$(printf "\e[1m")'&'$(printf "\e[0m")'/' | |
} | |
show-all-cpu-flags() { |
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" standalone="yes" ?> | |
<!-- generated by lshw-B.02.17 --> | |
<!-- GCC 5.4.0 20160609 --> | |
<!-- Linux 4.4.0-138-generic #164-Ubuntu SMP Tue Oct 2 17:16:02 UTC 2018 x86_64 --> | |
<!-- GNU libc 2 (glibc 2.23) --> | |
<list> | |
<node id="node7gpu01" claimed="true" class="system" handle="DMI:0001"> | |
<description>Computer</description> | |
<product>4008 T4008C_2-EXDXXX</product> | |
<vendor>Kontron</vendor> |