Skip to content

Instantly share code, notes, and snippets.

@gregmark
gregmark / get_ntp_offset.txt
Last active January 19, 2022 00:40
Get NTP offset cleanly
ntpdc -c loopinfo | awk '^offset: {print $2}'
@gregmark
gregmark / sort_ips.pl
Last active February 26, 2018 19:25
sort your IPs with perl
#!/usr/bin/perl
#####################################################################
###
### sort_ips.pl
### -----------
###
#####################################################################
use strict;
@gregmark
gregmark / poll_subs.pl
Created February 26, 2018 19:29
perl subs for node discovery
#!/usr/bin/perl
#############################################################################
### poll_subs.pl: Net:SSH or Func guts
#############################################################################
use Data::Dumper;
our $SHELL_TRUE = 0;
our $DEBUG = 0;
@gregmark
gregmark / tmux-cheatsheet.markdown
Last active April 19, 2018 14:46 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@gregmark
gregmark / aws_ec2_describe_images_00.txt
Last active September 6, 2018 20:02
List AMIs by Name (fileglob optional)
aws ec2 describe-images \
--filters "Name=name,Values=kinetica*" --query \
"Images[*].{ID:ImageId,NAME:Name,DESC:Description,CREATED:CreationDate}"
@gregmark
gregmark / curl-verify-ssl.txt
Last active December 8, 2020 20:22
SSL Cert Verify with cURL
└─▪ curl --insecure -vvI https://porkbellies.randolph.duke.sell/ 2>&1 |
awk 'BEGIN{cert=0} /^\* SSL connection/ {cert=1} /^\* / {if(cert) print}'
* subject: CN=*.randolph.duke.sell
* start date: Dec 7 13:54:42 2020 GMT
* expire date: Mar 7 13:54:42 2021 GMT
* issuer: C=US; O=Let's Encrypt; CN=R3
* SSL certificate verify ok.
@gregmark
gregmark / README.md
Created March 7, 2021 00:48 — forked from magnetikonline/README.md
Bash array usage cheatsheet.
@gregmark
gregmark / bash-options-drew-stokes.sh
Last active April 8, 2022 20:20
BASH while opts
#!/bin/bash
# https://medium.com/@Drew_Stokes/bash-argument-parsing-54f3b81a6a8f
PARAMS=""
while (( "$#" )); do
case "$1" in
-a|--my-boolean-flag)
MY_FLAG=0
shift
;;
@gregmark
gregmark / bash-options-gregmark-I.sh
Last active November 29, 2022 21:24
Bash Options -- gregmark, mark 1
#!/bin/bash
# me
# ------------------------------------------------------------------------------
script=$(basename $0)
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &>/dev/null && pwd )"
script_path="${script_dir?}/${script}"
# error & usage
@gregmark
gregmark / vim-cheats-gregmark_1.md
Last active May 2, 2024 03:10
VIM Cheats, gregmark I

VIM Help

CTRL-d - lists possible command completions 
TAB - cycles through possible command completions

Example:

:help tags (then CTRL-d and TAB)