Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Chris Jones cmsj

🏠
Working from home
Block or report user

Report or block cmsj

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@cmsj
cmsj / code.js
Last active Jul 12, 2018
Google Apps Script: given a regular email (e.g. backup results), archive old copies
View code.js
// Configuration data
// Each config should have the following keys:
// * age_min: maps to 'older_than:' in gmail query terms
// * age_max: maps to 'newer_than:' in gmail query terms
// * query: freeform gmail query terms to match against
//
// The age_min/age_max values don't need to exist, given the freeform query value,
// but age_min forces you to think about how frequent the emails are, and age_max
// forces you to not search for every single email tha matches the query
//
View zz-busybox-initramfs-fix
#!/bin/sh
# This hook is for fixing busybox-initramfs issue while unlocking a luks
# encrypted rootfs. The problem is that the included busybox version
# is stripped down to the point that it breaks cryptroot-unlock script:
# https://bugs.launchpad.net/ubuntu/+source/busybox/+bug/1651818
# This is a non-aggressive fix based on the original busybox-initramfs hook
# until the bug is fixed.
# busybox or busybox-static package must be present for this to work
View syslogreceiver.service
[Unit]
Description=Remote syslog to journald bridge
After=systemd-journald.service
[Service]
Type=simple
User=nobody
Group=nogroup
WorkingDirectory=/
ExecStart=/usr/local/bin/syslogreceiver.py
View syslogreceiver.py
#!/usr/bin/env python3
"""syslogreceiver.py - receive remote syslog events and pass them into
systemd's journal"""
import re
import socketserver
from systemd import journal
HOST, PORT = "0.0.0.0", 514
View switch-power.diff
diff --git a/arch/arm64/boot/dts/nvidia/tegra210-nintendo-switch.dts b/arch/arm64/boot/dts/nvidia/tegra210-nintendo-switch.dts
index 814f414..e9c0a5f 100644
--- a/arch/arm64/boot/dts/nvidia/tegra210-nintendo-switch.dts
+++ b/arch/arm64/boot/dts/nvidia/tegra210-nintendo-switch.dts
@@ -983,6 +983,14 @@
compatible = "gpio-keys";
label = "gpio-keys";
+ power {
+ label = "Power";
View gist:9841f36ec4d925ba42ef787ebec5de6c
diff --git a/usb_loader/switch.conf b/usb_loader/switch.conf
index f4555c3..39e1474 100644
--- a/usb_loader/switch.conf
+++ b/usb_loader/switch.conf
@@ -1,5 +1,3 @@
switch
hid,1024,0x80000000,0x80000000,2G
-../../linux/arch/arm64/boot/Image.gz:load 0x83000000
-../../linux/arch/arm64/boot/dts/nvidia/tegra210-nintendo-switch.dtb:load 0x8d000000
switch.scr.img:load 0x8e000000,jump_direct 0x8e000000
View lol.py
#!/usr/bin/env python
"""
Enforce the usage of Hammerspoon's Lua stack guarding macros
"""
from __future__ import print_function
import sys
from clang.cindex import Config
from clang.cindex import Index
View homegnu.sh
#!/bin/echo Don't execute this script directly, source it into your shell.
# This script will attempt to make your macOS system behave more like GNU for shell scripts
# by diverting as many commands as possible, to the GNU versions, provided by Homebrew
#
# For most Homebrew tools, their presence in /usr/local/bin and that being in your $PATH
# means you can use them as-is, but some tools appear with different names because macOS
# already has such a tool (e.g. find(1)). These tools generally also have a `gnubin` path
# which we can use to make them higher priority than the macOS equivalents.
#
# To use this:
View tangent.lua
hs.console.clearConsole()
local hubMessage = {
["INITIATE_COMMS"] = 0x01,
["PARAMETER_CHANGE"] = 0x02,
["PARAMETER_RESET"] = 0x03,
["PARAMETER_VALUE_REQUEST"] = 0x04,
["MENU_CHANGE"] = 0x05,
["MENU_RESET"] = 0x06,
["MENU_STRING_REQUEST"] = 0x07,
View gist:72c4314ee3e5061811fe96ae9d30fc7a
script = [[
tell application "Google Chrome"
set currentURL to URL of active tab of first window
end tell
return currentURL
]]
hs.applescript(script)
You can’t perform that action at this time.