Skip to content

Instantly share code, notes, and snippets.

View daurrutia's full-sized avatar

David daurrutia

  • D.C.
View GitHub Profile

Linux Storage Commands

Disk space usage with human-readable format

df -h

Size of specific directory

du -sh /path/to/dir

Basic PostgreSQL Tests

  1. Connect to PostgreSQL and list databases using psql

     # Connect to a cluster
     psql -h <service-name> -U postgres
    
     # Inside psql:
     \l                   # List all databases
    

\c myapp # Connect to 'myapp' database

@daurrutia
daurrutia / openssl-commands.md
Last active June 25, 2025 15:48
OpenSSL Commands
@daurrutia
daurrutia / import-pem.sh
Created February 15, 2023 03:24
Import certificates previously converted from a bundle in PKCS7 format to PEM format into a Java keystore
#!/bin/bash
# author:
# cmcginty https://stackoverflow.com/a/29997111/7742737
# example:
# ./import-pem.sh TrustedCAs.PEM changeit truststore.jks
PEM_FILE=$1
PASSWORD=$2
KEYSTORE=$3
@daurrutia
daurrutia / Install-Git-LFS-on-Fedora-Remix-for-WSL.md
Last active August 13, 2020 19:54
Install Git LFS on Fedora Remix for WSL
@daurrutia
daurrutia / disable-inprivate.ps1
Created December 7, 2018 21:51
Disable Microsoft Edge's InPrivate Browsing
# https://docs.microsoft.com/en-us/windows/client-management/mdm/policy-csp-browser#browser-allowinprivate
# https://github.com/MicrosoftDocs/windows-itpro-docs/blob/master/browsers/edge/includes/allow-inprivate-browsing-include.md
$path = 'HKLM:\SOFTWARE\Policies\Microsoft\MicrosoftEdge\Main'
if (Test-Path $path) {
New-ItemProperty -Path $path -Name AllowInPrivate -PropertyType DWORD -Value 0 -Force
}else{
New-Item -Path $path -Force |
New-ItemProperty -Name AllowInPrivate -PropertyType DWORD -Value 0 -Force
@daurrutia
daurrutia / send-mailmessage.ps1
Created July 6, 2018 12:42
Send an email using PowerShell
##############################################################################
$From = "[email protected]"
$To = "[email protected]"
$Cc = "[email protected]"
#$Attachment = "C:\temp\Some file.txt"
$Subject = "Email Subject"
$Body = "Insert body text here"
$SMTPServer = "smtp.gmail.com"
$SMTPPort = "587"
@daurrutia
daurrutia / disable-incognitomode.ps1
Created June 25, 2018 15:12
Disables Google Chrome Incognito Mode on Microsoft Windows
# http://dev.chromium.org/administrators/policy-list-3#IncognitoModeAvailability
$path = 'HKLM:\SOFTWARE\Policies\Google\Chrome'
if (Test-Path $path) {
New-ItemProperty -Path $path -Name IncognitoModeAvailability -PropertyType DWORD -Value 1 -Force
}else{
New-Item -Path HKLM:\SOFTWARE\Policies\Google\Chrome\ -Force |
New-ItemProperty -Name IncognitoModeAvailability -PropertyType DWORD -Value 1 -Force
}
@daurrutia
daurrutia / Get-WindowsComputerList.ps1
Created February 6, 2018 21:12
Get and write out list of Windows Server computer names in a domain.
## Get list of all AD Computer Objects
#Get-ADComputer -filter * -Properties dnshostname,operatingsystem | sort Name | select Name,DNSHostName,OperatingSystem
## Export list of all AD Computer Objects inlcuding Ipv4Address property
#Get-ADComputer -filter * -Properties dnshostname,operatingsystem,ipv4address | sort Name | select Name,DNSHostName,Ipv4Address,OperatingSystem | out-file C:\Users\david.urrutia\Desktop\computerIpList.txt
## Get list of all Windows Server computers
#Get-ADComputer -filter {operatingsystem -like "*server*"} -Properties dnshostname,operatingsystem | sort Name | select Name,DNSHostName,OperatingSystem
## Get list of all Windows Server computers