Skip to content

Instantly share code, notes, and snippets.

Mount drive

For drive x:

sudo mkdir /mnt/x/
sudo mount -t drvfs X: /mnt/x/

To remove x:

@hexaflexahexagon
hexaflexahexagon / man-pages-reference.md
Created September 29, 2023 12:42
## useful commands

man

useful commands

man man # man man pages
man -k '' # list all man pages on the system
man -k 'compare' # search for a term in all man pages
man -s 7 -k '' # list all man pages of section 7 on the system (5 is also useful)
@hexaflexahexagon
hexaflexahexagon / git-patch.md
Created September 29, 2023 12:41
1. `git format-patch -1 <HASH>` to create the patch

Patches

  1. git format-patch -1 <HASH> to create the patch 1a. Or, use the gpat alias which does this same thing
  2. git apply <patch-name-here> to add changes to local machine
  3. gad && gic && gip to create and push new commits from those changes
# Define the exam structure in arrays
# CCNP ENCORE v1.0 from https://learningcontent.cisco.com/documents/exam-topics/350-401-ENCORE+Blueprint+-+Public.pdf
$first = "Architecture",
"Explain the different design principles used in an enterprise network",
"Analyze design principles of a WLAN deployment",
"Differentiate between on-premises and cloud infrastructure deployments",
"Explain the working principles of the Cisco SD-WAN solution",
"Explain the working principles of the Cisco SD-Access solution",
"Describe concepts of wired and wireless QoS",
@hexaflexahexagon
hexaflexahexagon / bin-searcher.sh
Created April 26, 2022 19:07
# Go through all *bin directories on a system and list file types
#!/bin/bash
# Go through all *bin directories on a system and list file types
DIRS='/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin'
EXCLUDE_REGEX='ELF|symbolic'
while IFS= read -r dir; do
[ -d ${dir} ] || continue # verify dir exists
[ "$(ls -A ${dir})" ] || continue # verify dir is not empty
@hexaflexahexagon
hexaflexahexagon / averages.sh
Last active April 17, 2022 21:43
# Read an input file and find the sum/count/average/median
#!/bin/bash
# Read an input file and find the sum/count/average/median
# ! Does not do any validation of the input !
FILE='numbers.txt' # where the file is just a list of numbers, one per line
# Read input file line-by-line
while IFS= read -r num; do
sum=$((sum + num))
@hexaflexahexagon
hexaflexahexagon / foo
Created April 14, 2022 19:50
services:
version: "3.8"
services:
pc:
image: ubuntu:20.04
volumes:
- ./volumes/apt.sh:/apt.sh:ro
command: ["sh", "-c", "/apt.sh"]
tty: true
@hexaflexahexagon
hexaflexahexagon / http-poem.sh
Created April 8, 2022 14:41
# A poem written just in HTTP header responses
#!/bin/bash
# A poem written just in HTTP header responses
# Source: https://ja.cob.land/http2-204-a-poem
curl --head https://ja.cob.land/http2-204
@hexaflexahexagon
hexaflexahexagon / keyboard-translate.sh
Created April 7, 2022 12:01
# translate source engine keybinds from one keyboard layout (e.g. QWERTY) to another (DVORAK / COLEMAK)
#!/bin/bash
# translate source engine keybinds from one keyboard layout (e.g. QWERTY) to another (DVORAK / COLEMAK)
FILE='test.cfg'
rm -f $FILE
touch $FILE
qwerty='`1234567890\-=qwertyuiop[]\\asdfghjkl;'\''zxcvbnm,./'
dvorak='`1234567890[]'\'',.pyfgcrl/=\\aoeuidhtns\-;qjkxbmwvz'
@hexaflexahexagon
hexaflexahexagon / tempus-completion-finder.sh
Created April 2, 2022 23:07
# Find the map with the fewest completions on tempus in a given tier
#!/bin/bash
# Find the map with the fewest completions on tempus in a given tier
# change these variables if you want to use a different class
# or filter by a different tier
CLASS="soldier" # Options are "soldier" or "demo"
TIER="5"
if [ $CLASS == "soldier" ]; then