Skip to content

Instantly share code, notes, and snippets.

View sorenfalch's full-sized avatar

Søren Falch sorenfalch

  • Nine A/S
  • Copenhagen
View GitHub Profile
@mharsch
mharsch / gist:e942fc0f0092f69ea5904a727542340f
Last active August 31, 2024 09:46
Configure systemd watchdog on raspberry pi to reboot if it can't ping a certain host

Most online instructions for Linux watchdog refer to the 'watchdog' package which is best described here

The watchdog configuration described here uses systemd, and the two methods are mutually exclusive, so if you've previously setup the above watchdog, you must first uninstall it.

sudo apt remove watchdog

Our goal is to add a systemd service that continuously pings a known host (or IP address)

@Blackshome
Blackshome / bathroom-humidity-exhaust-fan.yaml
Last active April 8, 2025 22:49
bathroom-humidity-exhaust-fan.yaml
blueprint:
name: Bathroom Humidity Exhaust Fan
description: >
# 🚿 Bathroom Humidity Exhaust Fan
**Version: 2.6**
Step into the future of freshness - customize it your way and experience the convenience of automated humidity control! 🌿🚿
@sbglasius
sbglasius / convertGrails2UnitTests
Last active March 4, 2022 13:19
Will take the tedious work out of converting unit tests from Grails 2 style tests to Grails 3 or 4 style tests
#!/usr/bin/env groovy
import java.nio.file.Files
import groovy.cli.picocli.CliBuilder
import groovy.cli.picocli.OptionAccessor
def cli = new CliBuilder(usage: "./${this.class.getSimpleName()}.groovy <directory>")
cli.with {
header = "'directory' is the source directory update unittests. If not given, the process stops"
}
@kdzwinel
kdzwinel / main.js
Last active January 16, 2025 20:26
List all undefined CSS classes
/*
This script attempts to identify all CSS classes mentioned in HTML but not defined in the stylesheets.
In order to use it, just run it in the DevTools console (or add it to DevTools Snippets and run it from there).
Note that this script requires browser to support `fetch` and some ES6 features (fat arrow, Promises, Array.from, Set). You can transpile it to ES5 here: https://babeljs.io/repl/ .
Known limitations:
- it won't be able to take into account some external stylesheets (if CORS isn't set up)
- it will produce false negatives for classes that are mentioned in the comments.
@chrismccoy
chrismccoy / gitcheats.txt
Last active February 27, 2025 15:51
git cheats
# alias to edit commit messages without using rebase interactive
# example: git reword commithash message
reword = "!f() {\n GIT_SEQUENCE_EDITOR=\"sed -i 1s/^pick/reword/\" GIT_EDITOR=\"printf \\\"%s\\n\\\" \\\"$2\\\" >\" git rebase -i \"$1^\";\n git push -f;\n}; f"
# aliases to change a git repo from private to public, and public to private using gh-cli
alias gitpublic="gh repo edit --accept-visibility-change-consequences --visibility public"
alias gitprivate="gh repo edit --accept-visibility-change-consequences --visibility private"
# delete all your repos using gh-cli (please do not run this unless you want to delete all your repos)
gh repo list --limit 300 --json url -q '.[].url' | xargs -n1 gh repo delete --yes