Skip to content

Instantly share code, notes, and snippets.

@j0ju
j0ju / collectd_plugin_exec_hdd_smart.sh
Last active July 25, 2016 06:11
Simple script for collectd exec plugin
#!/bin/sh
if [ "$(id -u)" -ne 0 ]; then
exec sudo "$0"
fi
HOSTNAME="${COLLECTD_HOSTNAME:-`hostname -f`}" # RH / CentOs
#HOSTNAME="${COLLECTD_HOSTNAME:-`hostname`}" # Debian/Ubuntu
INTERVAL="${COLLECTD_INTERVAL:-60}"
INTERVAL="${INTERVAL%.*}"
@j0ju
j0ju / bin-vizone
Last active August 10, 2016 17:46
/etc/bash_completion.d/pdnsutil
#!/bin/bash
# vim: ts=2 sw=2 et ft=sh
# self-calling editor for pdns-util edit-zone
# goal: prevent SOA SERIAL exhaustion
# usage: vizone <ZONE>
set -e
if [ "$0" != "$EDITOR" ]; then # not called from pdnsutil
EDITOR="$0" pdnsutil edit-zone ${1:+"$1"}
@j0ju
j0ju / plugin_exec_bird.sh
Created September 9, 2017 12:00
collectd exec plugin bird
#!/bin/sh
set -e
#HOSTNAME="${COLLECTD_HOSTNAME:-`hostname -f`}" # RH / CentOs
HOSTNAME="${COLLECTD_HOSTNAME:-`hostname`}" # Debian/Ubuntu
INTERVAL="${COLLECTD_INTERVAL:-60}"
INTERVAL="${INTERVAL%.*}"
PATH=/sbin:/bin:/usr/sbin:/usr/bin
@j0ju
j0ju / to-nvme.sh
Created June 7, 2020 10:39
current root to nvme with efi and systemd
#!/bin/sh
set -e
TGT=/dev/nvme0n1
WAIT=5
VG=nvme
LV_ROOT_SIZE=150G
#LV_ROOT_SIZE="$(df -h / | tail -n 1 | awk '{print $2}')"
KEY_FILE=/tmp/.nvme.key
#!/bin/sh
prefix=
preamble_printed=
PREAMBLE() {
[ "$preamble_printed" != 1 ] || return 0
cat << EOF
# HELP bird_route_metadata
# TYPE bird_route_metadata gauge
@j0ju
j0ju / docker-service-companion.bash
Created July 16, 2020 12:15
docker-service-companion.bash
#!/bin/bash
### BEGIN INIT INFO
# Provides: mesh-docker-service-companion
# Required-Start: $local_fs $network $remote_fs
# Required-Stop: $local_fs $network $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: mesh-docker-service-companion docker network attach sidecar helper
# Description: mesh-docker-service-companion docker network attach sidecar helper
@j0ju
j0ju / rook-shutdown.sh
Created January 18, 2021 11:13 — forked from chrigl/rook-shutdown.sh
shutdown rook
#!/bin/bash
# This script shuts down a rook-ceph cluster
# Please DON'T use this. It is only for demonstration purposes.
set -eux -o pipefail
force=false
while getopts "f" arg; do
case $arg in
f)
force=true
@j0ju
j0ju / Dockerfile.template
Last active June 19, 2021 21:18
a simple CNI-alike for docker for a more specific network config in containers, also can act on unhealthy containers
# vim ts=2 sw=2 et ft=Dockerfile
FROM alpine
COPY files/lib/entrypoint.sh /lib/entrypoint.sh
RUN set -ex; \
apk add --update ipset docker-cli iproute2 openrc ethtool util-linux netcat-openbsd; \
apk upgrade; \
sed -i -r -e '2 i mv() { rm -f "$1"; }' /usr/share/udhcpc/default.script; \
sed -i -r -e '1 s@^#!.*$@#!/bin/sh@' /lib/entrypoint.sh; \
@j0ju
j0ju / brew-bundle-brewfile-tips.md
Created September 1, 2022 20:35 — forked from ChristopherA/brew-bundle-brewfile-tips.md
Brew Bundle Brewfile Tips

Brew Bundle Brewfile Tips

Copyright & License

Unless otherwise noted (either in this file or in a file's copyright section) the contents of this gist are Copyright ©️2020 by Christopher Allen, and are shared under spdx:Creative Commons Attribution Share Alike 4.0 International (CC-BY-SA-4.) open-source license.

Sponsor

If you more tips and advice like these, you can become a monthly patron on my GitHub Sponsor Page for as little as $5 a month; and your contributions will be multipled, as GitHub is matching the first $5,000! This gist is all about Homebrew, so if you like it you can support it by donating to them or becoming one of their Github Sponsors.

{
"__inputs": [
{
"name": "DS_PROMETHEUS",
"label": "Prometheus",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}