Skip to content

Instantly share code, notes, and snippets.

Gavin Lloyd gavinhungry

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am gavinhungry on github.
  • I am gavinhungry (https://keybase.io/gavinhungry) on keybase.
  • I have a public key whose fingerprint is 1450 B358 FCC7 992D 8C61 60F3 52CC 07C8 C7F4 A2F0

To claim this, I am signing this object:

@gavinhungry
gavinhungry / owa-direct.user.js
Created Jan 9, 2015
Rewrite OWA Links to direct URL
View owa-direct.user.js
// ==UserScript==
// @name OWA Direct Links
// @version 0.1.0
// @description Rewrite OWA Links to direct URL
// @author Gavin Lloyd <gavinhungry@gmail.com>
// @match https://webmail.example.tld/*
// @require https://cdn.jsdelivr.net/jquery/2/jquery.min.js
// @grant none
// ==/UserScript==
@gavinhungry
gavinhungry / hand-scroll.user.js
Last active Oct 14, 2017
Drag scrolling with middle-mouse button
View hand-scroll.user.js
// ==UserScript==
// @name Hand Scroll
// @namespace https://gavinhungry.io
// @version 1.5.0
// @description Drag scrolling with mouse movement
// @author Gavin Lloyd <gavinhungry@gmail.com>
// @include *
// @grant none
// ==/UserScript==
@gavinhungry
gavinhungry / org.gnome.ScreenSaver.py
Last active Jan 4, 2018
D-Bus service providing org.gnome.ScreenSaver GetActive method for slimlock
View org.gnome.ScreenSaver.py
#!/usr/bin/env python2
import dbus
import dbus.mainloop.glib
import dbus.service
import gobject
import psutil
class ScreenSaver(dbus.service.Object):
def __init__(self):
View devtools.html
<script type='application/javascript' src='devtools.js'></script>
View service-worker-killer.user.js
// ==UserScript==
// @name Service Worker Killer
// @version 0.3.0
// @description Unregister ServiceWorker(s) before page unload
// @author Gavin Lloyd <gavinhungry@gmail.com>
// @match *
// @grant none
// ==/UserScript==
(() => {
@gavinhungry
gavinhungry / js-date-formats.js
Last active Apr 4, 2018
JavaScript Date formats
View js-date-formats.js
// because I can never remember what all of the Date output formats look like
Object.getOwnPropertyNames(Date.prototype).filter(m => m.startsWith('to')).forEach(m => {
console.log(m.padEnd(20), new Date()[m]());
});
@gavinhungry
gavinhungry / 50-battery.rules
Last active Apr 5, 2018
udev script for handling power management
View 50-battery.rules
SUBSYSTEM=="power_supply", ACTION=="change", RUN+="/etc/scripts/battery.sh"
@gavinhungry
gavinhungry / RegFight.ps1
Last active Apr 5, 2018
PowerShell script to fight Group Policy and keep registry settings as desired
View RegFight.ps1
<##
# PowerShell script to fight Group Policy and keep registry settings as desired
#
# When taking ownership and removing rights from a registry key are not enough
#
# The author of this script feels quite satisfied that it is the worst
# PowerShell script ever written. If you agree, please feel free to provide
# suggestions, improvements, alternatives or looks of disapproval.
#
# Update:
@gavinhungry
gavinhungry / promise-with-state.js
Last active Apr 5, 2018
Promise wrapper with state getters (isPending, isFulfilled, isRejected)
View promise-with-state.js
/*
* Create a new promise the same way as you would with the Promise constructor:
*
* let p = new PromiseWithState((res, rej) => {
* // ...
* });
*
* p.isPending(); // true
* p.isFulfilled(); // false
* p.isRejected(); // false
You can’t perform that action at this time.