Skip to content

Instantly share code, notes, and snippets.

@leeky
leeky / crontab
Last active February 1, 2019 13:27
Raspberry Pi - HDMI Control + Display Refresh
# Install by running `crontab -e` as pi user NOT root
44 09 * * 1-5 /usr/bin/tvservice -o
45 09 * * 1-5 /usr/local/bin/tv-on.sh
00 13 * * 1-5 /usr/local/bin/refresh.sh
00 14 * * 1-5 /usr/local/bin/refresh.sh
05 18 * * 1-5 /usr/bin/tvservice -o
query ($endCursor: String) {
repository(name: "judiciary-middleware", owner: "dxw") {
pullRequests(
states: MERGED
first: 25
after: $endCursor
orderBy: { field: CREATED_AT, direction: DESC }
) {
totalCount
pageInfo {
@leeky
leeky / gist:8a60c9601484bb8cad812cfdb88d13af
Created January 27, 2022 20:17
Nightbot !day command
!commands add !day Oh wow! It's $(time Europe/London "dddd") already? I never did get the hang of $(time Europe/London "dddd")s.
@leeky
leeky / date_error_handling.rb
Created September 23, 2024 09:06
Invalid date handling
module DateErrorHandling
extend ActiveSupport::Concern
INVALID_DATE = Date.new(9999, 1, 1).freeze
# This method can be used to safely parse a date input, otherwise a parse error
# can cause a crash, rather than simply an error message. It should be used in
# collaboration with model validation, and to do that you can use the `on_error`
# param to specify what should be returned on error. If your field is required
# (i.e., allow_blank: false) you can call this with `on_error: nil` and validation