Skip to content

Instantly share code, notes, and snippets.

View esafak's full-sized avatar

Emre Şafak esafak

  • Archipelago AI
  • Silicon Valley
  • 07:28 (UTC -08:00)
View GitHub Profile
@esafak
esafak / git_left_prompt.nu
Last active November 17, 2025 20:46
A nushell `create_left_prompt` to print the git branch
def create_left_prompt [] {
# Create a relative path segment
let relative_path = if ($env.PWD | str starts-with $env.HOME) {
$env.PWD | path relative-to $env.HOME
} else {
$env.PWD
}
let path_segment = if (is-admin) {
$"(ansi red_bold)($relative_path)"
@esafak
esafak / macport_hash.sh
Created June 1, 2024 03:52
Generate hashes for macports from URL
#!/usr/bin/env bash
# Check if a URL is provided
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <url>"
exit 1
fi
# Get the URL from the command-line argument
url="$1"