Skip to content

Instantly share code, notes, and snippets.

Petr Ruzicka ruzickap

Block or report user

Report or block ruzickap

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
ruzickap /
Created Sep 27, 2014
OVFTool installation on ESXi
#Download OVF tools
wget -q -O /vmfs/volumes/My_Datastore/vmware-ovftool.tar.gz
# Extract ovftool content to /vmfs/volumes/My_Datastore
tar -xzf /vmfs/volumes/My_Datastore/vmware-ovftool.tar.gz -C /vmfs/volumes/My_Datastore/
rm /vmfs/volumes/My_Datastore/vmware-ovftool.tar.gz
# Modify the ovftool script to work on ESXi
sed -i 's@^#!/bin/bash@#!/bin/sh@' /vmfs/volumes/My_Datastore/vmware-ovftool/ovftool
ruzickap /
Created Jul 10, 2019
This script is trying to produce the same stats as CrystalDiskMark for Windows using fio.
#!/bin/bash -eu
# This script is trying to produce the same stats as CrystalDiskMark for Windows
# using fio.
# If you specify the raw disk (like /dev/sdc) the all it's content will be removed!
# The script should not run longer than 20 minutes
TMP_FILE=${TMP_FILE:-/tmp/$(basename $0).tmp}
ruzickap /
Created Apr 7, 2014
OpenWrt vnStat configuration
opkg install luci-app-vnstat vnstati
mkdir /etc/vnstat /www3/myadmin/vnstat
sed -i 's@^\(DatabaseDir\).*@\1 "/etc/vnstat"@' /etc/vnstat.conf
vnstat -u -i eth2
vnstat -u -i wlan0
vnstat -u -i br-lan
echo "*/5 * * * * vnstat -u" >> /etc/crontabs/root
ruzickap /
Created Jun 4, 2019
Debug service on OpenWrt
sed -r -i 's%^(#!.*)%\1\nset -x -v\nexec \&>/tmp/ddns-init.log%' /etc/init.d/ddns
sed -r -i 's%^(#!.*)%\1\nset -x -v\nexec \&>/tmp/ddns-hotplug.log%' /etc/hotplug.d/iface/95-ddns
sed -r -i 's%^(#!.*)%\1\nset -x -v\nexec \&>/tmp/ddns-updater.log%' /usr/lib/ddns/
# $ head -5 /etc/init.d/ddns
# #!/bin/sh /etc/rc.common
# set -x -v
# exec &>/tmp/ddns-init.log
# START=95
# STOP=10
ruzickap /
Last active May 23, 2019
Delete and remove VM in Virtualbox
VBoxManage list vms
VBoxManage controlvm 6d3e674d-7626-4142-969f-8017b679fbd0 poweroff
VBoxManage unregistervm --delete 6d3e674d-7626-4142-969f-8017b679fbd0
ruzickap /
Last active May 16, 2019
Quick and Dirty script building Windows using Packer + Ansible + WinRM on QEMU (libvirt)
#!/bin/bash -x
mkdir test
cd test
curl | sed '/.*Microsoft-Windows-PnpCustomizationsWinPE.*/,/component>/d' > Autounattend.xml
wget -c
test -f packer || ( wget && unzip && rm )
ruzickap /
Last active May 7, 2019
Create Vagrant lab environment with 3 separated networks with 3 VMs running MAAS and building 2 UEFI based VMs
# Install Vagrant and virsh command
dnf install -y libvirt-client vagrant-hostmanager vagrant-libvirt
# Allow to manage VMs via libvirt remotely (using TCP connection)
cat >> /etc/libvirt/libvirtd.conf << EOF
listen_tls = 0
listen_tcp = 1
listen_addr = ""
auth_tcp = "none"
ruzickap /
Created Apr 6, 2014
OpenWrt DDNS ( configuration
uci set ddns.myddns.enabled=1
uci set
uci set ddns.myddns.domain=gate
uci set ddns.myddns.username=NA
uci set ddns.myddns.password=xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
uci set ddns.myddns.ip_source=network
uci set ddns.myddns.ip_network=wan
uci set ddns.myddns.force_interval=72
uci set ddns.myddns.force_unit=hours
uci set ddns.myddns.check_interval=10
ruzickap /
Last active Apr 30, 2019
Create Packer template and Autounattended file for Windows Server 2016 Eval + download few helper scrips
# Prepare directory structure
mkdir -p /var/tmp/packer_windows-server-2016-eval/{scripts/win-common,http/windows-server-2016,ansible}
cd /var/tmp/packer_windows-server-2016-eval
# Download Autounattended file for Windows Server 2016 Evaluation
wget -c -P http/windows-server-2016
# Create some basic Ansible playbook for Windows provisioning
cat > ansible/win.yml << EOF
ruzickap /
Last active Apr 30, 2019
Mount the virtio-win iso and run Packer
export VIRTIO_WIN_ISO_DIR=$(mktemp -d --suffix=_virtio-win-iso)
export NAME=windows-server-2016-standard-x64-eval
export WINDOWS_TYPE=server
export TMPDIR="/var/tmp/"
cd /var/tmp/packer_windows-server-2016-eval
# Download and mount virtio-win to provide basic virtio Windows drivers
wget -c
You can’t perform that action at this time.