Skip to content

Instantly share code, notes, and snippets.

View jtyr's full-sized avatar
🐧

Jiri Tyr jtyr

🐧
View GitHub Profile
@jtyr
jtyr / zabbix_agent_query.txt
Last active February 21, 2024 13:23
Query Zabbix Agent metric via netcat.
# Ask Zabbix Agent to return value of the system.cpu.load metric
echo 'system.cpu.load' | nc -w2 myserver01 10050 | sed -r 's/^ZBXD..//'
@jtyr
jtyr / zshrc
Last active January 9, 2023 20:17
ZSH configuration for GBT
###[ ZSH ]
# History
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
setopt append_history
setopt extended_history
setopt hist_expire_dups_first
setopt hist_ignore_dups
@jtyr
jtyr / GitAliases.txt
Last active January 3, 2022 18:19
Useful Git aliases
git config --global alias.workprofile 'config user.email jiri.tyr@client.domain'
git config --global alias.tagv "\!git --no-pager tag --sort=v:refname --sort=creatordate --format='%(objectname) %(refname:strip=2)'"
git config --global alias.lv 'rev-parse HEAD'
git config --global alias.ltag "\!git tag --sort=v:refname --sort=creatordate | tail -n1"
git config --global alias.ltagv '!git tagv | tail -n1'
git config --global alias.itag "\!(git ltag || echo 0.0.0) | awk '{split(substr(\$0, 2), a, \".\"); printf \"v%d.%d.%d\", a[1]+1, 0, 0}'"
git config --global alias.iitag "\!(git ltag || echo 0.0.0) | awk '{split(substr(\$0, 2), a, \".\"); printf \"v%d.%d.%d\", a[1], a[2]+1, 0}'"
git config --global alias.iiitag "\!(git ltag || echo 0.0.0) | awk '{split(substr(\$0, 2), a, \".\"); printf \"v%d.%d.%d\", a[1], a[2], a[3]+1}'"
git config --global alias.aitag '!git tag $(git itag)'
git config --global alias.aiitag '!git tag $(git iitag)'
@jtyr
jtyr / rpm_deps_tree.sh
Created May 5, 2017 09:29
Bash function which helps to print out the RPM dependency tree for a specific package.
function walk() {
if [ $1 == 0 ]; then
echo -n "" > /tmp/deps;
fi
echo $2 >> /tmp/deps;
for N in $(seq $1); do
echo -n ' ';
done
echo -n '- ';
echo $2;
@jtyr
jtyr / Vagrantfile
Last active January 4, 2017 17:19
Vagrantfile with external configuration
Move to https://github.com/jtyr/vagrantfile_config
@jtyr
jtyr / sshpass_issue.txt
Created September 22, 2016 13:35
Set of steps which help to reproduce the issue when connection with sshpass through a proxy
# Create SSH keys to be able to use localhost as the proxy
ssh-keygen
cat ~/.ssh/id_rsa.pub > ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_key
chmod 700 ~/.ssh
# Create the SSH config
cat >~/.ssh/config <<END
Host *
# !!!Make sure this directory exists!!!
@jtyr
jtyr / hostsfile.py
Last active April 25, 2019 10:35
Ansible dynamic inventory script that reads any Ansible hosts file and transforms it into the JSON data structure.
This was moved to https://github.com/jtyr/ansible-ini_inventory
@jtyr
jtyr / Makefile
Last active April 27, 2016 11:30
Bundle and unbundle local Git repos
###
#
# This Makefile helps to bundle and unbundle local Git repos. Directories
# containing bare repos should end with `.git` (e.g. `mybarerepo.git`).
#
###
DIRS = $(shell find . -type d -maxdepth 1)
BUNDLES = $(filter-out $(wildcard *.git.bundle), $(wildcard *.bundle))
BUNDLES_BARE = $(wildcard *.git.bundle)
@jtyr
jtyr / jtyr.zsh-theme
Last active March 20, 2016 02:30
jtyr's theme for oh-my-zsh
# jtyr's theme for oh-my-zsh
# Color shortcuts
RED=$fg_bold[red]
GREEN=$fg_bold[green]
YELLOW=$fg_bold[yellow]
BLUE=$fg_bold[blue]
CYAN=$fg_bold[cyan]
RESET=$reset_color
@jtyr
jtyr / docker_image_builder.yaml
Last active September 25, 2022 15:45
Ansible Playbook to build multiple Docker images without any Dockerfile (requires Ansible v2.0)
---
### Inventory hosts file should contain this:
# test1 docker_source_image=centos:7
# test2 docker_source_image=centos:7
###
### Run the playbook like this:
# ansible-playbook -i hosts --diff ./docker_image_builder.yaml
###