A "Best of the Best Practices" (BOBP) guide to developing in Python.
- "Build tools for others that you want to be built for you." - Kenneth Reitz
 - "Simplicity is alway better than functionality." - Pieter Hintjens
 
| # https://unix.stackexchange.com/a/124447 | |
| add_to_path() { | |
| case ":${PATH:=$1}:" in *:"$1":*) ;; *) PATH="$1:$PATH" ;; esac; | |
| } | |
| # Example | |
| add_to_path $HOME/bin/julia-1.6.1/bin | 
| @import Darwin; | |
| @import Foundation; | |
| @import IOKit; | |
| /******* | |
| This should change the brightness level of a single external display connected to an M1 MBP or MBA relative to the current setting using DDC/CI. Reportedly does not work on M1 Mini. | |
| Credits to @tao-j and @alin23 | |
| Compile: | 
| @import Darwin; | |
| @import Foundation; | |
| @import IOKit; | |
| // clang -fmodules -o i2cwrite i2cwrite.m && ./i2cwrite | |
| typedef CFTypeRef IOAVServiceRef; | |
| extern IOAVServiceRef IOAVServiceCreate(CFAllocatorRef allocator); | |
| extern IOReturn IOAVServiceCopyEDID(IOAVServiceRef service, CFDataRef* x2); | |
| // outputBufferSize must be less than (1 << 12) (4096 bytes) | 
| @import Darwin; | |
| @import Foundation; | |
| @import IOKit; | |
| // clang -fmodules -o brt brt.m && ./brt | |
| // credit to @zhuowei for discovering the following APIs | |
| typedef CFTypeRef IOAVServiceRef; | |
| extern IOAVServiceRef IOAVServiceCreate(CFAllocatorRef allocator); | |
| extern IOReturn IOAVServiceCopyEDID(IOAVServiceRef service, CFDataRef* x2); | 
| export MACOSX_DEPLOYMENT_TARGET=11.0 | |
| brew install pyenv bzip2 zlib xz [email protected] | |
| ## 3.6.8 | |
| CFLAGS="-I$(brew --prefix openssl)/include -I$(brew --prefix bzip2)/include -I$(brew --prefix readline)/include -I$(xcrun --show-sdk-path)/usr/include" LDFLAGS="-L$(brew --prefix openssl)/lib -L$(brew --prefix readline)/lib -L$(brew --prefix zlib)/lib -L$(brew --prefix bzip2)/lib" pyenv install --patch 3.6.8 < <(curl -sSL https://github.com/python/cpython/commit/8ea6353.patch\?full_index\=1) | |
| ## 3.6.12 | |
| CFLAGS="-I$(brew --prefix openssl)/include -I$(brew --prefix bzip2)/include -I$(brew --prefix readline)/include -I$(xcrun --show-sdk-path)/usr/include" LDFLAGS="-L$(brew --prefix openssl)/lib -L$(brew --prefix readline)/lib -L$(brew --prefix zlib)/lib -L$(brew --prefix bzip2)/lib" pyenv install --patch 3.6.12 < <(curl -sSL https://github.com/python/cpython/commit/8ea6353.patch\?full_index\=1) | |
| ## 3.7.9 |