Skip to content

Instantly share code, notes, and snippets.

View equwal's full-sized avatar
🎯
Focusing

Spenser Truex equwal

🎯
Focusing
View GitHub Profile
@equwal
equwal / .bashrc
Last active November 12, 2019 04:40
Mount and ask to decrypt home on login, startx from the user persective after.
# Startx only if logged in on the first tty (leave other TTYs open for TTY use.)
# includes custom keymaps and startx
if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then
human-interface
fi
@equwal
equwal / roswell-insert.el
Last active November 11, 2019 22:48
Roswell auto-insertion for Emacs.
;;;; Executes $ ros init CURRENTBUFFER
;;;; and reloads it when making a new *.ros file
;;;; Roswell: https://github.com/roswell/roswell
;;;###autoload
(defun boilerplate-ros-auto-insertion ()
(shell-command (concat "ros init " "'"(file-name-base (buffer-file-name)) "'"))
(find-file (buffer-file-name)))
(setq auto-insert t)
@equwal
equwal / murder
Created November 12, 2019 04:41
Murder processes with a pattern
#!/usr/bin/perl
use warnings;
use strict;
my $pattern;
my $murder;
if($#ARGV > 0) {
$murder = 1;
$pattern = $ARGV[1];
print "Murdering:\n";
@equwal
equwal / hist.el
Last active November 20, 2019 03:27
Sort IRC logs (quick and dirty fish script). Run that thing from rcirc using the SHELL module.
;;;; Also see the command which this is calling: https://gist.github.com/equwal/92d3b6bb19c4045d54c74b36d294a4e6
(defun-rcirc-command hist (channel-name)
"Get a log history"
(interactive "Schannel: ")
;; Must use a script, since the line length is too short to send a meaningful REGEX.
(rcirc-cmd-msg (concat "*shell ~/logchan.fish "
(apply #'concat
(loop for x across channel-name
collect (if (string= (string x) "#")
"\\#"
@equwal
equwal / cron.daily-locate
Created November 13, 2019 04:18
Use a custom locate database location, in order to keep it encrypted.
#! /bin/sh
set -e
# check if we run on battery and if so then don't run
if which on_ac_power >/dev/null 2>&1; then
ON_BATTERY=0
on_ac_power >/dev/null 2>&1 || ON_BATTERY=$?
if [ "${ON_BATTERY}" -eq 1 ]; then
exit 0
fi
@equwal
equwal / fonts.el
Last active September 21, 2020 21:07
Selecting and trying out different fonts in Emacs.
;;; TL;DR
(set-face-attribute 'default nil :family "Hack");Must be the FULL name (search-fonts "Hack") for it.
(set-face-attribute 'default nil :height (* 13 10));13pt
;;; Also see: https://github.com/alphapapa/unpackaged.el#font-compare
;;; to easily compare lots of fonts.
;;; The purpose of this Gist is to help you select a font you like by trying it out in Emacs.
;;; Here is my custom Hack font: https://github.com/equwal/alt-hack0
;;; If you don't have the fonts, you can try:
;;; - Your package manager
@equwal
equwal / logchan.fish
Created November 20, 2019 03:26
Show an IRC log.
#!/bin/fish
# Show a recent log of the IRC channel (ZNC bouncer with logging enabled)
cd ~/.znc/moddata/log/equwal/freenode/"$argv"
for i in (find . -name '*.log' | sort -r | head -n 1)
cat $i
end | perl -pe 's/.*?\] \*\*\* .*\n//; print;' | tail -n 50
@equwal
equwal / update-system.sh
Created November 24, 2019 05:25
Gentoo update everything (all of it).
#!/bin/bash
# In case there was an update, "highly recommended
emerge --oneshot portage && \
emerge --sync && \
emerge -uDUNav --tree @world && \
emerge -av --depclean && \
# Only if you have layman installed:
layman -S && \
revdep-rebuild && \
# This requires manual interaction:
@equwal
equwal / sbcl-core-generation.lisp
Last active March 7, 2020 16:52
Generate SBCL core image with libraries inside
;;;; Recommended command to install SBCL:
;;;; sbcl --load "/home/jose/common-lisp/sbcl-core-generation.lisp" --script '(save-lisp-and-die "sbcl-core-libs")'
(in-package :cl-user)
;;;; The gentoo package for SBCL typically fails to create a core sanely.
;;; This code is intended to be used to generate an SBCL core on update.
(pushnew (merge-pathnames #p"common-lisp/"
(user-homedir-pathname))
asdf:*central-registry*)
#-quicklisp
(let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp"
@equwal
equwal / dijkstra.bib
Created March 29, 2020 13:17
All of Dijkstra's EWDs available as bibtex bibliography, from the uctexas archive webpage
@phdthesis{EWD:EWDthesis,
author = "Edsger W. Dijkstra",
title = "Communication with an {A}utomatic {C}omputer",
year = "1959",
publisher = "Excelsior",
school = "University of Amsterdam",
url = "http://www.cs.utexas.edu/users/EWD/PhDthesis/PhDthesis.PDF",
fileSize = 5263 KB
}
@techreport{EWD:CR1956.008,