Skip to content

Instantly share code, notes, and snippets.

View afair's full-sized avatar

Allen Fair afair

View GitHub Profile
@afair
afair / arch-linux-install.md
Last active April 18, 2024 13:23
Notes from the time I installed Arch Linux.
@afair
afair / modern-command-line.md
Created October 18, 2023 12:55
Modern Command Line

Modern Command Line

Links from my recent dive into exploring a modern terminal setup. I've shared videos I've seen as well as kids these days to that instead of blog posts.

Modern Terminal

  • iTerm2 - (I now like the "Tango Dark" Theme that ships with iTerm)
  • https://alacritty.org/ - Cross-platform terminal (Mac, Linux, BSD) with required features
  • Remember to use 256-color mode terminal and Unicode/locale modes! (see fonts)

Modern Font

These fonts have been patched to include icons useful for terminals (files, utilities, ecosystems)

@afair
afair / sendqmqp.pl
Last active March 4, 2022 15:59
Standalone script to send message on STDIN via QMQP. Useful as a Postfix QMQP Transport.
#!/usr/bin/env perl
############################################################################
# sendqmqp - Qmail QMQP Command-Line Interface/Client
# (c) 2022 BIGLIST.com and Allen M. Fair. All rights reserved.
#---------------------------------------------------------------------------
# Usage: sendqmqp.pl ip:port sender recipients... < message
############################################################################
package SendQMQP;
use strict 'vars', 'refs';
@afair
afair / tenda-ap.md
Last active October 8, 2021 22:07
Tenda N300 N301 AC5 WiFi Router AP Access Point Setup

Tenda N300 N301 AC5 WiFi Router AP Access Point Setup

I have ethernet running to my Fios modem/router on either end of a very long house. I wanted to set the modem/router and Tenda routers to have the same network name (SSID) and password so it would auto-connect from anywhere in the house. To do this, use AP (Access Point) mode.

Notes

  • I used an ethernet cable from laptop to WAN port of router.
  • Power on Router
@afair
afair / pgbackup.sh
Created May 27, 2021 14:17
PostgreSQL Backup and Restore Script
#!/usr/bin/env bash
################################################################################
# pgbackup - Run without arguments for help.
# - Wrapper for PG backup/restore utilities
# (C) 2018 Allen Fair. All rights reserved.
################################################################################
# Use ENV Variables to override these defaults
user=${PGUSER-$USER}
@afair
afair / time-count
Last active October 18, 2021 21:55
Takes (log) lines with ISO timestamp at start, counts by year/month/day/hour/minute(default)/second. Useful for log analysis counts, like "uniq -c" for time periods.
#!/usr/bin/env perl
################################################################################
# time-count : Counts log lines per time (number of chars of timestamp)`
# Takes (log) lines with timestamp near the start, looking for:
# * ISO/ISO-8601 : yyyy-mm-dd.hh:mm:ss
# * Common Log Format: [dd/mmm/yyyy:hh:mm:ss -zzzz]
# * Unix epoch : 1521458735.901159500
# counts by year/month/day/hour/minute(default)/second.
# Useful for log analysis counts, like "uniq -c" for time periods.
# Intended for use as a Unix command taking its input as a pipe.
@afair
afair / et-25k-songs.txt
Created February 11, 2019 01:44
MagicSing ET-25K Song Database, normalized for search
?? Title Artist
07992 Ah Doo Doo Doo Willie Revillame
07993 Bilog Ang Mundo Manny Pacquiao
07994 Boom Tarat Tarat Willie Revillame
07995 Champion Sa Kantahan Manny Pacquiao
07996 Hephep Hooray (Happy Birthday) Willie Revillame
07997 Ikaw At Ako Manny Pacquiao
07998 Laban Nating Lahat Ito Manny Pacquiao
07999 Panalo Ka Sa Puso Ko (Extreme Jingle) Sarah Geronimo
08000 Para Sa 'yo Ang Laban Na 'to Manny Pacquiao
@afair
afair / pgbackup
Last active April 8, 2019 19:44
Simple PostgreSQL pg_backup/pg_restore wrapper for multi-job processing. Not that generic, but does the hard work!
#!/usr/bin/env bash
################################################################################
# pgbackup - Run without arguments for help.
# - Wrapper for PG backup/restore utilities
# (C) 2018 Allen Fair. All rights reserved.
################################################################################
# Use ENV Variables to override these defaults
user=${PGUSER-$USER}
@afair
afair / http_request.php
Last active December 24, 2022 06:18
PHP Function to make a remote HTTP request (POST, Authentication, API, Files, etc.) and returns the response
<?php
/**
* Makes a remote HTTP request and returns the response.
*
* @author Allen Fair <allen.fair@gmail.com>
* @copyright 2018 Allen Fair
* @license https://opensource.org/licenses/MIT MIT
*
* @param string $url The full URL endpoint: "https://example.com/endpoint"
* @param array $opt An Associative Array of extended request options
@afair
afair / vimdiffmergetool.md
Last active May 21, 2019 07:48
Merge/Rebase with git mergetool vimdiff usage

Using 'vimdiff' as your git mergetool

.vimrc

" vimdiff
if &diff
  map <silent> <leader>1 :diffget LOCAL<CR>
  map <silent> <leader>2 :diffget BASE<CR>
  map <silent> <leader>3 :diffget REMOTE<CR>
  map <silent> <leader>u :diffupdate<CR>

map s :wqall