Skip to content

Instantly share code, notes, and snippets.

View jbfriedrich's full-sized avatar
👨‍💻
Learning more Python 🐍

Jason Friedrich jbfriedrich

👨‍💻
Learning more Python 🐍
View GitHub Profile
@jbfriedrich
jbfriedrich / base.conf
Created September 17, 2018 06:42
Saltstack Profile and Map Examples
dc1-product-base:
provider: vmware-dc1
clonefrom: product-centos7-base
devices:
cd:
CD/DVD drive 1:
device_type: client_device
mode: passthrough
disk:
@jbfriedrich
jbfriedrich / update_plex.sh
Last active November 4, 2018 19:07
Check if a new Plex version is available, install it and then move the deb package into a directory for archival purposes.
#!/bin/bash
# Some global variables
WGET_BIN='/usr/bin/wget'
JQ_BIN='/usr/bin/jq'
SED_BIN='/bin/sed'
TOOLS_MISSING=0
CHECK_UPDATE_URL='https://plex.tv/api/downloads/1.json'
UPDATE_URL='https://plex.tv/downloads/latest/1?channel=16&build=linux-ubuntu-x86_64&distro=ubuntu'
ARCHIVE_DIR="${HOME}/plex_archive"
@jbfriedrich
jbfriedrich / convert_posts_to_markdown.py
Created November 13, 2018 12:14
Extracting post title, slug and content from a Ghost 2.x backup and import it to a write.as blog
#!/usr/bin/env python3
"""
Convert HTML posts that we extract via JQ, into Markdown formatted files (one file per post, title as filename)
"""
import json
import html2text
import sys
import argparse
@jbfriedrich
jbfriedrich / connect_vusb0.sh
Last active February 19, 2023 21:14
Check if vusb0 NIC link is up and add it to vDS uplink port group (based on script from https://labs.vmware.com/flings/usb-network-native-driver-for-esxi that only supports vSS)
# Add contents to /etc/rc.local.d/local.sh
vds_name="vDS"
vds_uplink_pg="dvportgroup-82"
free_vds_uplink_port=$(esxcli network vswitch dvs vmware list | grep -A 2 "DVPortgroup ID: $vds_uplink_pg" | grep -A 1 'In Use: false' | grep 'Port ID' | awk '{print $NF}' | head -1)
vusb0_status=$(esxcli network nic get -n vusb0 | grep 'Link Status' | awk '{print $NF}')
count=0
while [[ $count -lt 20 && "${vusb0_status}" != "Up" ]] ]
do
sleep 10
count=$(( $count + 1 ))
@jbfriedrich
jbfriedrich / git-clearHistory
Created July 5, 2019 13:29 — forked from stephenhardy/git-clearHistory
Steps to clear out the history of a git/github repository
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git
@jbfriedrich
jbfriedrich / templatize_centos7.sh
Created November 20, 2019 13:58
Script to "sanitize" as CentOS VM to turn it into a template.
#!/bin/bash
#stop logging services
/sbin/service rsyslog stop
/sbin/service auditd stop
#remove old kernels
/bin/package-cleanup --oldkernels --count=1
#clean yum cache
/usr/bin/yum clean all
#force logrotate to shrink logspace and remove old logs as well as truncate logs
/usr/sbin/logrotate -f /etc/logrotate.conf
@jbfriedrich
jbfriedrich / .tmux.conf
Created January 7, 2020 14:19
My tmux configuration file (v1.8.4)
# Make Ctrl+x Control key
unbind C-b
set -g prefix C-x
bind-key C-x send-prefix
# Rename window with C-x-A
unbind C-,
bind-key A command-prompt 'rename-window %%'
# Resize panes easily with Alt/Option
@jbfriedrich
jbfriedrich / templatize_ubuntu1804.sh
Created January 19, 2020 03:36
Script to "sanitize" a Ubuntu VM to turn it into a template.
#!/bin/bash
# Configure Package Repos
cat <<EOF >/etc/apt/sources.list
deb http://archive.ubuntu.com/ubuntu bionic main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu bionic main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu bionic-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu bionic-updates main restricted universe multiverse
@jbfriedrich
jbfriedrich / writeas_fastodon.css
Created May 3, 2020 06:44
WriteAS Fastodon Theme CSS
/* Fosstodon Hub theme written by Kev Quirk (https://kevq.uk) and released under the GPL v3 license (https://www.gnu.org/licenses/gpl-3.0.en.html). */
/* Import required font */
@import url('https://fonts.googleapis.com/css?family=Open+Sans:300,400,700&display=swap');
@import url('https://cdnjs.cloudflare.com/ajax/libs/prism/1.19.0/themes/prism-tomorrow.min.css');
/* Load PrismJS scripts and CSS */
/* Create colour variables to be used throughout the theme (makes colours easier to change globally). */
@jbfriedrich
jbfriedrich / writeas.css
Last active December 18, 2021 03:17
Write.as CSS for micro.jason.re
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,400;0,700;1,400&display=swap');
@import url("https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css");
#post .alert,
#post article,
body#collection article,
body#subpage #wrapper h1,
body#subpage article, pre {
max-width: 45rem;
}