Skip to content

Instantly share code, notes, and snippets.

View julianorchard's full-sized avatar

julianorchard

View GitHub Profile
@julianorchard
julianorchard / battery.sh
Last active February 16, 2023 21:24
A useful single line battery status command for use with i3blocks
p=$(cat /sys/class/power_supply/BAT0/capacity); ! grep -q "Dischar" /sys/class/power_supply/BAT0/status && echo " ${p}%" && exit 0 || [ $p -gt 80 ] && echo " ${p}%" && exit 0 || [ $p -gt 60 ] && echo " ${p}%" && exit 0 || [ $p -gt 40 ] && echo " ${p}%" && exit 0 || [ $p -gt 20 ] && echo " ${p}%" && exit 0 || echo " ${p}%"
@julianorchard
julianorchard / useful-iab.vim
Created January 30, 2023 10:21
Vim Insert Git Signature Using `iab`
" ~g to insert 'git_username <git@email.com>'
iab <expr> ~g substitute(system('git config --global user.name') . " <" .
\system('git config --global user.email') . ">", '\n', '', 'g')
@julianorchard
julianorchard / commit.ps1
Created December 19, 2022 15:01
A PowerShell helper for semantic commits.
## commit.ps1 --- Helper for creating semantic commits.
# Copyright (c) 2022 Julian Orchard <jorchard@pm.me>
## Description:
# Should be thought of as a temporary tool until used to doing it by default!
# Reminder text from this Gist:
# https://gist.github.com/joshbuchea/6f47e86d2510bce28f8e7f42ae84c716
@julianorchard
julianorchard / does-image-need-resizing.sh
Last active March 17, 2022 17:47
Bash function to see if the image is above a certain aspect ratio, and if so crop it to desired ratio.
#!/bin/bash
function does_image_need_resizing() {
# Image File
image=$1
# Split X:X Into Two Variables (d_1 and d_2)
r=(${2//\:/ })
d_1=${r[0]}
d_2=${r[1]}
# Get Current Aspect Ratio
@julianorchard
julianorchard / backup.vbs
Last active February 9, 2022 15:06
USB KeePassXC Backup Scripts
' File: backup.vbs
' Author: Julian Orachrd (hello@julianorchard.co.uk)
' Description: This script mainly exists to ensure I
' remember to consider if a machine is
' trustworthy before backing up the database file
' Date: 10/01/2022
' File System Object
Set fso = CreateObject("Scripting.FileSystemObject")