Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
set -Eeuo pipefail
echo_and_run() {
echo "> $*"
"$@"
}
setup_sudo() {
# Ask for the administrator password upfront
@trustin
trustin / karabiner.json
Created September 10, 2021 02:45
Trustin's Karabiner-Elements settings
{
"global": {
"check_for_updates_on_startup": true,
"show_in_menu_bar": true,
"show_profile_name_in_menu_bar": false
},
"profiles": [
{
"complex_modifications": {
"parameters": {
@trustin
trustin / git-trigger-build.sh
Last active April 4, 2025 05:46
git-trigger-build: Triggers a CI build by pushing an empty commit
#!/bin/bash -e
# Stash the staged files if any.
NEEDS_UNSTASH=0
if ! git diff --staged --exit-code >/dev/null; then
echo -ne '\033[1;32m'
echo -n 'Stashing the staged files'
echo -e '\033[0m'
git stash
NEEDS_UNSTASH=1
@ikhoon
ikhoon / newmac.sh
Last active September 21, 2022 02:21
#!/bin/bash
# zsh
echo "Installing zsh..."
chsh -s `which zsh`
curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh
# homebrew, pip
echo "Installing homebrew, pip..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
@trustin
trustin / git-checkout-pr.sh
Last active July 22, 2024 13:14
git-checkout-pr.sh - fetches a Git pull request from the remote and creates a local branch for it
#!/usr/bin/env bash
set -Eeuo pipefail
log() {
echo -en '\033[1;32m'
echo -n "$@"
echo -e '\033[0m'
}
choice() {