Skip to content

Instantly share code, notes, and snippets.

@henrik242
henrik242 / mandelbrot.html
Last active January 8, 2024 09:23
Mandelbrot created by ChatGPT-4
<html>
<head>
<title>Mandelbrot Set</title>
</head>
<body>
<canvas id="canvas" width="1200" height="800"></canvas>
<script>
// Prompt:
// Create a zoomable mandelbrot set with pretty colors in javascript and html,
// without using external libraries. It should recalculate the mandelbrot on every zoom.

Tired of typing your password for sudo? TouchID to the rescue!

brew install gnu-sed
sudo wget -O /usr/local/bin/fix-sudo https://gist.githubusercontent.com/henrik242/de6950822325399fa2e55b311dfe46ce/raw/fix-sudo
sudo chmod 755 /usr/local/bin/fix-sudo
echo 'grep -q pam_tid /etc/pam.d/sudo || echo PLEASE RUN fix-sudo' >> ~/.bash_profile
echo 'grep -q pam_tid /etc/pam.d/sudo || echo PLEASE RUN fix-sudo' >> ~/.zshrc
@henrik242
henrik242 / display-gpx-track.html
Last active August 19, 2023 20:37
Displays a GPX track as a HTML page using Leaflet, leaflet.hotline and GPXParser
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>GPX track</title>
<script src="//polyfill.io/v3/polyfill.min.js?features=document.querySelector%2CArray.prototype.at"></script>
<script src="//cdn.jsdelivr.net/gh/Luuka/GPXParser.js/dist/GPXParser.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.0/leaflet.min.js"></script>
<script src="//cdn.jsdelivr.net/gh/iosphere/Leaflet.hotline/dist/leaflet.hotline.min.js"></script>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.0/leaflet.css" />
@henrik242
henrik242 / airtag-to-gpx-sync.sh
Last active March 12, 2024 07:07
Read AirTag data from the FindMy.app cache and convert to GPX
#!/usr/bin/env bash
#
# Reads AirTag data from the FindMy.app cache and converts it to a daily GPX file
#
# Rsyncs the data to a web accessible folder that can be displayed with e.g.
# https://gist.github.com/henrik242/84ad80dd2170385fe819df1d40224cc4
#
# This should typically be run as a cron job
#
@henrik242
henrik242 / Global macOS hotkeys for Google Meet, Spotify and others using AppleScript and Fastscripts.md
Last active October 17, 2023 08:32
Global macOS hotkeys for Google Meet, Spotify and others using AppleScript and Fastscripts
@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 / 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"
  1. Open Automator.app
  2. Create new Quick Action
  3. Select Run AppleScript
  4. Add this:
set inputVolume to input volume of (get volume settings)
if inputVolume = 0 then
	set inputVolume to 100
	display notification "Volume set to 100" with title "✅ Microphone is on"
  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