Skip to content

Instantly share code, notes, and snippets.

View m1ggy's full-sized avatar
💫

Miguel Buising m1ggy

💫
View GitHub Profile
@m1ggy
m1ggy / setup.sh
Created June 1, 2025 11:05
Setup postgres on Ubuntu, run `chmod +x setup.sh` to make it executable
#!/bin/bash
# Usage: ./setup_postgres.sh <username> <password> <dbname> <expose_flag>
set -e
USERNAME="$1"
PASSWORD="$2"
DBNAME="$3"
EXPOSE="$4"
//@source link [https://stackoverflow.com/questions/44134212/best-way-to-flatten-js-object-keys-and-values-to-a-single-depth-array]
function flattenObject(ob) {
var toReturn = {};
for (var i in ob) {
if (!ob.hasOwnProperty(i)) continue;
if ((typeof ob[i]) == 'object' && ob[i] !== null) {
var flatObject = flattenObject(ob[i]);
for (var x in flatObject) {