Skip to content

Instantly share code, notes, and snippets.

View oneross's full-sized avatar
🦕
Dinosaur Lightbulbing

oneross

🦕
Dinosaur Lightbulbing
View GitHub Profile
@oneross
oneross / bookmarklet-buttons.js
Last active November 21, 2023 23:44
Bookmarklet - Copy full contents of dom to clipboard
javascript:(function() {
var container = document.createElement('div');
container.innerHTML = '<div style="position:fixed;top:20%;left:50%;transform:translate(-50%, -50%);background-color:white;padding:20px;border-radius:8px;box-shadow:0 4px 8px rgba(0,0,0,0.2);z-index:1000;"><h3>Select Action:</h3><button id="createBtn">Create</button><button id="addBtn">Add</button></div>';
document.body.appendChild(container);
function handleAction(action) {
var userNameElement = document.querySelector('h3.userName');
var userName = userNameElement ? `'${userNameElement.textContent.trim()}'` : null;
var images = Array.from(document.querySelectorAll('img[fullname]'));
var userNameIndex = images.findIndex(img => img.getAttribute('fullname') === userName.replace(/'/g, ""));
@oneross
oneross / waitForKeyElements.js
Created February 24, 2023 23:53
waitForKeyElements - from
/*--- waitForKeyElements(): A utility function, for Greasemonkey scripts,
that detects and handles AJAXed content.
Originally from: https://gist.githubusercontent.com/BrockA/2625891/raw/9c97aa67ff9c5d56be34a55ad6c18a314e5eb548/waitForKeyElements.js
Copied to oneross's gists to make sure it's not updated without my knowledge.
Usage example:
waitForKeyElements (
"div.comments"
, commentCallbackFunction
When I was younger, Time was punctuated by rhythmic recurrences; ice-cream when the raspberries were ripe, picking blueberries, and that one week when the the scent of honeysuckle was overpowering. The Navy taught me a different sense of Time...
### Silence:
I camped a lot throughout high school... I was lucky enough to meet Aaron and Pat, and our shared love of things romantic and natural made us natural companions. Countless camping trips, but most prized were the three day or longer trips... On the standard overnight trip, I woke to an alarm clock, either early or late, met friends, drove to the park, and hit the trail. The next morning was a little magical, waking when it was the right time to wake, warming the bones beside the fire, but around noon so called real-time kicked in, driving us to break camp and make passage back to the cars and the "real-world". Longer trips provided the precious padding to allow the blossoming of the_middle_day... a day in which sun, shadow, hunger, and whimsy were the
@oneross
oneross / ships_bell.py
Created January 26, 2021 15:15
Ships Bell
#!/usr/bin/env python3
"""
A little app that plays ship's bell sounds every 30 minutes.
"""
# Modified from the excellent https://github.com/ralfholly/ships-bell
# - run on python 2.7 on a mac I can't easily update from 2.7
# - renamed mp3 files (lines ~83,86) for some unknown reason
# - used mac's built-in afplay
@oneross
oneross / Notes
Created April 24, 2020 03:00
Virtualenv for Black in pre-commit hooks
From: https://github.com/NREL/ditto/issues/147
We solved this in a pretty ugly way.
Firstly
conda install virtualenv
conda install pre_commit -c conda-forge
As per this issue here: pre-commit/pre-commit#701
This uses a version of virtualenv that's compatible with conda.
@oneross
oneross / test.gcode
Created April 16, 2020 01:53
test gist gcode
This file has been truncated, but you can view the full file.
;FLAVOR:Marlin
;TIME:4785
;Filament used: 2.1813m
;Layer height: 0.16
;MINX:88.451
;MINY:88.855
;MINZ:0.12
;MAXX:146.55
;MAXY:146.928
;MAXZ:19.96
@oneross
oneross / word_finder.py
Created April 15, 2020 23:48
Word Finder
#!/usr/bin/env python3
# Function to print words which can be created using a given set of characters
# Inspired by https://www.geeksforgeeks.org/possible-words-using-given-characters-python/
# Improved for use in an online puzzle by me!
# CHANGE 2020-0415: Added click for argument handling, added comments.
import click
def possible_words(lwords, charSet):
@oneross
oneross / raspi_crontab.txt
Created April 10, 2020 17:15
Crontab for Raspberry Pi running Octopi, just to keep a tab on things
# date, uptime, CPU temp, voltage related events from kernal log, on the hour every hour
1 * * * * date >> vitals.log && uptime >> vitals.log && /opt/vc/bin/vcgencmd measure_temp >> vitals.log && (journalctl -k --since=-1h | grep -i voltage) >> vitals.log && echo " " >> vitals.log
ross@LaForge ~ % defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true
ross@LaForge ~ % defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
ross@LaForge ~ % defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
ross@LaForge ~ % defaults write com.apple.systempreferences NSQuitAlwaysKeepsWindows -bool false
ross@LaForge ~ % sudo pmset -a standbydelay 86400
Password:
ross@LaForge ~ % defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
ross@LaForge ~ % ls
Applications Downloads Music