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
ruzickap / aws_create_site.yml
Created Feb 16, 2017
Ansible playbook which creates instances and tag volumes
View aws_create_site.yml
---
- name: Create Instance in AWS
hosts: localhost
connection: local
gather_facts: false
vars:
aws_access_key: "xxxxxx"
aws_secret_key: "xxxxxx"
security_token: "xxxxxx"
@ruzickap
ruzickap / git-repository-gpg-crypt
Created Nov 1, 2019
Make git repository encrypted with generated GPG key which can be used by CI/CD to access the git repo when using GitHub Actions
View git-repository-gpg-crypt
# Make sure you are using gpg2
git config --global gpg.program gpg2
# Clone empty repository
git clone git@github.com:ruzickap/terraform-gitops.git
# Configure a repository to use git-crypt
cd terraform-gitops
git-crypt init
View kubernetes_notes.sh
# Connect to PostgreSQL database internally
kubectl run -i --tty --rm psql --image=postgres --env "PGPASSWORD=user_password" --command -- \
psql -U myuser -h patroni.patroni.svc.cluster.local my_database
# Port forwarding to service
kubectl port-forward -n harbor service/harbor 8080:443
@ruzickap
ruzickap / xmp_darktable_raw_decode.sh
Last active Aug 27, 2019
Decode RAW files form camera using darktable-cli + XMP to JPEG
View xmp_darktable_raw_decode.sh
#!/bin/bash -eu
for XMP_FILE in *.xmp; do
RAW_FILE=`awk -F \" '/xmpMM:DerivedFrom=/ { print $2 }' $XMP_FILE`
RAW_FILE_NAME="${XMP_FILE%.*}"
FILE_NAME="${RAW_FILE%.*}"
echo "*** $XMP_FILE [$RAW_FILE] [$FILE_NAME]"
if [ "$RAW_FILE_NAME" != "$RAW_FILE" ]; then
@ruzickap
ruzickap / ovftool_installation.sh
Created Sep 27, 2014
OVFTool installation on ESXi
View ovftool_installation.sh
#Download OVF tools
wget -q ftp://ftp.example.com/software/vmware/installation_scripts/vmware-ovftool.tar.gz -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
ruzickap / benchmark_disk.sh
Created Jul 10, 2019
This script is trying to produce the same stats as CrystalDiskMark for Windows using fio.
View benchmark_disk.sh
#!/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}
UNATTENDED=${UNATTENDED:-0}
@ruzickap
ruzickap / openwrt_vnstat.sh
Created Apr 7, 2014
OpenWrt vnStat configuration
View openwrt_vnstat.sh
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
ruzickap / debug_ddns_service.sh
Created Jun 4, 2019
Debug service on OpenWrt
View debug_ddns_service.sh
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/dynamic_dns_updater.sh
# $ head -5 /etc/init.d/ddns
# #!/bin/sh /etc/rc.common
# set -x -v
# exec &>/tmp/ddns-init.log
# START=95
# STOP=10
@ruzickap
ruzickap / delete_remove_virtualbox_vm.sh
Last active May 23, 2019
Delete and remove VM in Virtualbox
View delete_remove_virtualbox_vm.sh
VBoxManage list vms
VBoxManage controlvm 6d3e674d-7626-4142-969f-8017b679fbd0 poweroff
VBoxManage unregistervm --delete 6d3e674d-7626-4142-969f-8017b679fbd0
@ruzickap
ruzickap / packer_qemu_windows_ansible_winrm.sh
Last active May 16, 2019
Quick and Dirty script building Windows using Packer + Ansible + WinRM on QEMU (libvirt)
View packer_qemu_windows_ansible_winrm.sh
#!/bin/bash -x
mkdir test
cd test
curl https://raw.githubusercontent.com/ruzickap/packer-templates/master/http/windows-server-2016/Autounattend.xml | sed '/.*Microsoft-Windows-PnpCustomizationsWinPE.*/,/component>/d' > Autounattend.xml
wget -c https://raw.githubusercontent.com/ruzickap/packer-templates/master/scripts/win-common/fixnetwork.ps1
test -f packer || ( wget https://releases.hashicorp.com/packer/1.2.0/packer_1.2.0_linux_amd64.zip && unzip packer_1.2.0_linux_amd64.zip && rm packer_1.2.0_linux_amd64.zip )
You can’t perform that action at this time.