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 | |
# Recursive Delete - All empty files and directories | |
# Check if a directory is provided | |
if [ -z "$1" ]; then | |
echo "Usage: $0 [directory]" | |
exit 1 | |
fi |
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
# Credit: ingyhere | https://stackoverflow.com/a/22317479/8077665 | |
# Fixes this error during `git clone` | |
# | |
# fetch-pack: unexpected disconnect while reading sideband packet | |
# fatal: early EOF | |
# fatal: fetch-pack: invalid index-pack output | |
# | |
# First, turn off compression: | |
git config --global core.compression 0 | |
# Next, let's do a partial clone to truncate the amount of info coming down: |
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
host=10.10.11.224 && ports=$(sudo nmap -p- --min-rate=1000 -T4 $host -Pn | grep ^[0-9] | cut -d '/' -f 1 | tr '\n' ',' | sed s/,$//) && sudo nmap -p $ports -sV -sC $host -Pn -oN 'nmap_tcp.txt' |
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
// Credit: @bweinman | C++ Templates and the STL | |
// printv() iterates a vector, printing space separated elements | |
template<type T> | |
void printv(vector<T> &v) { | |
if(v.empty()) return; | |
for(T &i : v) cout << i << " "; | |
cout << endl; | |
} |
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
/* Pg. 87 - The C Programming Language (2nd Ed) - Recursive Quicksort */ | |
/* qsort: sort v[left]..v[right into increasing order */ | |
void qsort(int v[], int left, int right) | |
{ | |
int i, last; | |
void swap(int v[], int i, int j); | |
if (left >= right) /* do nothing if array contains */ | |
return; /* fewer than two elements */ |
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
#include <iostream> // cout | |
#include <iomanip> // fixed, setprecision | |
#include <chrono> // time library | |
{ | |
auto startTime = std::chrono::high_resolution_clock::now(); | |
/* work */ | |
auto endTime = std::chrono::high_resolution_clock::now(); |
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
#include "C:\gsl\narrow" // path to GSL include files | |
#include <string> | |
/*** | |
* Center text in a fixed-width field | |
* https://stackoverflow.com/questions/14861018/center-text-in-fixed-width-field-with-stream-manipulators-in-c | |
*/ | |
std::string center(const std::string& text, int width) | |
{ | |
/*** |
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
# Install Github CLI | |
winget install -e --id GitHub.cli | |
# Log into Github | |
gh auth login | |
mkdir c:\_all | |
cd c:\_all | |
gh repo list | ForEach-Object { gh repo clone $_.Split("`t")[0] } |
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 | |
counter=0 | |
while true; do | |
counter=$((counter + 1)) | |
output=$(./MyApp) # Execute the program and store its output | |
last_line=$(echo "$output" | tail -n 1) # Extract the last line of the output | |
echo "$output" # Print the output | |
if [ "$last_line" == "output" ]; then # Change this string to desired match | |
echo "Output found after: $counter" # Shows number of program executions |
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
(gci -include *.cpp,*.h -recurse | select-string .).Count |