Skip to content

Instantly share code, notes, and snippets.

View bcawrse's full-sized avatar

Ben Cawrse bcawrse

View GitHub Profile
@bcawrse
bcawrse / .aliases
Last active May 24, 2023 19:48
Setup Zsh on fresh debian-based install
# General CLI utility.
alias la='ls -lAhF'
alias lar='ls -AhF'
alias ll='ls -lhF'
alias l='ls -hF'
alias cl='clear; lar'
alias c='clear;'
alias xg='xargs egrep -sin --color'
alias hostip="ip route get 0.0.0.0/0 | grep -Eo 'via \S+' | awk '{ print \$2 }'"
@bcawrse
bcawrse / notes.md
Created December 24, 2022 04:37
GPG Setup Notes

GPG management

What do the files mean that may be in this directory.

[keyid].pub.asc Public ASCII armored primary key [keyid].sec.asc PRIVATE ASCII armored primary key [keyid].rev.crt Revocation certificate for primary key [keyid].ssb.asc PRIVATE ASCII armored Sub keys (should have all public keys, including primary) ssh.pub public authentication subkey exported for ssh

@bcawrse
bcawrse / README.md
Created August 21, 2022 19:49 — forked from matusnovak/README.md
GPG + Git SSH Authentication and Signing on Windows 10

GPG + Git SSH Authentication and Signing on Windows 10

Introduction

This simple Gist will explain how to settup your GPG key to work for SSH authentication (with Git) and Git commit signing on Windows 10. This may seem straightforward on Linux, but there are certain tweaks needed on Windows.

No Cygwin, no MinGW, no Git Bash or any other Linux emulated environment. This works in pure Windows 10.

Software needed

@bcawrse
bcawrse / tmux.conf
Last active October 29, 2021 16:54
tmux configuration file
## Use vi keys for scrolling etc.
set-window-option -g mode-keys vi
## Do not allow tmux to rename windows
set-option -g allow-rename off
## Extend how long pane #s are displayed
## Useful for `ctrl-b q` # to switch between panes
set -g display-panes-time 4000
# Set the editor to vim.. duh
git config --global core.editor vim
# Add aliases
git config --global alias.logthis 'log --decorate --date-order --graph --tags HEAD'
git config --global alias.logall 'log --decorate --date-order --remotes --graph --tags --branches'
git config --global alias.logalls 'log --decorate --date-order --remotes --graph --tags --branches --stat'
git config --global alias.diffc 'diff --cached'
git config --global alias.count 'count-objects -vH'
git config --global alias.package '"!f() { git diff-tree -r --no-commit-id --name-only --diff-filter=ACMRT $1..HEAD; }; f"'
@bcawrse
bcawrse / .vimrc
Last active July 22, 2021 18:37
General .vimrc file
set tabstop=2
set shiftwidth=2
set textwidth=120
set expandtab
set number
set hlsearch
set pastetoggle=<F2>
:color delek
" Allow saving of files as sudo when I forgot to start vim using sudo.
cmap w!! w !sudo tee > /dev/null %
@bcawrse
bcawrse / Search my gists.md
Created July 22, 2021 18:34 — forked from santisbon/Search my gists.md
How to search gists

Enter this in the search box along with your search terms:

Get all gists from the user santisbon.
user:santisbon

Find all gists with a .yml extension.
extension:yml

Find all gists with HTML files.
language:html

@bcawrse
bcawrse / script_template.sh
Last active June 22, 2021 22:40
Template for writing new scripts
#!/bin/bash
#scriptName.sh
# Bash scripting reference manual
# - http://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html
# Bash script set options
# - https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
set -o errexit
set -o errtrace
@bcawrse
bcawrse / docker_pg_dump.sh
Created April 20, 2021 19:31
script for running pg_dump against a container
#!/bin/bash
#docker_pg_dump.sh
# Thanks to StackOverflow answer by Forth
# https://stackoverflow.com/questions/24718706/backup-restore-a-dockerized-postgresql-database/29913462#29913462
HELP_MSG="
docker_pg_dump:
Call pg_dump on RUNNING docker container.
@bcawrse
bcawrse / bash.generate.random.alphanumeric.string.sh
Last active April 19, 2021 13:44 — forked from earthgecko/bash.generate.random.alphanumeric.string.sh
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
#NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# MAC is "special" and requires LC_CTYPE override & fold gets grumpy LOOK AT COMMENTS FROM OG
# NEW_UUID=$(cat /dev/urandom | LC_CTYPE=C tr -dc 'a-zA-Z0-9' | head -c 32)
# ALSO got all weird and had fractions / wild characters in selector with LC_CTYP=C