Skip to content

Instantly share code, notes, and snippets.

View chawl3y's full-sized avatar

Charles Hawley chawl3y

  • Cleveland, Ohio
View GitHub Profile
@chawl3y
chawl3y / calibre-bitter-typewriter.css
Created December 11, 2025 13:53
Calibre CSS Bitter Typewriter
@import url(https://fonts.googleapis.com/css?family=Bitter);
@import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono);
body.calibre-viewer-paginated {
font-family: "Bitter", "Ubuntu Mono" !important;
font-size: 100%;
text-indent: 2em !important;
line-height: 175% !important;
padding: 10px;
word-wrap: break-word;
@chawl3y
chawl3y / calibre-averia-paperback.css
Created December 11, 2025 13:52
Calibre CSS Averia Paperback
@import url('https://fonts.googleapis.com/css2?family=Averia+Gruesa+Libre&family=Fragment+Mono:ital@0;1&display=swap');
body.calibre-viewer-paginated {
font-family: "Averia Gruesa Libre", "Fragment Mono" !important;
font-size: 125%;
text-indent: 2em !important;
line-height: 125% !important;
padding: 10px;
word-wrap: break-word;
}
@chawl3y
chawl3y / vimrc
Created May 8, 2025 20:10
20250508_2_vimrc
" ---------------------------------------------------------------------------------------------------------------------
" ==> .vimrc
" ---------------------------------------------------------------------------------------------------------------------
" ==> Some settings from Vim Zero: https://www.oliversherouse.com/posts/vim_zero.html
"
syntax enable
filetype plugin on
" General
@chawl3y
chawl3y / vimrc
Created May 8, 2025 16:57
20250508_vimrc
" ---------------------------------------------------------------------------------------------------------------------
" ==> .vimrc
" ---------------------------------------------------------------------------------------------------------------------
" ==> Some settings from Vim Zero: https://www.oliversherouse.com/posts/vim_zero.html
"
syntax enable
filetype plugin on
" General
@chawl3y
chawl3y / Vim Datestamp
Last active May 3, 2025 12:30
Vim function to insert datestamp with <leader>m
" Vim mapping to insert the day and date as a header for notes, journals etc
function! InsertFormattedDate()
let day = strftime("%d")
let suffix = "th"
if day =~# "^02\\\|2\\\|22$"
let suffix = "nd"
elseif day =~# "^01\\\|1\\\|21\\\|31$"
let suffix = "st"
elseif day =~# "^03\\\|3\\\|23$"
let suffix = "rd"
@chawl3y
chawl3y / apache-restart.md
Created April 14, 2025 17:57
Apache OOM Restart

A rube-goldberg style solution for restarting Apache when it gets killed my the OOM-Killer and logging the results for further analysis

#!/usr/bin/env bash
#===============================================================================
#
#          FILE: apache-restart.sh
#         USAGE:
#   DESCRIPTION: Watches syslog for OOM message, restarts Apache if killed
#         NOTES: The downside to this script is that it'll fire for the entire
@chawl3y
chawl3y / mempigs.md
Created April 25, 2023 01:02
Find top memory users on Linux

top memory users (mempigs)

ps aux  | awk '{print $6/1024 " MB\t\t" $11 " " $12}'  | sort -n | tail -10

Alias it with:

alias mempigs="ps aux | awk '{print \$6/1024 \" MB\t\t\" \$11 \" \" \$12}'  | sort -n | tail -10"
@chawl3y
chawl3y / generic-directory-backup.md
Created April 25, 2023 00:57
Generic Directory Backup Shell Script

Generic Directory Backup Script

I regularly have directories of files I want to back up in case of disaster. Usually these are files that change often, and I only want to keep recent versions in case I want to revert or recover changes. (Git? git, who?)

I have used this script over and over as a simple way to archive a directory to a location with a date-stamped filename. It also cleans up after itself by deleting files older than X days. I stick it in CRON and let it run on a schedule and I always have an archive of the last X days of the files in my directory.

#!/usr/bin/env bash
#===============================================================================
#
@chawl3y
chawl3y / zandronum-ubuntu.md
Created April 25, 2023 00:53
Zandronum on Ubuntu

Zandronum

Summary

Zandronum brings classic Doom into the 21st century, maintaining the essence of what has made Doom great for so many years and, at the same time, adding new features to modernize it, creating a fresh, fun new experience.

Install

wget -O - http://debian.drdteam.org/drdteam.gpg | sudo apt-key add -
@chawl3y
chawl3y / bash-challenges.md
Last active April 7, 2021 20:14
BASH Challenges

BASH Challenges


  1. Check for the presence of a directory and create it if it doesn't exist

    Example Solution

    devdir="/mnt/sqlback1/LSQLSHARE01DEV"
    if [[ ! -d "${devdir}" ]]; then