This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This file was initially generated by Windows Terminal 1.3.2651.0 | |
// Version: Oct 26, 2020 jake541 @ gmail.com | |
// To view the default settings, hold "alt" while clicking on the "Settings" button. | |
// For documentation on these settings, see: https://aka.ms/terminal-documentation | |
{ | |
"$schema": "https://aka.ms/terminal-profiles-schema", | |
"defaultProfile": "{07b52e3e-de2c-5db4-bd2d-ba144ed6c273}", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"log" | |
"os" | |
) | |
func main() { | |
emptyFile, err := os.Create("emptyFile.txt") | |
if err != nil { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# We don't need no steenkin' PS libraries to Slack! | |
$results = Get-DhcpServerv4ScopeStatistics -ComputerName my_dhcp_server_fqdn | where {$_.PercentageInUse -gt 70} | select -property scopeid,percentageinuse | |
ForEach ($subnet in $results) { | |
$payload = @{ | |
text="Warning: DHCP subnet " + $subnet.ScopeId + " is " + [math]::Round($subnet.percentageinuse) +"% full." | |
} | |
$json = $payload | ConvertTo-Json | |
$response = Invoke-RestMethod 'https://hooks.slack.com/services/T0AXXXXX/B01XXXXXXKF/uklXXXXXYYYYsb' -Method Post -Body $json -ContentType 'application/json' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
! Create an Ether-channel | |
interface Port-Channel 1 | |
switchport trunk encapsulation dot1q | |
switchport mode trunk | |
logging event bundle-status | |
logging event trunk-status | |
! Configure and add a port to the Ether-channel | |
int Gi0/13 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function prompt { | |
$currentUser = $env:USERNAME.ToLower() | |
$currentDirectory = get-location | |
$computerName = $env:COMPUTERNAME.ToLower() | |
Write-Host "" | |
Write-Host "[" -NoNewLine | |
Write-Host "${currentDirectory}" -ForegroundColor Yellow -NoNewLine | |
Write-Host "] on " -NoNewLine | |
Write-Host "${computerName} " -ForegroundColor Cyan -NoNewLine |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export BU_DEST=${HOME}/data | |
export BU_DEST_USER=${BU_DEST}/${USER} | |
export LOGFILE=BU_DEST_USER/test.log | |
# If desired, clear the log file with >. | |
echo "" > ${LOGFILE} | |
# Append a log entry with the date/time to our log with >> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1.) There is not try/catch in bash, but you can use the || and && operands as semi-equivalents. | |
# Think of || as "or". | |
# If command1 fails, then run command2: | |
$ command1 || command2 | |
# Think of && as "and". | |
# If command1 succeeds, then run command2: | |
$ command1 && command2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# These | |
$ FOO="abc123" | |
$ echo $FOO | |
abc123 | |
# Get the variable length in chars: ${#FOO} | |
$ echo ${#FOO} | |
6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ python | |
Python 3.7.2 (default, Dec 27 2018, 07:35:06) | |
[Clang 10.0.0 (clang-1000.11.45.5)] on darwin | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> def hello(fruit_basket): | |
... for i in fruit_basket: | |
... print(f"-- {i}") | |
... | |
>>> stuff = ( "apple", "carrot", "hamster") |