Skip to content

Instantly share code, notes, and snippets.

View deric's full-sized avatar

Tomas Barton deric

  • Prague, Czech Republic
View GitHub Profile
@deric
deric / check_postgresql_12.sh
Last active January 24, 2022 09:32
PostgreSQL 12 -> 13 upgrade check script
#!/bin/bash
function -h {
cat <<USAGE
USAGE: Check postgresql database for pg_pltemplate modifcations. Sanity checks before upgrading 12 -> 13
-p / --port PostgreSQL port
-v / --verbose debugging output
./${0##*/}
@deric
deric / docker_iptables
Last active August 30, 2024 16:41
Generate iptables port forwarding for running containers (assumes default Docker chains already exists)
#!/bin/bash
# Copyright 2020-2022 Tomas Barton
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@deric
deric / davinci_conv
Last active October 19, 2020 01:34
Converts directory of mov files to DaVinci Resolve compatible format (tested on DaVinci Resolve 15 on Linux)
#!/bin/bash
set -o errexit -o nounset -o pipefail
export LC_ALL=C
# Convert video files to DaVinci Resolve compatible format
#
# Author: deric
#
function -h {
cat <<USAGE
Convert video files (using ffmpeg) to DaVinci Resolve compatible format
{
"id": "/traefik",
"acceptedResourceRoles": [
"slave_public"
],
"backoffFactor": 1.15,
"backoffSeconds": 1,
"cmd": "mv dcos-traefik-1.1.0/* $(pwd)/ && bash bootstrap.sh && ./traefik_linux-amd64 -c traefik.toml",
"cpus": 0.5,
"disk": 100,
@deric
deric / ip-detect
Created July 22, 2017 16:34
DC/OS ip-detect script for "deterministic network interfaces naming"
#!/usr/bin/env bash
set -o nounset -o errexit
export PATH=/usr/sbin:/usr/bin:$PATH
function msg { out "$*" >&1 ;}
function out { printf '%s\n' "$*" ;}
function showint {
msg $(ip addr show $1 | grep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1)
}
@deric
deric / check_nvme
Created March 1, 2017 13:09
nagios/icinga check script for NVMe disk
#!/bin/bash
set -o errexit -o nounset -o pipefail
export LC_ALL=C
# Checks for NVMe disks. nmve-cli must be installed.
#
# Author: Tomas Barton
# Requirements:
# nvme-cli - git clone https://github.com/linux-nvme/nvme-cli
#
# Usage:
#!/bin/sh
puppet module install deric-accounts
mkdir -p /etc/puppet/hieradata
cat <<EOF > /etc/puppet/hiera.yaml
---
:backends:
- yaml
:hierarchy:
- common
:yaml:
#!/bin/sh
puppet module install deric-accounts
mkdir -p /etc/puppet/hieradata
cat <<EOF > /etc/puppet/hiera.yaml
---
:backends:
- yaml
:hierarchy:
- common
:yaml:
#!/bin/sh
puppet module install deric-accounts
mkdir -p /etc/puppet/hieradata
cat <<EOF > /etc/puppet/hiera.yaml
---
:backends:
- yaml
:hierarchy:
- common
Debug: /Stage[main]/Accounts::Groups/require: requires Class[Accounts::Users]
Debug: /Stage[main]/Accounts::Users/Accounts::User[john]/User[john]/require: requires Anchor[accounts::user::groups::john]
Debug: /Stage[main]/Accounts::Users/Accounts::User[john]/File[/home/john/.ssh]/require: requires File[/home/john]
Debug: /Stage[main]/Accounts::Users/Accounts::User[john]/File[/home/john/.ssh]/before: requires File[/home/john/.ssh/authorized_keys]
Debug: /Stage[main]/Accounts::Users/Accounts::User[john]/Group[john]/before: requires Anchor[accounts::user::groups::john]
Debug: /Stage[main]/Accounts::Users/Accounts::User[john]/Ssh_authorized_key[john_ssh-rsa]/require: requires File[/home/john/.ssh/authorized_keys]
Debug: /Stage[main]/Accounts::Users/Accounts::User[john]/File[/home/john/.ssh]: Autorequiring