sudo cp /etc/pam.d/sudo_local.template /etc/pam.d/sudo_local
Add the line auth sufficient pam_tid.so to the beginning of /etc/pam.d/sudo
Save the file and open a new iTerm2 session
| :%s/\(\u\l\+\)\{2,\}/`&`/g |
| #!/usr/bin/env bash | |
| brew install ffmpeg yt-dlp | |
| yt-dlp -x --audio-format mp3 https://youtu.be/<video-path> |
| -- Mac Shortcuts workflow name | |
| local workflowName = "Home Bluetooth" | |
| hs.logger.defaultLogLevel = "info" | |
| local log = hs.logger.new("DisplayWatcher", "info") | |
| local function runWorkflowIfExternalDisplay() | |
| local hasExternal = false | |
| for _, screen in ipairs(hs.screen.allScreens()) do | |
| if screen:name() ~= "Built-in Retina Display" then |
sudo cp /etc/pam.d/sudo_local.template /etc/pam.d/sudo_local
Add the line auth sufficient pam_tid.so to the beginning of /etc/pam.d/sudo
Save the file and open a new iTerm2 session
| function* takeWithTimerTask( | |
| eventName: AnyEvent['type'], | |
| timeoutEventName: AnyEvent['type'], | |
| timeout: number | |
| ) { | |
| const timerTask = yield* fork( | |
| fireEventAfterDelayTask, | |
| timeoutEventName, | |
| timeout | |
| ) |
| #!/usr/bin/env bash | |
| # 95% CPU utilisation | |
| threshold=0.95 | |
| log_file="/var/log/kill-high-cpu-processes.log" | |
| get_process_info() { | |
| process_id=$1 | |
| ps -p "$process_id" -o pid,ppid,cmd,%cpu,%mem,stat --no-header | awk '{$1=$1};1' |
| xcrun simctl list devices | |
| # Remove old devices stored under ~/Library/Developer/CoreSimulator/Devices (and clogging the disk) | |
| xcrun simctl delete unavailable |
| # in this example we are removing JPG files sitting alongside .nef files | |
| for name in `ls * | sed 's/.\{4\}$//' | sort | uniq -d` | |
| do | |
| # Remove echo below to actually delete files | |
| echo rm $name.jpg | |
| done |
| #!/usr/bin/env sh | |
| sudo findmnt --verify --verbose |
| function readonly(target: any, name: string, descriptor: TypedPropertyDescriptor<() => void>) { | |
| descriptor.writable = false | |
| return descriptor | |
| } | |
| class Example { | |
| a: number | |
| @readonly | |
| b() {} |