Skip to content

Instantly share code, notes, and snippets.

View ntrogers's full-sized avatar

ntrogers ntrogers

View GitHub Profile
@ntrogers
ntrogers / googlesheets.txt
Created September 14, 2018 18:14
[Google Sheets] Useful Google Sheets formulas
Conditional Formatting:
Highlight duplicates in row:
=countif(A:A,A1)>1
Add colons to MAC address:
=CONCATENATE(MID(F2,1,2),":",MID(F2,3,2),":",MID(F2,5,2),":",MID(F2,7,2),":",MID(F2,9,2),":",MID(F2,11,2))
@ntrogers
ntrogers / terminal_keyboard_shortcuts.txt
Last active January 4, 2018 18:52
[Terminal Keyboard Shortcuts] #shortcuts
Option/Alt + Left or Right
This shortcut allows you to move the cursor between separate words in a command line. Use Option and the left arrow to move back and use Option with the right arrow to move forward down the line.
Control + W
Using this keyboard combination will delete the word immediately before, or to the left of, the cursor.
Escape + T
This will swap the two words that appear immediately before the cursor. So, if "this is" sits before the cursor, using Escape and T will change that to "is this."
Control + R
@ntrogers
ntrogers / macOS_expand_pkg.sh
Created October 25, 2017 16:39
[macOS - Expand pkg file]
pkgutil --expand mypackage.pkg path/to/expand
@ntrogers
ntrogers / labeledLoops.swift
Last active October 15, 2017 16:47
[Swift Notes] Collection of notes while learning Swift #Swift
// This code block makes use of labeled statements, labeling the two loops as rowLoop and the columnLoop, respectively. When the row equals the column inside the inner columnLoop, the outer rowLoop will continue. You can use labeled statements like these with break to break out of a certain loop. Normally, break and continue work on the innermost loop, so you need to use labeled statements if you want to manipulate an outer loop.
var sum = 0
rowLoop: for row in 0..<8 {
columnLoop: for column in 0..<8 {
if row == column {
continue rowLoop
}
sum += row * column
@ntrogers
ntrogers / packages_shell_parameters.sh
Last active September 21, 2017 21:05
[Packages Notes]
$0 = "Script path"
$1 = "Package path"
$2 = "Default location"
$3 = "Target volume"
# Useful info:
# https://derflounder.wordpress.com/2013/11/03/re-packaging-installer-packages-with-packages/
@ntrogers
ntrogers / ARD.sh
Last active March 27, 2020 20:36
[macOS - Useful Commands] #macOS
# kickstart ARD
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -allowAccessFor -allUsers -privs -all
@ntrogers
ntrogers / cmd_ping_IP_range.cmd
Last active October 15, 2017 19:00
[Windows - Command Line Scripts] #Windows #cmd #batch
# Ping an IP range in Windows
FOR /L %i in (1,1,255) do @ping -n 1 192.168.1.%i | find "Reply"
@ntrogers
ntrogers / xenserver_commands.sh
Last active November 12, 2018 21:15
[Xenserver commandes] #Xen
# List all VMs with their UUIDs
xe vm-list | awk '{if ( $0 ~ /uuid/) {uuid=$5} if ($0 ~ /name-label/) {$1=$2=$3="";vmname=$0; printf "%s - %s\n", vmname, uuid}}'
# List VMs and VDIs
xe vdi-list
@ntrogers
ntrogers / _prune_all_clients.sh
Last active September 28, 2017 00:03
[Bacula] #Bacula #nix
clients=`mysql -e'select Name from Client ORDER BY Name ASC;' bacula | tail -n+2`
for client in `echo $clients`
do
  echo "prune files client=${client} yes" | bconsole
done
@ntrogers
ntrogers / tcpdump_find_IP_of_MAC.sh
Last active September 11, 2017 22:02
[tcpdump commands]
tcpdump ether host aa:bb:cc:11:22:33