Skip to content

Instantly share code, notes, and snippets.

View slmingol's full-sized avatar
:octocat:
codz

Sam Mingo slmingol

:octocat:
codz
View GitHub Profile
@slmingol
slmingol / upgrade_openssh_on_os_10.9.x.md
Created July 24, 2023 14:28 — forked from jmenbo/upgrade_openssh_on_os_10.9.x.md
Manually upgrade OpenSSH on OS 10.9.x

Manually upgrade OpenSSH on OS 10.9.x

NOTE: Installation and testing was done on a clean Mavericks (OS 10.9) installation

Install Brew:

Install Homebrew prereqs:

xcode-select --install

Install Homebrew

@slmingol
slmingol / awk_netstat.sh
Created April 3, 2023 18:04 — forked from staaldraad/awk_netstat.sh
AWK to get details from /proc/net/tcp and /proc/net/udp when netstat and lsof are not available
# Gawk version
# Remote
grep -v "rem_address" /proc/net/tcp | awk '{x=strtonum("0x"substr($3,index($3,":")-2,2)); for (i=5; i>0; i-=2) x = x"."strtonum("0x"substr($3,i,2))}{print x":"strtonum("0x"substr($3,index($3,":")+1,4))}'
# Local
grep -v "rem_address" /proc/net/tcp | awk '{x=strtonum("0x"substr($2,index($2,":")-2,2)); for (i=5; i>0; i-=2) x = x"."strtonum("0x"substr($2,i,2))}{print x":"strtonum("0x"substr($2,index($2,":")+1,4))}'
# No Gawk
# Local
grep -v "rem_address" /proc/net/tcp | awk 'function hextodec(str,ret,n,i,k,c){

mdadm

Glossary:

  • md: multiple devices
command description
cat /proc/mdstat show status of all raids
mdadm --detail /dev/md0 detailed status of raid md0
@slmingol
slmingol / script.sh
Last active February 6, 2022 22:26 — forked from kwilczynski/script.sh
Dump ad list (ad blocking list), whitelist and blacklist from Sqlite database on Pi Hole
sqlite3 /etc/pihole/gravity.db -header -csv 'select * from adlist' > adlist.csv
sqlite3 /etc/pihole/gravity.db -header -csv 'select * from vw_whitelist' > whitelist.csv
sqlite3 /etc/pihole/gravity.db -header -csv 'select * from vw_blacklist' > blacklist.csv
@slmingol
slmingol / osxvpnrouting.markdown
Created February 1, 2022 03:48 — forked from taldanzig/osxvpnrouting.markdown
Routing tips for VPNs on OS X

Routing tips for VPNs on OS X

When VPNs Just Work™, they're a fantastic way of allowing access to a private network from remote locations. When they don't work it can be an experience in frustration. I've had situations where I can connect to a VPN from my Mac, but various networking situations cause routing conflicts. Here are a couple of cases and how I've been able to get around them.

Specific cases

Case 1: conflicting additional routes.

In this example the VPN we are connecting to has a subnet that does not conflict with our local IP, but has additional routes that conflict in some way with our local network's routing. In my example the remote subnet is 10.0.x.0/24, my local subnet is 10.0.y.0/24, and the conflicting route is 10.0.0.0/8. Without the later route, I can't access all hosts on the VPN without manually adding the route after connecting to the VPN:

@slmingol
slmingol / github-actions-notes.md
Created June 4, 2021 19:02 — forked from br3ndonland/github-actions-notes.md
Getting the Gist of GitHub Actions
@slmingol
slmingol / TrueColour.md
Created May 30, 2021 05:32 — forked from XVilka/TrueColour.md
True Colour (16 million colours) support in various terminal applications and terminals

Terminal Colors

There exists common confusion about terminal colors. This is what we have right now:

  • Plain ASCII
  • ANSI escape codes: 16 color codes with bold/italic and background
  • 256 color palette: 216 colors + 16 ANSI + 24 gray (colors are 24-bit)
  • 24-bit true color: "888" colors (aka 16 milion)
@slmingol
slmingol / version-up.sh
Created May 8, 2021 12:42 — forked from OleksandrKucherenko/version-up.sh
Calculate Next Suitable Version Tag for Your Git based project
#!/usr/bin/env bash
## Copyright (C) 2017, Oleksandr Kucherenko
## Last revisit: 2017-09-29
# For help:
# ./versionip.sh --help
# For developer / references:
# https://ryanstutorials.net/bash-scripting-tutorial/bash-functions.php
# http://tldp.org/LDP/abs/html/comparison-ops.html
@slmingol
slmingol / ansible.cfg
Created March 18, 2021 03:30 — forked from krigar/ansible.cfg
Bastion Playbook
[ssh_connection]
ssh_args = -F ssh.cfg
control_path = ~/.ssh/mux-%r@%h:%p