Skip to content

Instantly share code, notes, and snippets.

View mattolenik's full-sized avatar

Matthew Olenik mattolenik

View GitHub Profile
@mattolenik
mattolenik / bash_check_version.sh
Created August 29, 2019 19:29
bash function for ensuring bash version meets a certain minimum
# Ensures the shell meets some minimum version, useful when using bash features introduced after a certain release
check_version() {
local reqMajor="$1"
local reqMinor="$2"
local major minor
IFS=. read -r major minor _ <<< "$BASH_VERSION"
if (( major < reqMajor )) || (( major == reqMajor && minor < reqMinor)); then
echo "Bash version $reqMajor.$reqMinor or greater required, found $major.$minor" >&2
return 1
fi
@mattolenik
mattolenik / git-get-tag-version.sh
Created September 20, 2019 21:39
Retrieve tag/branch/commit
git describe --tags --exact-match 2> /dev/null \
|| git symbolic-ref -q --short HEAD \
|| git rev-parse --short HEAD
@mattolenik
mattolenik / Get path of makefile itself
Created June 23, 2021 17:37
Get path of makefile within make, path of file itself, not working dir
MAKEFILE_PATH := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) # Keep at top of file
@mattolenik
mattolenik / garplythud.txt
Last active July 27, 2022 17:58
Alternatives to fake words like foo and bar
foo
bar
baz
qux
quux
corge
grault
garply
waldo
fred
@mattolenik
mattolenik / fbisadumpsterfire.js
Created February 14, 2023 20:25
Greasemonkey script to hide Facebook ads and BS, tested Feb 2023
// ==UserScript==
// @name Hide "Suggested post" on Facebook
// @include https://www.facebook.com/*
// @grant none
// ==/UserScript==
(function(){
var watcher = function(){
var bs=[...document.querySelectorAll('div[role="main"] div[data-pagelet="FeedUnit_{n}"]')].filter(div => div.innerHTML.includes('Suggested for you')).forEach(el => el.remove())
setTimeout(watcher, 200);
};
@mattolenik
mattolenik / _boot_camera-streamer_libcamera.conf
Created March 5, 2024 20:57
Pi Cam v2 config for libcamera for octoprint
### Options for libcamera based cameras (PiCam, Arducam, ...)
# The port on which the webcam server for the camera should listen on. If you have only
# one camera, leave at 8080. If you have more, change to 8081, 8082, etc. The primary
# camera will be considered the one with 8080.
PORT=8080
WIDTH=1640
HEIGHT=1232
@mattolenik
mattolenik / retraction.gcode
Created March 16, 2024 18:13
Prusa MK3S+ end gcode for filament retraction
M83 ; set to relative
G1 E-6 F900 ; retract 6mm at 15mm/sec