Skip to content

Instantly share code, notes, and snippets.

@pbt001
pbt001 / ssh.md
Created August 18, 2020 20:51 — forked from bradtraversy/ssh.md
SSH & DevOps Crash Course Snippets

SSH Cheat Sheet

This sheet goes along with this SSH YouTube tutorial

Login via SSH with password (LOCAL SERVER)

$ ssh brad@192.168.1.29

Create folder, file, install Apache (Just messing around)

$ mkdir test

$ cd test

def docx_replace(doc, data):
paragraphs = list(doc.paragraphs)
for t in doc.tables:
for row in t.rows:
for cell in row.cells:
for paragraph in cell.paragraphs:
paragraphs.append(paragraph)
for p in paragraphs:
for key, val in data.items():
key_name = '${{{}}}'.format(key) # use placeholders in the form ${PlaceholderName}
@pbt001
pbt001 / replace-debian-with-arch.txt
Created June 22, 2020 21:37 — forked from m-ou-se/replace-debian-with-arch.txt
Instructions to replace a live Debian installation with Arch
# Download latest archlinux bootstrap package, see https://www.archlinux.org/download/
wget 'ftp://ftp.nluug.nl/pub/os/Linux/distr/archlinux/iso/latest/archlinux-bootstrap-*-x86_64.tar.gz'
# Make sure you'll have enough entropy for pacman-key later.
apt-get install haveged
# Install the arch bootstrap image in a tmpfs.
mount -t tmpfs none /mnt
cd /mnt
tar xvf ~/archlinux-bootstrap-*-x86_64.tar.gz --strip-components=1
@pbt001
pbt001 / arch-linux-install
Created June 22, 2020 21:36 — forked from mattiaslundberg/arch-linux-install
Minimal instructions for installing arch linux on an UEFI system with full system encryption using dm-crypt and luks
# Install ARCH Linux with encrypted file-system and UEFI
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# Download the archiso image from https://www.archlinux.org/
# Copy to a usb-drive
dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration.
# Set swedish keymap
@pbt001
pbt001 / vim_cheatsheet.md
Created June 22, 2020 21:36 — forked from awidegreen/vim_cheatsheet.md
Vim shortcuts

Introduction

  • C-a == Ctrl-a
  • M-a == Alt-a

General

:q        close
:w        write/saves
:wa[!]    write/save all windows [force]
:wq       write/save and close
@pbt001
pbt001 / arch-install-notes
Created June 22, 2020 21:36 — forked from kwesthaus/arch-install-notes
Notes for my Arch Linux installation in UEFI mode with LVM on LUKS encryption on an HP Pavilion x360 laptop. Works best when paired with the official installation guide and other people's arch-linux-install gists.
# With thanks to the arch wiki ("the wiki") and many individuals in the open source community who have shared their arch-linux-install gists on github
# Instead of listing the full install, this gist details extra notes I want to remember for next time as well as any choices I made for my system
# Installed on an HP Pavilion x360 14-dh2034nr
# I had the arch install guide and other pages open on my ipad next to me during the install
# Verify the ISO
# gpg (on linux) or gpg4win
# Can check developer signing keys at https://www.archlinux.org/people/developers/
# Burn to USB
@pbt001
pbt001 / setup.sh
Created June 22, 2020 21:36 — forked from stevepentland/setup.sh
Initial machine setup script
#!/usr/bin/env bash
# This the starting point for my basic setup script, it still needs
# a lot of work, but should get into a minimal working state on fresh install
# To use it enter
# `sh -c "$(curl -fsSL https://gist.githubusercontent.com/stevepentland/<PATH TO RAW SCRIPT>/setup.sh)"`
BASE_PACKAGES=(
"zsh"
"git"
"exa"
"ripgrep"
@pbt001
pbt001 / annotate-pod.sh
Created June 22, 2020 21:35 — forked from cwilkers/annotate-pod.sh
Script to annotate a pod with a Velero Restic volume list
#!/bin/bash
# This script adds Velero/Restic labels to a pod according to the pod's
# current volume set (filtering to only persistentVolumeClaims)
# According to https://heptio.github.io/velero/v0.11.0/restic
# TODO: Make this script produce help if options are not given
# Currently it just assumes you mean to annotate a NooBaa server pod
# Usage:
# annotate-pod.sh namespace pod
#
NS=${1:-noobaa}
@pbt001
pbt001 / archive
Created June 22, 2020 21:35 — forked from k9982874/archive
router.home.lan
#!/bin/bash
if [ -z "$PASS" ]; then
echo "Please setup password for the archive"
exit 0
fi
ROOT=/mnt/data/backups/archives
SOURCE=/mnt/data/workspace
@pbt001
pbt001 / README.md
Created June 22, 2020 21:34 — forked from zoispag/README.md
Collect restic metrics when using resticker

Collect restic metrics when using resticker

Restic is a backup software, written in Go, that stands out for the method of backup that is using, called Content Defined Chunking de-duplication. It supports multiple backends and is really easy to use.

I am using resticker, a straight-forward docker container, to run restic in Production.

It allows to schedule the backups with its built-in cron support, and allows me to send notifications for successful/failed backups.

Resticker currently does not support Prometheus metrics, in order to monitor the status of the backups.