Skip to content

Instantly share code, notes, and snippets.

View mcwalrus's full-sized avatar

Max Collier mcwalrus

View GitHub Profile
@mcwalrus
mcwalrus / zsh
Last active October 25, 2024 21:55
Minimal zsh theme
# write to ~/.oh-my-zsh/themes/minimal-3.zsh-theme
# then set ~/.zshrc ZSH_THEME='minimal-3'
# Define colors
autoload -U colors && colors
SUCCESS_COLOR=$fg[green]
ERROR_COLOR=$fg[red]
TEXT_COLOR=$fg[black] # Set printout text color to black
RESET_COLOR=$reset_color
@mcwalrus
mcwalrus / main.go
Last active October 17, 2024 09:10
View URL request params
package main
import (
"bufio"
"encoding/json"
"fmt"
"net/url"
"os"
"strings"
)
@mcwalrus
mcwalrus / bash
Last active October 17, 2024 08:56
Unix datetime converters
#!/bin/bash
unix_to_datetime() {
local unix_timestamp="$1"
if [[ "$OSTYPE" == "darwin"* ]]; then
date -u -r "$unix_timestamp" +"%Y-%m-%d %H:%M:%S"
else
date -u -d "@$unix_timestamp" +"%Y-%m-%d %H:%M:%S"
fi
}
@mcwalrus
mcwalrus / bash
Created October 16, 2024 02:03
json unix formatter
#!/bin/bash
if ! command -v jq &> /dev/null; then
echo "Error: jq is not installed. Please install jq to use this script."
exit 1
fi
convert_timestamp() {
if [[ "$OSTYPE" == "darwin"* ]]; then
date -r "$1" -u "+%Y-%m-%d %H:%M:%S UTC"