Skip to content

Instantly share code, notes, and snippets.

@henrik242
henrik242 / gpcats-to-gpx.sh
Last active June 12, 2020 06:28
GPCats to GPX
#!/usr/bin/env bash
collar=myCollarId # replace this!
days=1
charging=no
if [[ $1 = "gsm" ]]; then
script="db_output_gsm.php"
else
script="db_output.php"
@henrik242
henrik242 / Solr backup and restore.md
Last active September 3, 2020 08:44
Solr backup and restore (stored values only)

Backup all stored values from solr as json batches

@henrik242
henrik242 / solrcloud-backup-and-restore.sh
Last active August 14, 2021 15:37
SolrCloud backup/restore without shared disk
#!/usr/bin/env bash
# https://lucene.apache.org/solr/guide/7_5/making-and-restoring-backups.html explains that
# SolrCloud Backup/Restore requires a shared file system mounted at the same path on all nodes.
#
# This script uses the old Solr Backup/Restore procedure, which is useful if you don't have
# access to a shared disk.
#
# Requires that the target collection is already set up, with identical number of shards/replicas.
@henrik242
henrik242 / DisableCertificateValidation.java
Created December 22, 2011 12:37
Disable validation of SSL certificates in Java
public static void disableCertificateValidation() {
// Create a trust manager that does not validate certificate chains
TrustManager[] trustAllCerts = new TrustManager[] {
new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[0];
}
public void checkClientTrusted(X509Certificate[] certs, String authType) {}
public void checkServerTrusted(X509Certificate[] certs, String authType) {}
}};
  1. Install software
brew install yabai
brew install displayplacer
  1. Create hotkey
    • Use Automator --> Quick Action --> Library --> Utilities --> Run Shell Script
    • Set Workflow recieves: no input and Shell: /bin/bash
    • Add script and save
  • Assign shortcut in System preferences --> Keyboard --> Shortcuts -> Services -> General

Installation

  1. Install Shpotify: brew install shpotify
  2. Unzip spotify-workflows.zip into $HOME/Library/Services/
  3. Go to System Preferences -> Keyboard -> Shortcuts -> Services -> General
  4. Set hotkeys for each of your actions (I use control-cmd-option plus arrow keys or P)

You're done!

Manual installation

@henrik242
henrik242 / p4merge
Last active January 5, 2023 22:23
Helper script for p4merge and Git on MacOSX
#!/bin/bash
for arg; do [[ $arg = /* ]] || arg=$PWD/$arg; absargs+=("$arg"); done;
/Applications/P4Merge.app/Contents/Resources/launchp4merge "${absargs[@]}"
#!/bin/bash
if [ $# -lt 3 ]; then
echo "Usage: maven-deploy-file groupId artifactId version [packaging] [repository]"
exit 1
fi
GROUP=$1
ARTIFACT=$2
VERSION=$3
@henrik242
henrik242 / run-script-on-startup.command
Last active March 26, 2023 02:06
Run shell command in background upon macOS login, using tmux
#!/usr/bin/env bash
#
# Make this file executable with `chmod +x run-script-in-background.command`, and add it to
# System Preferences --> Users and Groups --> Startup Items. It needs to have the `.command` suffix.
#
tmux new-session -d -s ostepop \; send -t ostepop.0 "echo Let\'s do this\!; echo More stuff." ENTER