Skip to content

Instantly share code, notes, and snippets.

Avatar

Allen Fair afair

View GitHub Profile
@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.
View sendqmqp.pl
#!/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
View tenda-ap.md

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
View pgbackup.sh
#!/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.
View time-count
#!/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
View et-25k-songs.txt
?? 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!
View pgbackup
#!/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
View http_request.php
<?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
View vimdiffmergetool.md

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

@afair
afair / hackintosh3.md
Last active June 15, 2020 17:31
Hackintosh #3 [2018]
View hackintosh3.md

Hackintosh #3 (2018)

Build

  • Corsair Carbide 200R Windowed Compact ATX Case
  • Corsair CX Series CX750M 750 Watt 80 Plus Bronze ATX Modular Power Supply
  • Gigabyte GA-Z270M-D3H LGA 1151 mATX Intel Motherboard
    • Intel Z270
    • Core i7 / i5 / i3 / Pentium / Celeron (LGA1151)
    • 4x288pin up to 64GB DR4 3866(O.C.)/ 3800(O.C.)/ 3733(O.C.)/ 3666(O.C.)/ 3600(O.C.)/ 3466(O.C.)/ 3400(O.C.)/ 3333(O.C.)/ 3300(O.C.)/ 3200(O.C.)/ 3000(O.C.)/ 2800(O.C.)/ 2666(O.C.)/ 2400(O.C.)/ 2133
  • Realtek ALC892
@afair
afair / issue.rb
Created December 4, 2017 20:27
Possible AR Polymorphic Association Regression (5.2.0.beta2)?
View issue.rb
# frozen_string_literal: true
# https://raw.githubusercontent.com/rails/rails/master/guides/bug_report_templates/active_record_master.rb
gem "bundler", "< 1.16"
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e