Skip to content

Instantly share code, notes, and snippets.

View afair's full-sized avatar

Allen Fair afair

View GitHub Profile
@afair
afair / tm.sh
Last active April 19, 2024 22:59
Tmux rails session wrapper script
#!/usr/bin/env bash
################################################################################
# Script to initiate (or connect to) a tmux session
###############################################################################
# Starts session and returns, or attaches to existing session name and exits.
function tm_session { # session name
#echo tmux start-server
tmux start-server
#echo tmux has-session -t $1
@afair
afair / arch-linux-install.md
Last active April 18, 2024 13:23
Notes from the time I installed Arch Linux.
@afair
afair / curl reference.md
Last active February 11, 2024 05:54
Curl command reference with most used options. No overwhelming man page.

Curl Reference

Use the curl command line tool from your terminal window to access web pages, resources, and API's. This swiss-army knife of the internet also supports many more protocols and tools.

Command format

curl [options] URL

The complete, offical reference page is here.

@afair
afair / bash.cheat
Created August 27, 2012 20:23
Bash Scripting Quick Reference
==========================================
BASH SCRIPTING ==========================================
========================================== TEST COMMAND
==========================================
Invoke: bash [options] file
Shebang: #!/usr/bin/env bash Test: test expression
In script: [ expression ]
========================================== Alternate: [[ espression ]]
LOOP Does not split string words
========================================== Does not expand pathglobs*
@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 / tmux.cheat
Last active October 11, 2023 13:48
Tmux Quick Reference & Cheat sheet - 2 column format for less scrolling!
========================================== ==========================================
TMUX COMMAND WINDOW (TAB)
========================================== ==========================================
List tmux ls List ^b w
New new -s <session> Create ^b c
Attach att -t <session> Rename ^b , <name>
Rename rename-session -t <old> <new> Last ^b l (lower-L)
Kill kill-session -t <session> Close ^b &
@afair
afair / gist:3803895
Last active August 7, 2023 07:43
PostgreSQL and Pgpool Architecture

Hey! I saw this has been indexed by the search engines. It is a first draft of a post I ended up publishing on my blog at: Scaling PostgreSQL With Pgpool and PgBouncer

Thanks for stopping by!

PostgreSQL and Pgpool Architecture

@afair
afair / gist:2402068
Last active August 2, 2023 10:50
Perl References for Kittens

Perl References

Simple Perl variables are called scalars. Examples of scalar values are

   $number      = 123;
   $string      = "String";
   $file_handle = open "<filename";
   $null_value  = undef;
 $instance = MyClass-&gt;new;
@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 / 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