Skip to content

Instantly share code, notes, and snippets.

View ngrogg's full-sized avatar

Nicholas Grogg ngrogg

View GitHub Profile
@ngrogg
ngrogg / someUsefulTCPPorts.md
Created July 5, 2024 20:41
Some useful TCP ports and their default services

Some useful TCP ports and their default services

21, FTP, not HIPAA compliant!
22, SSH and SFTP
23, telnet used for checking ports
25, SMTP
53, domain name services (such as BIND); TCP and UDP are the same
80, HTTP
110, Post Office Protocol 3
443, HTTPS

@ngrogg
ngrogg / someUsefulOpenssl.md
Last active July 5, 2024 04:33
Some useful OpenSSL commands

Some useful OpenSSL commands

Generate self-signed SSL and key,
sudo openssl req -x509 -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.cert

/etc/apache2 (deb)
/etc/httpd/conf.d (rpm)

Generate CSR:
openssl req -nodes -newkey rsa:4096 -keyout privkey.pem -out csr.pem

@ngrogg
ngrogg / databaseCommands.md
Created June 30, 2024 23:30
Some useful database commands

Some useful database commands

PostgreSQL/PSQL

To access postgres from database server as postgres user,
su - postgres
psql

To access as specific user to specific database,
psql -d DATABASE -U USER -W

@ngrogg
ngrogg / csfCommands.md
Created June 30, 2024 10:21
Some useful CSF commands

Some useful CSF firewall commands

csf -a IP; Allow IP, use /etc/csf/csf.allow instead
csf -d IP; Block an IP
csf -dr IP; Remove an IP block
csf -e; Enable csf
csf -g IP; Check for blocks on IP
csf -ra; Restart csf
csf -cd; cluster deny ip
csf -cr; cluster unblock ip

@ngrogg
ngrogg / PowerShellCommands.md
Last active June 26, 2024 12:37
Some useful PowerShell commands

Some useful PowerShell commands

Check disk use (Windows), run in PowerShell as admin:
Get-ChildItem c:\ -r -ErrorAction SilentlyContinue –Force |sort -descending -property length | select -first 10 name, DirectoryName, @{Name="MB";Expression={[Math]::round($_.length / 1MB, 2)}}
gci C:\inetpub -r| sort -descending -property length | select -first 10 name, @{Name="GB";Expression={[Math]::round($_.length / 1GB, 2)}}

Get subdirectory size in PowerShell:
$colItems = Get-ChildItem C:\ -ErrorAction SilentlyContinue -Force | Where-Object {$_.PSIsContainer -eq $true} | Sort-Object
foreach ($i in $colItems)
{

@ngrogg
ngrogg / LinuxDiskSpaceInode.md
Last active May 22, 2024 04:13
Some useful Linux disk space and inode commands

Some useful commands for Linux Disk and Inode space checking

Check disk space availability
df -h

Get size of folder
du -sh FOLDER

Get size of files in folder
ls -l --block-size=M

@ngrogg
ngrogg / GCloudCLICommands.md
Created March 27, 2024 12:51
Some Useful Google Cloud CLI Commands

Some Useful Google Cloud CLI Commands

If not done already, configure Google Cloud CLI.
Instructions below assume DEB based distro like Debian or Ubuntu.
Instructions from Google Cloud SDK Docs

Pre-requisities to install Google CLI (skip if already done)
Add GPG key,
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg

@ngrogg
ngrogg / someUsefulKubectlCommands.md
Last active March 27, 2024 09:58
Some useful kubectl commands

Some useful kubectl commands

Authenticate with cluster if using gcloud CLI,
gcloud container clusters get-credentials CLUSTER_NAME --region=COMPUTE_REGION

Run again with different value to set a new default cluster

List pods in cluster,
kubectl get pods