Skip to content

Instantly share code, notes, and snippets.

View soberich's full-sized avatar

soberich

  • Amsterdam, The Netherlands
View GitHub Profile
@rmcdongit
rmcdongit / macOS_SytemPrefs.md
Last active October 22, 2025 18:09
Apple System Preferences URL Schemes

macOS 10.15 System Preference Panes

Below are a list of System Preference pane URLs and paths that can be accessed with scripting to assist users with enabling macOS security settings without having to walk them through launching System Preferences, finding panes, and scrolling to settings. Not all panes have an accessible anchor and some are OS specific.

To find the Pane ID of a specific pane, open the System Preferences app and select the desired Preference Pane. With the pane selected, open the ScriptEditor.app and run the following script to copy the current Pane ID to your clipboard and display any available anchors:

tell application "System Preferences"
	set CurrentPane to the id of the current pane
	set the clipboard to CurrentPane
@calexandre
calexandre / merge-zsh-history.sh
Last active September 28, 2025 12:23
Merge two zsh history files
#!/bin/bash
# Inspired on https://david-kerwick.github.io/2017-01-04-combining-zsh-history-files/
set -e
history1=$1
history2=$2
merged=$3
echo "Merging history files: $history1 + $history2"
test ! -f $history1 && echo "File $history1 not found" && exit 1
@SergejIsbrecht
SergejIsbrecht / enumset
Last active September 6, 2020 22:18
EnumSet
sergej@sergej-P50:~/Development/IdeaProjects/playground$ /home/sergej/.sdkman/candidates/java/13.0.1.hs-adpt/bin/java -version
openjdk version "13.0.1" 2019-10-15
OpenJDK Runtime Environment AdoptOpenJDK (build 13.0.1+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 13.0.1+9, mixed mode, sharing)
sergej@sergej-P50:~/Development/IdeaProjects/playground$ uname -a
Linux sergej-P50 4.18.0-25-generic #26-Ubuntu SMP Mon Jun 24 09:32:08 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
jol >> java.util.RegularEnumSet, size=1584
jol >> org.eclipse.collections.impl.set.mutable.UnifiedSet, size=976
@devops-school
devops-school / maven-proxy-internet1
Created February 18, 2020 14:04
Working with Internet Proxy for Maven
$ $ mvn archetype:generate -DgroupId=com.benz.software -DartifactId=chat -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false -DproxySet=true -DproxyHost=53.244.194.32 -DproxyPort=3128 -DproxyUsername=<USER> -DproxyPassword=<PASSWOR
$ mvn clean package -DproxySet=true -DproxyHost=53.244.194.32 -DproxyPort=3128 -DproxyUsername=<USER> -DproxyPassword=<PASSWORD>
$ mvn [COMMAND] -Dhttp.proxyHost=[PROXY_SERVER] -Dhttp.proxyPort=[PROXY_PORT] -Dhttp.nonProxyHosts=[PROXY_BYPASS_IP]
$ mvn install -Dhttp.proxyHost=10.10.0.100 -Dhttp.proxyPort=8080 -Dhttp.nonProxyHosts=localhost|127.0.0.1
# You can create alias for convenient uses:
$ alias proxy-mvn=”mvn -Dhttp.proxyHost=SERVER -Dhttp.proxyPort=PORT -Dhttp.nonProxyHosts=BYPASS_PROXY_IPS
@mjameswh
mjameswh / rename_es_index.sh
Last active August 18, 2023 20:59
Demonstration of how to rename an ElasticSearch index using the Index Clone API, introduced in ES 7.4. This is the cUrl based version. See here for details: https://stackoverflow.com/a/59397746/2887657 .
source_index=source_index
target_index=target_index
elastic_search_server=elasticsearch:9200
# Make sure the source index is actually open
curl -X POST "${elastic_search_server}/${source_index}/_open"
# Put the source index in read-only mode
curl -X PUT "${elastic_search_server}/${source_index}/_settings" \
@paulscott
paulscott / git-lfs-candidates
Created December 6, 2019 23:05
A script to find files that aren't under git-lfs, but should be
#!/bin/bash
if [ "$#" != "1" ]; then
echo "$0 requires a size argument. ex: 100k."
exit 1
fi
sizeParam="+${1}"
filesOverSize=$( find . -size ${sizeParam} | grep -v /.git | sed 's/^.\///g' )
@shawnz
shawnz / WarnSchemaValidator.java
Last active October 23, 2025 10:19
Hibernate schema validator that outputs warning messages instead of throwing exceptions. Tested with Hibernate 5.3.9
package org.shawnz;
import org.hibernate.boot.Metadata;
import org.hibernate.boot.model.naming.Identifier;
import org.hibernate.boot.model.relational.Sequence;
import org.hibernate.dialect.Dialect;
import org.hibernate.mapping.Column;
import org.hibernate.mapping.Selectable;
import org.hibernate.mapping.Table;
import org.hibernate.tool.schema.extract.spi.ColumnInformation;
@seachai
seachai / gist:948ed1eeafa32ce03db6685edb879f71
Last active October 21, 2025 02:57
iTerm 2 Natural Text Editing Preset
On iTerm2 - Open Preferences > Profiles > Keys > Key Mappings > Presets > Select Natural Text Editing
- You can move a word backwards using Option ⌥ + ← and a word forwards using Option ⌥ + →
- Move to the start of the line using fn + ← and to the end of the line with fn + →.
- Also you can delete a word backwards using Option ⌥ + ⌫, delete the whole line using Command ⌘ + ⌫.
If the preset doesn't appear, reinstall iTerm2. If you installed it using Homebrew + Cask:
brew cask reinstall iterm2
@ctkjose
ctkjose / readme.md
Last active June 21, 2025 08:03 — forked from WebReflection/jsc
JavaScriptCore for macOS and Linux

JSC

JSC is the JavaScript engine from Apple's JavaScriptCore (WebKit) as a console application that you can use to run script in the terminal.

For more info visit the JSC's webkit wiki page.

Adding a shortcut to JSC

Using jsc is simple, the one issue is that Apple keeps changing the location for jsc. To deal with this issue I just create a symbolic link to the binary:

@algrid
algrid / KeychainSE.swift
Last active June 28, 2025 11:59
Creating a cryptographic key stored in Secure Enclave
static func makeAndStoreKey(name: String,
requiresBiometry: Bool = false) throws -> SecKey {
let flags: SecAccessControlCreateFlags
if #available(iOS 11.3, *) {
flags = requiresBiometry ?
[.privateKeyUsage, .biometryCurrentSet] : .privateKeyUsage
} else {
flags = requiresBiometry ?
[.privateKeyUsage, .touchIDCurrentSet] : .privateKeyUsage