In iTerm2, in the menu bar go to Scripts > Manage > New Python Script
Select Basic. Select Long-Running Daemon
Give the script a decent name (I chose auto_dark_mode.py
)
Save and open the script in your editor of choice.
#!/bin/sh | |
echo "# 24-bit (true-color)" | |
# based on: https://gist.github.com/XVilka/8346728 | |
term_cols="$(tput cols || echo 80)" | |
cols=$(echo "2^((l($term_cols)/l(2))-1)" | bc -l 2> /dev/null) | |
rows=$(( cols / 2 )) | |
awk -v cols="$cols" -v rows="$rows" 'BEGIN{ | |
s=" "; | |
m=cols+rows; |
# 9 = \t | |
# 10 = \n | |
# 13 = \r | |
# 32 = (space) | |
# 34 = " | |
# 44 = , | |
# 58 = : | |
# 91 = [ | |
# 92 = \ | |
# 93 = ] |
#!/bin/bash | |
# ===== setting ===== | |
FORMAT=mp4 | |
VIDEO_CODEC=libx264 | |
VIDEO_GPU_CODEC=h264_videotoolbox | |
PROFILE=high | |
LEVEL=4.2 | |
PRESET=veryslow |
#!/usr/bin/python | |
# vim: set ft=python: | |
# see the README at https://gist.github.com/v-fox/43c287426c366679afc4c65eece60cbc | |
# source: https://github.com/mpv-player/mpv/issues/2149 | |
# source: https://github.com/mpv-player/mpv/issues/566 | |
# source: https://github.com/haasn/gentoo-conf/blob/nanodesu/home/nand/.mpv/filters/mvtools.vpy | |
import vapoursynth as vs | |
import functools |
#!/bin/zsh | |
# | |
# Purpose: run specified command with specified arguments and cache result. If cache is fresh enough, don't run command again but return cached output. | |
# Also cache exit status and stderr. | |
# Copyright (c) 2019-2023 András Korn; License: GPLv3 | |
# Use silly long variable names to avoid clashing with whatever the invoked program might use | |
RUNCACHED_MAX_AGE=${RUNCACHED_MAX_AGE:-300} | |
RUNCACHED_IGNORE_ENV=${RUNCACHED_IGNORE_ENV:-0} | |
RUNCACHED_IGNORE_PWD=${RUNCACHED_IGNORE_PWD:-0} |
#!/bin/bash | |
# ==================================================================== | |
# tigerbrew-node-config.command | |
# | |
# Configure an OS X system as a Tigerbrew test node. | |
# Assumes that Developer Tools & Remote Desktop Client are installed. | |
# Only tested on 10.4 and 10.5 so far. | |
# | |
# @EricFromCanada |
#!/bin/bash | |
# | |
# This assumes you are using "Chrome" from the official Google site via the .deb or .rpm | |
# This may or may not work with your distributions "Chromium" or "Chrome" package! | |
# | |
# Run this script then restart Chrome, you will see it is no longer bound to UDP:5353 | |
# | |
mkdir -p /etc/opt/chrome/policies/{managed,recommended} || echo FAIL, ARE YOU ROOT | |
chmod go-w /etc/opt/chrome/policies/managed || echo FAIL, ARE YOU ROOT | |
cat > /etc/opt/chrome/policies/managed/managed_policy.json << 'EOF' |
#!/bin/bash | |
fileA="$1" | |
shift | |
for fileB in "$@"; do | |
( | |
# diff once grep twice with the help of tee and stderr | |
diff $fileA $fileB | \ | |
tee >(grep -cE '^< ' >&2) | \ | |
grep -cE '^> ' >&2 |