Skip to content

Instantly share code, notes, and snippets.

View f-steff's full-sized avatar

Flemming Steffensen f-steff

View GitHub Profile
@f-steff
f-steff / README.md
Last active September 16, 2025 08:54
Renesas CC-RX compiler 3.07+ hack to implement weak functions

Renesas CC-RX compiler 3.07 hack to implement weak functions

Typical weak function implementations

Normally weak functions are implemented using either function attributes or pragmas, like this

Function declaration attributes

uint16_t __attribute__((weak)) getValue(void){ ... };
@f-steff
f-steff / .gitattributes
Created September 10, 2025 19:57
batch/bash polyglot file - useful to have one script file to execute that will work in both a batch and a bash environment.
# All .bat batch files must be saved using DOS/Windows default crlf fline endings.
*.bat text eol=crlf
# Force LF for this one Batch/Bash polyglot
polyglot.bat text eol=lf
# NOTE: If the file already exists in the repository, apply the rule and fix the working tree:
#git add --renormalize polyglot.bat
#git commit -m "Normalize line endings for polyglot.bat to LF"
@f-steff
f-steff / README.md
Last active January 4, 2025 01:09
Userscript for Reddit bug workaround to allow posting on the r/userscript subreddit

Reddit bug workaround to allow posting on the r/userscript subreddit

This userscript addresses a persistent issue with the new Reddit interface that specifically affects the r/userscripts subreddit. The problem prevents users from accessing the post editor or submitting posts in browser-based versions of Reddit. Instead, users encounter Reddit's "Page not found" error page, even though the URL for the post editor appears to be correct.

The issue has been observed across multiple platforms and browsers, including MacBook, PC, and mobile devices, and persists regardless of the network used (e.g., home Wi-Fi or mobile data). Interestingly, other subreddits are unaffected, and posting via the Reddit mobile app works without issues. It was eventually discovered that switching to the old Reddit interface resolves this problem.

Script Functionality

This userscript modifies the "Create Post" button on the r/userscripts subreddit to redirect users to the old Reddit interface for creating posts.

@f-steff
f-steff / README.md
Last active November 14, 2025 04:21
Userscript to update Youtube's Save to Playlist with a hotkey, sorting and filtering of available playlists.

YouTube “Save to Playlist” Enhancer

This userscript adds a convenient hotkey p to YouTube, which opens the Save to Playlist dialog on the currently playing video. It also sorts and filters your playlists in a more useful way. Just the way it should have been fron the start.

Features

  1. Hotkey: p
  • Press p (without Ctrl, Alt, or Meta) on any YouTube watch page to open the Save to Playlist dialog.
  1. Sorting
param (
[string]$BinaryFile,
[string]$SearchString,
$Offset = 0,
$ExtractInt = $null,
$CalcCRC = $null,
$WriteCRC_SE = $null,
$WriteCRC_BE = $null,
$MaxCount = $null,
[switch]$Help = $false,
@f-steff
f-steff / FindHexStringExtract.ps1
Last active August 21, 2024 11:52
Powershell script to search for a string inside an intel hex (iHex) formatted file, returning the address (with optional offset) to all found occurrences. Optionally return a 16 bit integer from an offset from the found address. Finally count of how many times the string was found.
param (
[string]$HexFile,
[string]$SearchString,
$Offset = 0,
$ExtractInt = $null,
$MaxCount = $null,
[switch]$Help
)
# To disable these debug outputs, comment the lines below.
@f-steff
f-steff / FindIHexString.ps1
Last active August 16, 2024 00:29
Powershell script to search for a string inside an intel hex (iHex) formatted file, returning the address (with optional offset) to all found occurrences, and a count of how many times the string was found.
param (
[string]$HexFile, # Path to the HEX file
[string]$SearchString, # The string to search for
$Offset = 0, # Optional address offset (default is 0)
[switch]$Help # Optional help switch
)
# Display help and exit if -help is provided
if ($Help) {
Write-Host "For lack of a better tool, FindIHexString is a quickly hacked together script that searches through"
@f-steff
f-steff / README.md
Created May 24, 2024 10:01
Forward a serial port from Linux to Windows

Forward a serial port from Linux to Windows.

Prerequisites:

  • com0com and com2tcp must be installed on the Windows machine (https://sourceforge.net/projects/com0com/)
  • socat must be installed on the linux box.
  • Optional, to log the communication (on windows) install hub4com (part of the com0com project).

Steps (tested on RPi):

@f-steff
f-steff / README.md
Last active May 7, 2024 13:01
Renesas RX MCU code flash programming - the example Renesas didn't provide.

Test project to try the four known modes of Code Flash self Programming of the RX family.

This code is tested on the RX651 Test board, with the R5F565NEDDFP MCU,

Compiled using CC-RX v3.06.00, and utilizing r_bsp 7.42 and r_flash_rx v5.11

It is expected that this code can be used on at least other RX MCU's from Renesas.

Not all of the tested features are expected to work on all of the various RX MCU's.

@f-steff
f-steff / GoogleSheetsEnableScandinavianKeyboardOnMac.user.js
Last active June 4, 2025 07:08
Userscript for Google Sheet to enable missing keys in Scandinavian Keyboard mapping on Mac
// ==UserScript==
// @name Google Sheets Enable Scandinavian Keyboard On Mac
// @namespace https://gist.github.com/f-steff
// @version 1.3
// @description Fix shift+option+number keys in Google Sheets on Mac while using a Scandinavian keyboard layout, by interception of shift+option+number keys, and replace them with the correct char pasted in. Flaws: Does not enter edit mode when inserting into inactivated sheet cells.
// @author Flemming Steffensen
// @match http://docs.google.com/spreadsheets/*
// @match https://docs.google.com/spreadsheets/*
// @include http://docs.google.com/spreadsheets/*
// @include https://docs.google.com/spreadsheets/*