Skip to content

Instantly share code, notes, and snippets.

@breun
breun / git-open.md
Last active August 25, 2021 21:29
Open GitHub/GitLab URL for current branch of local Git repository
@breun
breun / docker_remove_untagged
Last active October 21, 2022 11:21
Remove all untagged Docker images
DIGESTS=`docker images | awk '$2 == "<none>" { print $3 }'`
if [ -n "${DIGESTS}" ]; then
docker rmi --force $DIGESTS
fi
@breun
breun / docker_repull.sh
Last active October 21, 2022 11:22
Repulls all your Docker images, updating them to the latest state
# Get output from 'docker images', skip the header line, print '{image_name}:{image_tag}' and feed each image as an argument to 'docker pull'
docker images | tail -n +2 | awk '{ print $1":"$2 }' | xargs -L 1 docker pull
@breun
breun / enable_sudo_touch_id.sh
Last active July 31, 2024 14:01
Enable Touch ID for use with sudo on macOS
# Enable Touch ID for use with sudo on macOS.
# macOS Sonoma introduced /etc/pam.d/sudo_local, which persists through OS updates, unlike methods that modify /etc/pam.d/sudo.
sed "s/^#auth/auth/" /etc/pam.d/sudo_local.template | sudo tee /etc/pam.d/sudo_local
@breun
breun / enable_git_bash_completion_macports.sh
Last active November 26, 2018 10:38
Enable Bash completion for Git on MacPorts
cd /opt/local/etc/bash_completion.d
sudo ln -s /Library/Developer/CommandLineTools/usr/share/git-core/git-completion.bash
@breun
breun / trim_spam_subjects.sql
Created July 29, 2018 22:40
Remove '***Spam*** ' prefix from message subjects in Apple Mail (V5 format)
UPDATE subjects SET subject = substr(subject,12), normalized_subject = substr(normalized_subject,12) WHERE subject LIKE '***Spam*** %';
@breun
breun / install.sh
Last active July 24, 2017 15:22
Add Java Cryptography Extension (JCE) to all Java 8 Development Kit installations on macOS
#!/bin/bash
# This script symlinks the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files
# to all Java 8 Development Kit installations on macOS. The original policy files are backed up as *.backup.
#
# 1. Download: http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html
# 2. Unpack the zip file somewhere, e.g. /Library/Java/JavaCryptographyExtensions8
# 3. Put this script in the directory where you put the unpacked files
# 4. Run 'sudo ./install.sh' to make the cryptography extensions available to all JDK 8 installations
#
package org.apache.jackrabbit.core.query.lucene;
import org.apache.jackrabbit.core.id.NodeId;
import org.apache.jackrabbit.core.security.AccessManager;
import org.apache.jackrabbit.core.session.SessionContext;
import org.apache.jackrabbit.spi.Path;
import org.apache.jackrabbit.spi.commons.query.qom.ColumnImpl;
import org.apache.lucene.search.Query;
import org.junit.Test;
import org.mockito.invocation.InvocationOnMock;
@breun
breun / gist:73e51484366450904947
Last active February 21, 2016 18:50
npm install errors for hoodie-server-account
(...)
npm sill install resolved []
npm verb about to build /Users/breun/Projects/hoodie-server-account/node_modules/lodash
npm info build /Users/breun/Projects/hoodie-server-account/node_modules/lodash
npm info linkStuff lodash@4.5.0
npm sill linkStuff lodash@4.5.0 has /Users/breun/Projects/hoodie-server-account/node_modules as its parent node_modules
npm verb linkBins lodash@4.5.0
npm verb linkMans lodash@4.5.0
npm verb rebuildBundles lodash@4.5.0
npm info install lodash@4.5.0
def randomEmoji() {
def values = 0x1F601..0x1F64F
def randomValue = values[new Random().nextInt(values.size())]
Character.toChars(randomValue)
}