Skip to content

Instantly share code, notes, and snippets.

Gavin Lloyd gavinhungry

Block or report user

Report or block gavinhungry

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
View index.js
(() => {
document.addEventListener('wheel', e => {
if (e.ctrlKey) {
e.preventDefault();
e.stopPropagation();
}
}, { passive: false });
})();
@gavinhungry
gavinhungry / index.js
Last active May 31, 2019
Auto Basic Auth
View index.js
(() => {
/*
chrome.storage.local.set({
credentials: {
'example.com': {
username: 'foo',
password: '***'
}
}
});
View chrome-theme-manifest.json
{
"manifest_version": 2,
"name": "gavinhungry",
"version": "0.0.0",
"theme": {
"colors": {
"frame": [ 202, 205, 210 ],
"frame_inactive": [ 202, 205, 210 ],
"background_tab": [ 202, 205, 210 ],
@gavinhungry
gavinhungry / 10-alarm-gpio.rules
Created Apr 15, 2018
udev rule to set RPi GPIO group on Arch Linux ARM
View 10-alarm-gpio.rules
SUBSYSTEM=="gpio", ACTION=="add", PROGRAM="/bin/sh -c 'chgrp -R gpio /sys/class/gpio /sys/devices/platform/soc/*.gpio && chmod -R g+rw /sys/class/gpio /sys/devices/platform/soc/*.gpio'"
@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 / 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
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==
(() => {
View devtools.html
<script type='application/javascript' src='devtools.js'></script>
@gavinhungry
gavinhungry / thinkpad-input.sh
Created Jan 7, 2018
ThinkPad input settings
View thinkpad-input.sh
synclient VertScrollDelta=-125 HorizScrollDelta=-125
synclient PalmDetect=1 PalmMinZ=100 PalmMinWidth=7
synclient RightButtonAreaTop=0 RightButtonAreaLeft=0
synclient CoastingFriction=75
TOUCHPAD='SynPS/2 Synaptics TouchPad'
xinput set-prop "$TOUCHPAD" 'Device Accel Profile' 2
xinput set-prop "$TOUCHPAD" 'Device Accel Constant Deceleration' 40
xinput set-prop "$TOUCHPAD" 'Device Accel Velocity Scaling' 10000
@gavinhungry
gavinhungry / 50-battery.rules
Last active May 18, 2019
udev script for handling power management
View 50-battery.rules
SUBSYSTEM=="power_supply", ACTION=="change", RUN+="/etc/scripts/battery.sh"
You can’t perform that action at this time.