Skip to content

Instantly share code, notes, and snippets.

View MaffooClock's full-sized avatar

Matthew Clark MaffooClock

View GitHub Profile
@MaffooClock
MaffooClock / trash_conflicted_copy_files.sh
Created October 19, 2023 18:24
Bash script to scan your Dropbox folder for "conflicted copy" files and move them to your Trash folder (MacOS and Linux only).
#!/usr/bin/env bash
# This script will scan your Dropbox folder for "conflicted copy" files and move them to your Trash folder.
# The path to your Dropbox folder will be determined by reading a JSON file that should be present if Dropbox is installed.
##### Make sure we're running on MacOS or Linux (and snag the path to the trash directory while we're at it)
if [[ "$(uname)" == "Darwin" ]]; then
TRASH=$(realpath ~/.Trash)
@MaffooClock
MaffooClock / dropbox_unsync.py
Last active October 20, 2023 12:46
Sync your PlatformIO projects in Dropbox without .pio/build (because the constant syncing during a build can cause IntelliSense to freeze) and .vscode (which can contain machine-specific settings that aren't compatible across machines).
#!/usr/bin/env python3
"""
This script, if run within a PlatformIO project directory, will mark .vscode
and .pio/build directories as "ignored" so that Dropbox will not sync them
(they will be local only).
This works by setting extended file attributes on those directories that the
Dropbox client will see.
@MaffooClock
MaffooClock / i2c-clock-frequency.dts
Created August 23, 2023 17:24
Overlay for Armbian to set I2C bus speed on Renegade (ROC-RK3328-CC)
/**
* Execute `armbian-add-overlay i2c-clock-frequency.dts` to
* automatically compile and add to /boot/armbianEnv.txt
*/
/dts-v1/;
/plugin/;
/ {
compatible = "rockchip,rk3328";
@MaffooClock
MaffooClock / capture-backspace.js
Last active April 13, 2016 19:35
Browsers using Backspace keypress to navigate Back is evil, especially for large forms. On a jQuery-enabled page, this will capture Backspace and discard it unless a form field is in focus.
$(function() {
var tagRegex = /INPUT|SELECT|TEXTAREA/i;
var typeRegex = /DATE|DATETIME|DATETIME-LOCAL|EMAIL|MONTH|NUMBER|RANGE|SEARCH|TEL|TEXT|TIME|URL|WEEK/i;
$(document).on('keydown keypress', function(e) {
if (e.keyCode == 8) // Backspace
{
if ( !tagRegex.test(e.target.tagName) || e.target.tagName.toLowerCase() == 'input' && !typeRegex.test(e.target.type) )

Keybase proof

I hereby claim:

  • I am maffooclock on github.
  • I am maffooclock (https://keybase.io/maffooclock) on keybase.
  • I have a public key whose fingerprint is D1F5 CC6F BCF4 98DA 221A 32B0 20C8 654F 7A08 3A16

To claim this, I am signing this object: