Skip to content

Instantly share code, notes, and snippets.

View Firenza's full-sized avatar

Chad Oftedahl Firenza

  • Sleep Number
  • Minnesota
View GitHub Profile
@skyzyx
skyzyx / homebrew-gnubin.md
Last active April 13, 2025 03:08
Using GNU command line tools in macOS instead of FreeBSD tools

macOS is a Unix, and not built on Linux.

I think most of us realize that macOS isn't a Linux OS, but what that also means is that instead of shipping with the GNU flavor of command line tools, it ships with the FreeBSD flavor. As such, writing shell scripts which can work across both platforms can sometimes be challenging.

Homebrew

Homebrew can be used to install the GNU versions of tools onto your Mac, but they are all prefixed with "g" by default.

All commands have been installed with the prefix "g". If you need to use these commands with their normal names, you can add a "gnubin" directory to your PATH from your bashrc.

@efrecon
efrecon / run.tpl
Last active April 17, 2025 07:01
`docker inspect` template to regenerate the `docker run` command that created a container
docker run \
--name {{printf "%q" .Name}} \
{{- with .HostConfig}}
{{- if .Privileged}}
--privileged \
{{- end}}
{{- if .AutoRemove}}
--rm \
{{- end}}
{{- if .Runtime}}
@baniol
baniol / adduser.sh
Last active February 2, 2025 18:19
Create a new user in osx, mac, terminal, bash
#!/bin/bash
# =========================
# Add User OS X Interactive Command Line
# =========================
# http://superuser.com/questions/202814/what-is-an-equivalent-of-the-adduser-command-on-mac-os-x
getHiddenUserUid()
{
local __UIDS=$(dscl . -list /Users UniqueID | awk '{print $2}' | sort -ugr)