Skip to content

Instantly share code, notes, and snippets.

@eeowaa
eeowaa / go-template-mode.el
Created December 20, 2022 02:39 — forked from anonymous/go-template-mode.el
Go template mode
;;; go-template-mode.el --- Major mode for Go template language
;;; Commentary:
;; 1) Copy this file somewhere in your Emacs `load-path'. To see what
;; your `load-path' is, run inside emacs: C-h v load-path<RET>
;;
;; 2) Add the following to your .emacs file:
;;
;; (require 'go-template-mode)
@eeowaa
eeowaa / no-neovim.md
Last active October 25, 2022 21:52
No Neovim for me

This is why I don't use Neovim: neovim/neovim#997

In essense, the maintainers are dismissive of their users. This is somewhat ironic, because similar qualms with Vim is what drove the creation of Neovim. The Emacs community is much friendlier and easier to work with.

@eeowaa
eeowaa / install-openldap.sh
Created June 25, 2022 00:35
Install an OpenLDAP server on Fedora 35
# Become root
sudo su -
# Install OpenLDAP and our favorite scriptable editor
dnf -y install openldap openldap-servers openldap-clients ed
# Define some parameters for our LDAP directory
BASEDN='dc=example,dc=com'
BINDDN="cn=Manager,$BASEDN"
PASSWD=`slappasswd -s password`
@eeowaa
eeowaa / ssh-tunnels.md
Last active April 7, 2022 19:25
SSH Tunnels

SSH Tunnels

  • ASCII diagrams inspired by this Stack Exchange answer.
  • In all of the examples shown, port 123 must be free on your client host before opening the SSH tunnel.

Useful options

  • -T: Disables pseudo-tty allocation, which is appropriate because you're not trying to create an interactive shell.
  • -N: Says that you want an SSH connection, but you don't actually want to run any remote commands. If all you're creating is a tunnel, then including this option saves resources.
  • -f: Tells ssh to background itself after it authenticates, so you don't have to sit around running something on the remote server for the tunnel to remain alive.

Local port forwarding to remote host

@eeowaa
eeowaa / git-import-tree.sh
Last active November 3, 2021 21:51
Replace a branch head with an imported tree from another git repo
# Checkout a new feature branch off of main
git checkout -b feature/import-tree main
# Clear the worktree, but keep the index
cd "`git rev-parse --show-toplevel`"
git rm -rf .
git reset
# Replace the contents of the worktree with that of another git repo's HEAD
git -C ../other-repo archive --format=tar HEAD | tar xf -
@eeowaa
eeowaa / directory-perms.org
Last active November 19, 2021 09:15
Explanation of *nix directory permission bits, with mnemonic devices
Modecdlsls -lcattouch
--- 0
--x 1xx
-w- 2
-wx 3xxx
r-- 4x
r-x 5xxxx
rw- 6x
rwx 7xxxxx
@eeowaa
eeowaa / estimations.md
Created February 27, 2021 01:53
Survey to give oneself when creating tasks and estimates

Definition of Done:

  • Measurable condition(s):
  • Room for interpretation:
  • Related out-of-scope items:

Assumptions:

  • Dependencies (including state):
  • Technology to be used:
  • Potential issues:
@eeowaa
eeowaa / diffcolor
Created June 19, 2019 23:10
Colorize diff input using ANSI escape codes
#!/usr/bin/sed -f
## Colorize diff input with ANSI color escape codes
###############
### Input ###
###############
# All formats
/^Binary files.*differ$/bf
/^Only in.*/bf
@eeowaa
eeowaa / git-bulk
Last active March 29, 2019 16:01
Perform a specific git operation on every repository residing in a child directory of the current working directory
#!/bin/sh
# XXX: Hack to get to the cwd of the parent process
test "X$GIT_PREFIX" = X || cd -- "$GIT_PREFIX"
# Only return 0 if *everything* succeeds
rc=0
# Output a nice header to separate this command from the others
cat <<EOF
@eeowaa
eeowaa / git-show-config
Last active February 28, 2019 14:15
Print a tabulated list of active git config customizations
#!/usr/bin/perl -wn
BEGIN {
# Separate records by nulls instead of newlines
$/ = "\0";
# Initialize printf field widths to zero
$origin_width = $key_width = $value_width = 0;