Skip to content

Instantly share code, notes, and snippets.

View c24w's full-sized avatar
😃

Chris Watson c24w

😃
View GitHub Profile
@c24w
c24w / game.ps1
Created April 24, 2022 16:48
Enforce Xbox controller before launching Steam game
While (-Not (Get-PnpDevice -PresentOnly | Where-Object { $_.Class -eq 'XboxComposite' })) {
echo 'Plug in the controller first...'
pause
}
Start-Process 'steam://rungameid/275850'
@c24w
c24w / .share.js.md
Last active May 13, 2022 19:02
Share Page With Highlighted Text
@c24w
c24w / disable-leds.service
Created April 30, 2018 13:37
Disable Raspberry Pi LEDs
#-rwxr-xr-x 1 root root /etc/systemd/system/disable-leds.service
[Unit]
Description=Disable LEDs
[Service]
ExecStart=/usr/bin/lan951x-led-ctl --fdx=0 --lnk=0 --spd=0
[Install]
WantedBy=multi-user.target
#!/bin/bash
# MOUNT PARTITION TO /tmp/usb/
# write zeroes to empty space
dd if=/dev/zero of=/tmp/usb/tmpzero.txt
rm /tmp/usb/tmpzero.txt
# clone whole disk (including free space)
dd if=/dev/sdb conv=sparse | gzip > ~/Documents/Raspberry-Pi-Arch-$(date -Iseconds).img.gz
(function () {
const daysSinceEpoch = Math.floor(Date.now()/1000/60/60/24);
const magicNumber = 2578;
const xwordNum = daysSinceEpoch - magicNumber;
window.location = `https://www.theguardian.com/crosswords/quick/${xwordNum}`;
})();

Keybase ID

// This totally needs refactoring...
// Also, solarized colours are wrong (brackets red, commas grey, keys green, values blue)
(function (w) {
// http://stackoverflow.com/a/7220510/706561
function syntaxHighlight(json) {
json = json.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, function (match) {
var cls = 'number';
if (/^"/.test(match)) {

c-sharp-string-format.js

inject-script.js