Skip to content

Instantly share code, notes, and snippets.

@startergo
startergo / path.md
Created October 14, 2023 20:12
How to display $PATH as one directory per line and change the $PATH variables
  • You can modify path display with any one of the following commands, which substitutes all occurrences of : with new lines \n.

  • sed:

$ sed 's/:/\n/g' <<< "$PATH"
  • tr:
$ tr ':' '\n' &lt;&lt;&lt; "$PATH"
@startergo
startergo / pyenv_macports.md
Last active October 14, 2023 17:36
Install Pyenv with Macports
  • Install Macports.
  • Install python dependencies:
sudo port install pkgconfig openssl zlib xz gdbm tcl tk +quartz sqlite3 sqlite3-tcl
  • Install python:
GDBM_CFLAGS="-I$(dirname $(dirname $(which port)))/include" \
GDBM_LIBS="-L$(dirname $(dirname $(which port)))/lib -lgdbm" \
pyenv install 3.11.5
@startergo
startergo / PkgInstallerLog.md
Created September 23, 2023 20:38
Find the Package Installer Log details on macOS
  • Run the pkg. At the first install screen in the menu bar click File --> Show Files (Command + I).

Another useful thing to do is look at the install log.

Window --> Installer Log (Command + L)

  • To determine where it puts files after the fact (the pkg is still relevant, but you may not have it anymore) use the lsbomcommand. An example:
lsbom -f /var/db/receipts/com.growl.growl.pkg.bom
@startergo
startergo / python_uninstall.md
Last active May 18, 2024 20:26
Completely uninstall official 2.7 Python on macOS

Removing the app does not completely uninstall that version of Python. You will need to remove the framework directories and their symbolic links.

Deleting the frameworks

sudo rm -rf /Library/Frameworks/Python.framework/Versions/[version number] replacing [version number] with 3.10 in your case.

Removing symbolic links

To list the broken symbolic links.

@startergo
startergo / openssl.md
Created September 23, 2023 02:32
Openssl pyenv python install

Outdated SSL is a common issue on multiple platforms:

Here's the general approach...

0. Install OpenSSL

  • Option I: Install system packages of side-by-side OpenSSL 1.x libs (-dev or -devel) packages.

     # FreeBSD
    
@startergo
startergo / ezntfs.md
Last active September 19, 2023 01:44
ezntfs-app
ezntfs list
disk0s4: BOOTCAMP [350.2 GB] -- mounted: yes
sudo ezntfs disk0s4
Volume: BOOTCAMP [350.2 GB]
BOOTCAMP is already writable.
@startergo
startergo / pyenv.md
Last active September 20, 2023 15:05
Python through pyenv
  • As your pyenv command is working but the shims aren't, it most likely means the shell features aren't activated. As of writing, the correct way is to ensure the init command output is evaluated. On macOS, you can add the following to your ~/.bash_profile( ~/.zsh_profile):
eval "$(pyenv init -)"

TL;DR set the env. vars. mentioned in tcl-tk's caveats and this GitHub comment when installing new Pythons via pyenv to get tkinter.

If you need to have tcl-tk first in your PATH run:

  echo 'export PATH="/usr/local/opt/tcl-tk/bin:$PATH"' >> ~/.zshrc
@startergo
startergo / caffeinated.md
Created September 16, 2023 21:17
Prevent idle sleep in a long-running bash script on Mac OS
  • Add this line to the start of the script:
caffeinate -i -w $$ &
  • Caffeinate is a built-in Mac OS utility for creating power management assertions to prevent sleep.
  • The -i flag tells caffeinate to prevent idle sleep.
  • The -w flag tells caffeinate to wait until the specified process finishes.
  • $$ is a shell variable containing the current PID. Together with the -w flag this tells caffeinate to prevent sleep for the duration of the shell script.
  • The final &amp; runs the command in the background so the script can continue running.
@startergo
startergo / adguard_OpenWRT.md
Last active December 18, 2023 01:32
Adguard home on OpenWRT
@startergo
startergo / docker_pihole.md
Created September 11, 2023 17:36
Docker PiHole Image
  • Run:
docker-compose pull

to download the old version (if you don't have it yet)

  • Run:
docker-compose stop pihole