Skip to content

Instantly share code, notes, and snippets.

View heywoodlh's full-sized avatar
:octocat:
Trapped in Vim

Spencer Heywood heywoodlh

:octocat:
Trapped in Vim
View GitHub Profile
@heywoodlh
heywoodlh / caffeine.sh
Last active May 31, 2022 03:36
Caffeine shell script (reddit source in comments)
#!/usr/bin/env bash
if uname | grep -i linux
then
status=`xset -q | grep 'DPMS is' | awk '{ print $3 }'`
if [ $status == 'Enabled' ]
then
xset -dpms && \
notify-send 'Screen suspend is disabled.'
else
xset +dpms && \
#!/usr/bin/env bash
rofi -combi-modi window,drun,ssh -theme nord -font "arial 10" -show combi -show-icons
@heywoodlh
heywoodlh / .pre-commit-hooks.yaml
Last active May 24, 2022 20:38
Pre-commit hooks
- id: gitleaks-docker
name: Detect hardcoded secrets
description: Detect hardcoded secrets using Gitleaks
entry: heywoodlh/gitleaks protect --verbose --redact --no-git
language: docker_image
flan-scan () {
if [[ -z "$@" ]] || [[ $1 == '--help' ]]
then
printf 'flan-scan "192.168.0.0/24 192.168.1.0/24"\n'
else
mkdir -p ~/tmp/flan_scan/reports
mkdir -p ~/tmp/flan_scan/xml_files
if [ -e ~/tmp/flan_scan/flan-ips.txt ]
imports:
base16-shell: dotfiles/config/base16-shell
choose-file-manager: home/bin/
choose-launcher: home/bin/
choose-buku: home/bin/
vultr-sh: home/bin
journal: home/bin
log: home/bin
imports:
base16-shell: dotfiles/config/base16-shell
choose-file-manager: home/bin/
choose-launcher: home/bin/
choose-buku: home/bin/
vim-airline: dotfiles/vim/bundle/airline
vim-airline-themes: dotfiles/vim/bundle/airline-themes
vim-auto-pairs: dotfiles/vim/bundle/auto-pairs
@heywoodlh
heywoodlh / pass-insert-otp.sh
Created May 24, 2022 19:28
simple function for inserting otp code into pass
pass-insert-otp () {
if [ -z $1 ]
then
echo "Usage: pass-insert-otp example.com/testing"
error="True"
else
error="False"
entry="$1"
fi
@heywoodlh
heywoodlh / github-leaks.sh
Created May 23, 2022 22:48
Simple script to scan an array of repositories for secrets
#!/usr/bin/env bash
working_dir="$(pwd)"
## Exit if dependences are not installed
missing_deps=""
command -v gh > /dev/null || missing_deps+="gh "
command -v git > /dev/null || missing_deps+="git "
command -v ssh > /dev/null || missing_deps+="openssh "
command -v gitleaks > /dev/null || missing_deps+="gitleaks "
#!/usr/bin/env bash
bw get password ssh/key_passphrase | head -1
#!/usr/bin/env bash
## Personal log script. Assumes the following:
### - All logs will be placed in the same directory (set with journal_dir environment variable)
### - Logs will organized in directories by year, month, day (i.e. 2020/Nov/25.txt)
### - Password-store will be used to encrypt and edit files (default $EDITOR will be used)
## Script assumes that all logs will be placed in the same root directory
if [[ -n $log_dir ]]
then
root_dir="$log_dir"