Skip to content

Instantly share code, notes, and snippets.

View DavidMetcalfe's full-sized avatar

David Metcalfe DavidMetcalfe

  • Canada
  • 21:50 (UTC -07:00)
View GitHub Profile
@DavidMetcalfe
DavidMetcalfe / Minecraft hold Rightclick.ahk
Last active August 29, 2021 05:04
Minecraft Right and Mouse button (held down) loops
/* Ctrl+Right Mouse button loops holding down Right Mouse button until either W or S are pressed.
Useful with certain boring Minecraft activities that have a person standing still and holding Right Mouse
for extended periods. Moving forward or backwards (W or S respectively) will stop the loop.
Replacing "RButton" with "LButton" will change Right Mouse held down with Left Mouse.
*/
^RButton::
@DavidMetcalfe
DavidMetcalfe / Google OnHub API URLs.txt
Created January 27, 2017 21:31
List of known Google OnHub API URLs
http://onhub.here/api/v1/status
http://onhub.here/api/v1/diagnostic-report
http://onhub.here/api/v1/welcome-mat
http://onhub.here/api/v1/connected-devices
http://onhub.here/api/v1/get-attestation-information
http://onhub.here/api/v1/get-endorsement-information
@DavidMetcalfe
DavidMetcalfe / .gitignore
Last active April 8, 2017 21:40
Generalized .gitignore file for Python projects with emphasis on ignoring packaging and OS files. Original taken from https://github.com/github/gitignore
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# celery beat schedule file
celerybeat-schedule
@DavidMetcalfe
DavidMetcalfe / git-init-repo-from-dir
Created February 12, 2017 00:03 — forked from nanusdad/git-init-repo-from-dir
GitHub - initialize from existing directory
Create the remote repository, and get the URL such as
git@github.com:/youruser/somename.git or https://github.com/youruser/somename.git
If your local GIT repo is already set up, skips steps 2 and 3
Locally, at the root directory of your source, git init
Locally, add and commit what you want in your initial repo
#The MIT License (MIT)
# Copyright (c) 2012 Jordan Wright <jordan-wright.github.io>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@DavidMetcalfe
DavidMetcalfe / ControlSoundWindows.ahk
Last active April 7, 2017 17:55
Repurpose F11 and F12 keys to control sound in Windows
F11::
; Decremenet sound by 10.
{
SoundSet -10
return
}
F12::
; Increment sound by 10.
{
@DavidMetcalfe
DavidMetcalfe / findOne.js
Last active April 8, 2017 18:43
Find match between string and array, stop after first positive result
/**
* @description determine if an array contains one or more items from another array.
* @param {array} needle the array providing items to check for in the haystack.
* @param {array} haystack the array to search.
* @return {boolean} true|false if haystack contains at least one item from arr.
*/
var findOne = function (needle, haystack) {
return needle.some(function (v) {
return haystack.indexOf(v) >= 0;
});
@DavidMetcalfe
DavidMetcalfe / PennyRound.ahk
Created April 8, 2017 19:30
AutoHotkey function to perform penny rounding
pennyRound(val)
{
;Performs penny rounding on inputted float, and
;returns calculated amount.
sub := SubStr(val, 0, 1)
subMult := round((sub * 0.01), 2)
if (subMult <= 0.02) {
price := round((val - subMult), 2)
@DavidMetcalfe
DavidMetcalfe / FizzBuzz_OneLiner.py
Created May 27, 2017 20:58
FizzBuzz One-liner for Python3
print('\n'.join("Fizz" * ( i % 3 == 0) + "Buzz" * ( i % 5 == 0) or str(i) for i in range(1, 101)))
@DavidMetcalfe
DavidMetcalfe / nvidia-x-server-settings.txt
Last active April 12, 2024 15:31
Documents the PowerMizer CLI for potential cron jobs, etc.
Because PowerMizer settings in NVIDIA X Server Settings doesn't persist across sessions,
attempts to overclock can become a nuisance.
The following documents the three CLI settings to modify the Preferred Mode as desired:
# Auto:
nvidia-settings -a [gpu:0]/GPUPowerMizerMode=2
# Adaptive:
nvidia-settings -a [gpu:0]/GPUPowerMizerMode=0