Skip to content

Instantly share code, notes, and snippets.

@mthrynn
mthrynn / getsudo_keepsudo
Last active December 6, 2019 23:24
grab sudo password and then keep it in context through out the life of the script.
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until `.osx` has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
kubectl get pods --field-selector=status.phase=Failed --no-headers=true | awk '{print $1}' | xargs kubectl delete pod
@mthrynn
mthrynn / pcat-install.sh
Created October 17, 2019 16:22 — forked from BretFisher/pcat-install.sh
On macOS: Install pygmentize and alias pcat for shell code syntax highlighting
# first install pygmentize to the mac OS X or macOS system with the built-in python
sudo easy_install Pygments
# then add alias to your ~/.bash_profile or ~/.bashrc or ~/.zshrc etc.
alias pcat='pygmentize -f terminal256 -O style=native -g'
@mthrynn
mthrynn / README-Template.md
Created July 18, 2019 15:53 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@mthrynn
mthrynn / nmap.output.ip
Last active December 6, 2019 23:26
nmap output only IP
nmap -sP 192.168.1.0/24 | awk '/is up/ {print up}; {gsub (/\(|\)/,""); up = $NF}'
@mthrynn
mthrynn / ask.sh
Created March 18, 2019 17:41
Bash General-Purpose Yes/No Prompt Function ("ask")
# This is a general-purpose function to ask Yes/No questions in Bash, either
# with or without a default answer. It keeps repeating the question until it
# gets a valid answer.
ask() {
# https://gist.github.com/davejamesmiller/1965569
local prompt default reply
if [ "${2:-}" = "Y" ]; then
prompt="Y/n"
@mthrynn
mthrynn / OSX_TCP_options.command
Last active July 17, 2023 07:14 — forked from Zillionx/OSX_TCP_options.command
OSX - Tuning the Network Stack TCP
## Quick fix for slow internet after update to OSX 10.11 "El Capitan"
## Changes are not permanent, just restart your mac if it doesn't work.
## write config
sudo su -
sysctl -w net.inet.tcp.doautorcvbuf=0
sysctl -w net.inet.tcp.doautosndbuf=0
sysctl -w net.inet.tcp.win_scale_factor=0
sysctl -w kern.ipc.somaxconn=2048
sysctl -w net.inet.tcp.rfc1323=1