Skip to content

Instantly share code, notes, and snippets.

View bkmeneguello's full-sized avatar

Bruno Meneguello bkmeneguello

View GitHub Profile
curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -
# require `python3 -m pip install jq`
virsh list --name | \
xargs -I '{}' virsh dumpxml '{}' | \
xq '//domain/memory/text()' | \
sed -rn 's@.*<result>(.*)</result>@\1@p' | \
paste -sd+ | \
bc
import random
def randomMAC():
mac = [ 0x52, 0x54, 0x00,
random.randint(0x00, 0x7f),
random.randint(0x00, 0xff),
random.randint(0x00, 0xff) ]
return ':'.join(map(lambda x: "%02x" % x, mac))
print randomMAC()
# https://pykickstart.readthedocs.io/en/latest/
# https://rhinstaller.github.io/anaconda
# virt-install --name teste --memory 2048 --disk size=10 --cpu host-passthrough --accelerate --hvm --location http://mirror.centos.org/centos/7/os/x86_64/ --os-variant centos7.0 --network bridge=virbr0,model=virtio --initrd-inject ks.cfg --extra-args "inst.ks=file:/ks.cfg inst-nosave=all console=tty0 console=ttyS0,115200" --nographics
#version=DEVEL
# System authorization information
auth --passalgo=sha512 --enableshadow
# Install OS instead of upgrade
install
cmdline
$include /etc/inputrc
# Search history with key UP/DOWN
"\e[A": history-search-backward
"\e[B": history-search-forward
# Display all matching commands on TAB
set show-all-if-ambiguous on
# Display matching commands ignoring case
set completion-ignore-case on
echo <<EOT > curl-format.txt
time_namelookup: %{time_namelookup}\n
time_connect: %{time_connect}\n
time_appconnect: %{time_appconnect}\n
time_pretransfer: %{time_pretransfer}\n
time_redirect: %{time_redirect}\n
time_starttransfer: %{time_starttransfer}\n
----------\n
time_total: %{time_total}\n
EOT
kubectl -n kube-system describe secrets \
`kubectl -n kube-system get secrets | awk '/clusterrole-aggregation-controller/ {print $1}'` \
| awk '/token:/ {print $2}'
@bkmeneguello
bkmeneguello / createLocalhostCert.sh
Created April 23, 2019 12:27
Generate a "localhost" valid certificate
openssl req -x509 -out localhost.crt -keyout localhost.key \
-newkey rsa:2048 -nodes -sha256 \
-subj '/CN=localhost' -extensions EXT -config <( \
printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")
gpg --gen-key
git config --global user.signingkey <KEY>
git config --global commit.gpgsign true
pem2openpgp "Name Surname <email@something>" < mykey.pem | gpg --import