Skip to content

Instantly share code, notes, and snippets.

@Towl
Towl / munin-telegram.conf
Created May 27, 2020 09:41
Telegram for Munin
# -- Telegram Bot
contact.telegram.command MUNIN_SERVICESTATE="${var:worst}" MUNIN_HOST="${var:host}" MUNIN_SERVICE="${var:graph_title}" MUNIN_GROUP="${var:group}" MUNIN_PLUGIN="${var:plugin}" MUNIN_TEXT="\
${if:cfields \n\n__CRITICALs:__${loop<,>:cfields \n\* ${var:label} is ${var:value} (outside range [${var:crange}])${if:extinfo : ${var:extinfo}}}.}${if:wfields \n\n__WARNINGs:__${loop<,>:wfields \n\* ${var:label} is ${var:value} (outside range [${var:wrange}])${if:extinfo : ${var:extinfo}}}.}${if:ufields \n\n__UNKNOWNs:__${loop<,>:ufields \n\* ${var:label} is ${var:value}${if:extinfo : ${var:extinfo}}}.}${if:fofields \n\n__OKs:__${loop<,>:fofields \n\* ${var:label} is ${var:value}${if:extinfo : ${var:extinfo}}}.} \
" /etc/munin/notify_telegram.sh
contact.telegram.always_send warning critical
@Towl
Towl / zshrc
Last active April 2, 2025 07:01
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
/_cat/health?v
/_cat/indices?v
/_cat/templates?v
/_cat/allocation?v
/_cat/nodes
/_cat/pending_tasks
/_cat/shards
/_cat/thread_pool
/_cat/segments
firewall-cmd --permanent --zone=public --add-rich-rule='rule family="ipv4" source address="10.0.0.3/32" port port="4949" protocol="tcp" accept'
#!/bin/bash
virsh blockresize vm /var/lib/libvirt/images/image.qcow2 110G
fdisk /dev/vda
n // new
p // primary
3 // number of partition
t // change type
8e // to change type from Linux to Linux LVM even if it's working with Linux
w // apply changes
partprobe
@Towl
Towl / httpd-munin.conf
Created August 28, 2019 12:46
Httpd conf for munin on Centos
<VirtualHost *:80>
ServerName munin.server.com
ServerAlias munin
ServerAdmin alertes@admin.com
DocumentRoot /var/www/html/munin
Alias /munin/static/ /etc/munin/static/
<Directory /etc/munin/static>
Host bastion
Hostname [bastion_ip]
User [bastion_user]
Port [bastion_port]
Host host
Hostname [host_ip] # from bastion point of view
User [host_user]
Port [host_port]
ProxyCommand ssh -W %h:%p bastion
virt-install --name [name] --memory [mem] --vcpus [cpu] --disk /var/lib/libvirt/images/[image].qcow2,size=20 --location "http://mirror.init7.net/centos/7/os/x86_64/" --noautoconsole --os-variant rhel7 -w network=[net],model=virtio,mac=52:54:00:00:00:[id] -w bridge=[bridge],model=virtio,mac=52:54:00:[id:id:id] --initrd-inject="[kickstart.cfg]" --extra-args="ks=file:/ks.cfg"
@Towl
Towl / MacOS docker display
Created June 26, 2019 17:45
Step to follow
Install XQuartz
Start XQuartz and enable "Allow connections from remote clients" in Settings > Security
Restart XQuartz
Get the display number by :
ps -ef | grep "Xquartz :\d" | grep -v xinit | awk '{ print $9; }'
add the localhost ip in the allowed client :
xhost + 127.0.0.1
openssl req -x509 -sha256 -newkey rsa:2048 -keyout certificate.key -out certificate.crt -days 1024 -nodes -subj '/CN=my.domain.tld'
# From https://letsencrypt.org/docs/certificates-for-localhost/
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")