Skip to content

Instantly share code, notes, and snippets.

View tsharley's full-sized avatar

TJ Sharley tsharley

View GitHub Profile
@tsharley
tsharley / README-Fancy.md
Created November 11, 2024 09:24 — forked from ramantehlan/README-Fancy.md
README template I use for most of my projects.

Introduction

  • Add your project logo.
  • Write a short introduction to the project.
  • If you are using badges, add them here.

📒 Index

@tsharley
tsharley / Mac SSH Autocomplete
Created May 12, 2024 05:51 — forked from aliang/Mac SSH Autocomplete
Add auto complete to your ssh, put into your .bash_profile
_complete_ssh_hosts ()
{
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
comp_ssh_hosts=`cat ~/.ssh/known_hosts | \
cut -f 1 -d ' ' | \
sed -e s/,.*//g | \
grep -v ^# | \
uniq | \
grep -v "\[" ;
@tsharley
tsharley / docker-compose.yml
Created March 17, 2024 10:36 — forked from davidostermann/docker-compose.yml
Docker compose Postgres Adminer
version: '3.1'
services :
db:
image: postgres:10-alpine
ports:
- "5432:5432"
environment:
POSTGRES_USER: user1
POSTGRES_PASSWORD: changeme
POSTGRES_DB: tododb
@tsharley
tsharley / ANSI.md
Created January 28, 2024 16:56 — forked from fnky/ANSI.md
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@tsharley
tsharley / bash_pre_post_hook.md
Last active January 25, 2024 13:51 — forked from jeandat/pre_post_hook_prompt.md
Bash pre- & post-command hooks

Bash pre- & post-command hooks

Explained here.

AT_PROMPT=1

function PreCommand() {
	# This will run before any command is executed.
	if [ -z "$AT_PROMPT" ]; then
#!/usr/bin/env bash
# Executing the following will remove the cluster status/configuration from a
# single-node cluster. Useful if the cluster was initialized unintentionally
# and Corosync's restrictions are preventing further changes. Root required.
systemctl stop pve-cluster corosync
pmxcfs -l
rm -r /etc/corosync/*
rm /etc/pve/corosync.conf
@tsharley
tsharley / gist:37d91906cdd51e05a0a7cc14bfd6cf2e
Created February 15, 2023 20:28
Heredoc script to generate bash code / another script
#!/bin/bash
# generate-script.sh
# A script that generates another script using a heredoc.
# More examples and use cases at https://tldp.org/LDP/abs/html/here-docs.html.
# Based on an idea by Albert Reiner.
OUTFILE=generated.sh # Name of the file to generate.
# -----------------------------------------------------------
# 'Here document containing the body of the generated script.
(