Skip to content

Instantly share code, notes, and snippets.

View rbcmgs's full-sized avatar

Brandon Cummings rbcmgs

View GitHub Profile
@rbcmgs
rbcmgs / aptHoldUnholdShowhold.sh
Created June 29, 2021 18:03
Apt - Hold/un-hold package
# Hold a package
sudo apt-mark hold <package-name>
# Un-hold a package
sudo apt-mark unhold <package-name>
# Show all packages on-hold
sudo apt-mark showhold
@rbcmgs
rbcmgs / debianHotResizePartitionFilesystem.txt
Last active November 21, 2023 18:24
Debian - Hot Resize Partition and Filesystem
As always, make sure you have a backup of your data.
Since we're going to modify the partition table there's a chance it could be corrupted or lost.
Run 'sudo fdisk /dev/sda'.
Use 'p' to list the partitions.
Make note of the start cylinder of /dev/sda1.
Use 'd' to delete the /dev/sda1 partition.
@rbcmgs
rbcmgs / nginxReverseProxySshOverHttp.conf
Last active September 30, 2021 19:42
Nginx - Reverse Proxy SSH Over HTTP
...
stream {
upstream ssh {
server localhost:22;
}
server {
listen 80;
@rbcmgs
rbcmgs / sshConfigFileCheatSheet
Last active October 7, 2021 20:35
SSH - Config File Cheat Sheet
#SSH Config File Cheat Sheet
## Exmaple
Host {{Shortcut Alias}}
HostName {{FQDN, Hostname or IP}}
User {{Username}}
Port {{Port Number}}
IdentityFile ~/.ssh/id_rsa
##Understanding ~/.ssh/config entries
@rbcmgs
rbcmgs / installYarnUbuntu
Created February 6, 2022 09:11
Install Yarn on Ubuntu
##Via apt
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update
sudo apt install yarn
##Via npm
npm install --global yarn
@rbcmgs
rbcmgs / regexForOnionURIs
Created September 13, 2022 20:03
Regex for .onion URIs
((http|https|ftp|sftp)?:\/\/?\S*?\.onion?[^\s]+.*?)
@rbcmgs
rbcmgs / rfindWithMmap.py
Created September 15, 2022 13:01
python rfind with mmap
import mmap
import os
def file_last(file, count):
with open("log.txt") as log:
end = last_pos = os.stat("log.txt").st_size
lines = []
with mmap.mmap(log.fileno(), 0, access=mmap.ACCESS_READ) as mm:
while last_pos != -1:
@rbcmgs
rbcmgs / greatestCommonDivisor.js
Created September 15, 2022 13:05
javascript - greatest common divisor
function comDiviser(numOne, numTwo) {
let maxNum = Math.max(numOne, numTwo);
let maxComDiviser = 0;
for (let i = 1; i <= maxNum; i++) {
maxComDiviser = (numOne%i==0 && numTwo%i==0 && i>maxComDiviser) ? i : maxComDiviser;
}
@rbcmgs
rbcmgs / torrc refresh ip rate
Last active September 15, 2022 13:28
torrc refresh ip rate
MaxCircuitDirtiness NUM
@rbcmgs
rbcmgs / findAllCharCombos.js
Created September 15, 2022 15:06
javascript find all character combinations
function combinations(str) {
var fn = function(active, rest, a) {
if (!active && !rest)
return;
if (!rest) {
a.push(active);
} else {
fn(active + rest[0], rest.slice(1), a);
fn(active, rest.slice(1), a);
}