Skip to content

Instantly share code, notes, and snippets.

View tehshane's full-sized avatar

Shane Lawrence tehshane

View GitHub Profile
@tehshane
tehshane / Microsoft Sculpt Mobile Keyboard Remap
Last active March 9, 2024 05:18
AutoHotKey script that remaps the F1-F12 function keys on the Microsoft Sculpt Mobile keyboard to be pressed without having to use the Fn key. Disables some of the Windows 8 shortcuts, but leaves media keys intact.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#InstallKeybdHook
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; OPTIONAL: For those who use Home/End more than PgUp/PgDown, this flips their use with the Fn key.
; If you want the buttons to function as they are, add a semicolon (;) to the beginning of each line below.
Home::PgUp
End::PgDn
PgUp::Home
### Keybase proof
I hereby claim:
* I am tehshane on github.
* I am tehshane (https://keybase.io/tehshane) on keybase.
* I have a public key ASBIl08dZCRG-AkeruDLkSHaMAMv5VEMUYWPptZ9Hi_MpQo
To claim this, I am signing this object:
@tehshane
tehshane / check-password.js
Created April 28, 2018 06:18
Snippet to check a password against the Have I Been Pwned API
const PASSWORD = '';
const crypto = require('crypto')
const shasum = crypto.createHash('sha1')
const http = require('https');
shasum.update(PASSWORD);
const hash = shasum.digest('hex').toUpperCase();
http.get('https://api.pwnedpasswords.com/range/' + hash.substr(0,5), res => {
@tehshane
tehshane / keybase.md
Created December 14, 2018 23:07
Keybase Proof (2hat_shane)

Keybase proof

I hereby claim:

  • I am tehshane on github.
  • I am 2hat_shane (https://keybase.io/2hat_shane) on keybase.
  • I have a public key whose fingerprint is AF78 AA96 E324 067D C831 781A 9F24 5988 B913 FF05

To claim this, I am signing this object:

@tehshane
tehshane / pre-commit
Last active May 29, 2019 23:24 — forked from kuy/pre-commit
git: pre-commit hook script to prevent committing FIXME code
#!/bin/sh
matches=$(git diff --cached | grep -E '\+.*?\/\/\s?(DEBUG|FIXME|debugger\;)')
if [ "$matches" != "" ]
then
echo "Detected possible debug-only code."
echo "Are you sure you want to commit it?"
echo " ${matches}"
exit 1
@tehshane
tehshane / flattenObject.js
Created May 25, 2019 01:21
Flatten an object to a single depth
/*
* @fileoverview Flatten an object to a single layer deep
* @author Muthukrishnan (https://stackoverflow.com/users/1173436/muthukrishnan)
* @url https://stackoverflow.com/a/53739792
*/
function flattenObject (ob) {
const toReturn = {};
for (const i in ob) {
if (!ob.hasOwnProperty(i)) continue;