Recent Snippets


Created February 13, 2025
$ sudo -u username psql # Username of the account you created when installing postgres. Typically 'postgres'
$ password # Your sudo account password
$ CREATE DATABASE 'database_name';
Creates a database using PSQL in the shell
Created February 8, 2025
function titleCase(str) {
    return str.charAt(0).toUpperCase() + str.slice(1)
}
Returns a string with the first letter capitilized
Created February 7, 2025
CREATE TABLE users(
    id uuid PRIMARY KEY,
    created_at TIMESTAMP NOT NULL,
    updated_at TIMESTAMP NOT NULL,
    username TEXT NOT NULL UNIQUE
);
Example SQL schema for creating a table to hold user data
Created February 6, 2025
import "net/http"

func main() {
    mux := http.NewServeMux()

    server := http.Server{
	    Handler: mux,
		Addr:    ":" + port,
	}

    http.ListenAndServe(server.Addr, server.Handler)
}
Basic Go HTTP Server
Created February 6, 2025
with open("my_file.txt", "w") as f:  # File automatically closed
    f.write("Hello, Python!")

try:
    with open("nonexistent_file.txt", "r") as f: #Handles potential errors gracefully
        content = f.read()
except FileNotFoundError:
    print("File not found, but the program continues.")
How to open a file in python