Skip to content

Instantly share code, notes, and snippets.

@cocoabox
cocoabox / mount_afp.sh
Last active February 9, 2018 15:05
mount AFP share with keychain password
#!/bin/sh
#
# e.g. mount_afp.sh 192.168.xx.xx files cocoa
#
SERVER="$1"
SHARE_NAME="$2"
USER_NAME="$3"
MOUNT_DIR="/Volumes/$SHARE_NAME"
if [ -z "$1" -o -z "$2" ]; then
echo "Usage: $0 <SERVER> <SHARE_NAME> [USER]\n"
@faun
faun / smb_fs_automount.sh
Last active July 8, 2020 10:50
Script to mount remote SMB volume using password stored in Mac OS keychain without needing admin or sudo priveliges
#!/usr/bin/env bash
# Fetch the password from the keychain if it exists
PASSWORD_ENTERED=false
ACCOUNT_NAME='login'
SERVICE_NAME='mount_volume'
PASSWORD=$(
security 2> /dev/null \
find-generic-password -w \
-a $ACCOUNT_NAME \
@markusfisch
markusfisch / uuid.sh
Last active December 13, 2023 15:06
Generate a random UUID in bash
#!/usr/bin/env bash
# Generate a pseudo UUID
uuid()
{
local N B C='89ab'
for (( N=0; N < 16; ++N ))
do
B=$(( $RANDOM%256 ))