Skip to content

Instantly share code, notes, and snippets.

@ruzickap
ruzickap / latest_packer_install.sh
Created May 21, 2018
Install latest Packer using command line
View latest_packer_install.sh
#!/bin/bash
apt-get install -y --no-install-recommends curl jq unzip
PACKER_LATEST_VERSION=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/packer | jq -r -M '.current_version')
curl https://releases.hashicorp.com/packer/${PACKER_LATEST_VERSION}/packer_${PACKER_LATEST_VERSION}_linux_amd64.zip --output /tmp/packer_linux_amd64.zip
unzip /tmp/packer_linux_amd64.zip -d /usr/local/bin/
rm -f /tmp/packer_linux_amd64.zip
@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 / appveyor_minikube.yml
Created Apr 20, 2018
Appveyor file which runs minikube for testing Kubernetes
View appveyor_minikube.yml
image: ubuntu
build_script:
# Download ans install minikube
# Download kubectl, which is a requirement for using minikube
- curl -sL https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl -o kubectl
- chmod +x kubectl
- sudo mv kubectl /usr/local/bin/
# Download minikube
- curl -sL https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 -o minikube
@ruzickap
ruzickap / kubernetes_kubeadm_installation.sh
Last active Apr 18, 2018
Install Kubernetes Multinode Cluster using kubeadm
View kubernetes_kubeadm_installation.sh
### Master node installation
# SSH to the first VM which will be your Master node:
ssh root@node1
# Set the Kubernetes version which will be installed:
KUBERNETES_VERSION="1.10.0"
# Set the proper CNI URL:
CNI_URL="https://raw.githubusercontent.com/coreos/flannel/v0.10.0/Documentation/kube-flannel.yml"
@ruzickap
ruzickap / record_desktop.sh
Created Apr 15, 2018
Simple script to record desktop in the background using ffmpeg and ImageMagick
View record_desktop.sh
#!/bin/bash -eux
DESTINATION_VIDEO_FILE="$HOME/Videos/`date +%F_%T`.mkv"
DESTINATION_SCREENSHOT_DIRECTORY="$HOME/Pictures/"
MAX_RECORDING_TIME="18000" #seconds (5 hours)
echo "*** $DESTINATION_VIDEO_FILE"
ffmpeg -loglevel error -f x11grab -draw_mouse 1 -framerate 25 -video_size 1920x1080 -i :0+0,0 -pix_fmt yuv420p -c:v libx265 -x265-params crf=28 -preset veryfast -to ${MAX_RECORDING_TIME} $DESTINATION_VIDEO_FILE &
@ruzickap
ruzickap / headphones.sh
Created Mar 22, 2018
Short script which will move all audio (in/out)put to the USB Headphones
View headphones.sh
#!/bin/bash -eux
HEADSET="alsa_output.usb-Logitech_Logitech_USB_Headset-00.analog-stereo"
HEADSET_MIC="alsa_input.usb-Logitech_Logitech_USB_Headset-00.analog-mono"
#pacmd list-sink-inputs
#pacmd list-source-outputs
pacmd stat | grep -E '^Default (sink|source) name'
@ruzickap
ruzickap / pics_descr.sh
Created Mar 14, 2018
Simple script for setting Description + Title into JPEG-Exif/Raw-XMP photos
View pics_descr.sh
#!/bin/bash -eux
FILES="$*"
SUBJECT_KEYWORDS="active, adventure, backpack, backpacker"
DESCRIPTION="My description"
TITLE="My title"
LICENSE_LINK="https://creativecommons.org/licenses/by-sa/4.0/"
AUTHOR="Petr Ruzicka <petr.ruzicka@gmail.com>"
@ruzickap
ruzickap / create_vagrant_network_lab_with_maas_uefi.sh
Last active Mar 21, 2020
Create Vagrant lab environment with 3 separated networks with 3 VMs running MAAS and building 2 UEFI based VMs
View create_vagrant_network_lab_with_maas_uefi.sh
# 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 = "0.0.0.0"
auth_tcp = "none"
@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 )
@ruzickap
ruzickap / kubectl_commands.sh
Last active Dec 1, 2017
kubectl commands + outputs on empty cluster build by Kubespray
View kubectl_commands.sh
root@kube01:~# kubectl get nodes
NAME STATUS ROLES AGE VERSION
kube01 Ready master,node 7m v1.8.3+coreos.0
kube02 Ready master,node 7m v1.8.3+coreos.0
kube03 Ready node 7m v1.8.3+coreos.0
kube04 Ready node 7m v1.8.3+coreos.0
root@kube01:~# kubectl get componentstatuses
NAME STATUS MESSAGE ERROR
You can’t perform that action at this time.