This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Resize the specified image, ignoring the previous aspect ratio | |
sips -z <height> <width> <image> | |
# Resize the largest side of the specified image, preserving the aspect ratio | |
sips -Z <size> <image> | |
# Crop the specified image to the given dimensions (relative to the center of the original image) | |
sips -c <height> <width> <image> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Homebrew | |
# Install casks from local tap | |
export HOMEBREW_NO_INSTALL_FROM_API=1 | |
# Generate cask token | |
"$(brew --repository homebrew/cask)/developer/bin/generate_cask_token" "/full/path/to/new/software.app" | |
# Create the cask file | |
brew create --cask --set-name my-new-cask download-url |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# See https://stackoverflow.com/a/14307477/3260253 | |
git checkout main | |
git pull --strategy=ours . release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# See https://github.com/cihga39871/JobSchedulers.jl/blob/aca52de/src/jobs.jl#L6-L10 | |
function generate_id() | |
time_value = (now().instant.periods.value - 63749462400000) << 16 | |
rand_value = rand(UInt16) | |
time_value + rand_value | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import numpy as np | |
import random | |
# Generate random colors | |
def random_color(): | |
return [random.uniform(0, 1), random.uniform(0, 1), random.uniform(0, 1)] | |
# Generate coordinates for small bubbles around a big bubble with a fixed distance | |
def small_bubbles(x, y, radius, distance, num_bubbles, min_radius, max_radius): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dirs = FileNameJoin[{$HomeDirectory, $BasePacletsDirectory, | |
"Repository", "*"}] // FileNames | |
paclets = Map[StringSplit[FileNameSplit[#][[-1]], "-"][[1]] &, dirs] | |
Map[PacletUninstall, paclets] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\newcommand{\dif}{\ensuremath{\mathop{}\!\mathrm{d}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\newcommand*{\tran}{^{\mkern-1.5mu\mathsf{T}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: compresspdf [input file] [output file] [screen*|ebook|printer|prepress] | |
compresspdf() { | |
gs -sDEVICE=pdfwrite -dNOPAUSE -dQUIET -dBATCH -dPDFSETTINGS=/${3:-"screen"} -dCompatibilityLevel=1.4 -sOutputFile="$2" "$1" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# See https://stackoverflow.com/a/69727920/3260253 | |
git switch main # now you should be up to date with origin/main | |
git merge --strategy=ours hotfix/1.1.1 # bring in commits without their changes! |