Random snippets of all sorts of code, mixed with a selection of help and advice.
Bash/jq hydrate() — transparent JSON-to-bash type converter
13 May 2026 @ 7:32 pm
Inspired by this post: https://stackoverflow.com/a/79914244
I wrote a utility function for scripts that consume JSON from API calls. Looking for a code review focused on correctness, edge cases, and design.
Background
I needed a clean, reusable way to map specific JSON paths to bash variables without scattering jq one-liners throughout the script or storing raw JSON strings in bash variables as a half measure.
The design principle: hydrate() is a transparent converter — JSON in, bash out, jq's native semantics preserved throughout. Nothing JSON-shaped should cross the boundary into bash.
Type conversion rules
JSON type
Bash type
string
string
number
string
boolean true
How do I get values from a DataGrid Column?
13 May 2026 @ 7:23 pm
I am building WPF app and i am refactoring it to use a MVVM pattern, i have an issue with a DataGrid that is fed by an SQL query and has a column with buttons for each register in XAML like so:
<DataGrid Name="NestCards" FontSize="12" ScrollViewer.CanContentScroll="True" MaxHeight="400" ColumnWidth="*">
<DataGrid.Columns>
<DataGridTemplateColumn>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Click="GetDetails">Details</Button>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
It was the case that i was able to just use the sender as a button and handle it like that, no problem
Button pressed = sender as Button;
var nestName = Typ
What is the right way to add a custom shell command to my app in Windows 11?
13 May 2026 @ 7:16 pm
I used to use the following registry file to add a custom right-click menu option for my app for a .jpg file - and it works correctly in Windows 10. But this feature of my app does not work any more in Windows 11. (My installer does the equivalent of this reg file:)
[HKEY_CLASSES_ROOT\SystemFileAssociations\.jpg\Shell\Example\Command]
@="C:\\example.exe \"%1\""
The desired behaviour is that when you right-click a .jpg file in the Windows File Explorer, the custom command Example would appear in the context menu, and selecting it would launch the specified exe and pass the path to my process as an argument.
In Windows 11, the command doesn't appear in the right-click context menu. Note that the legacy menu can be accessed by holding Shift while right-clicking, and my custom command does appear in the legacy menu. But my intent is to have the command appear in the regular right-click co
Can OWASP Dependency-Check be used to check a specific product?
13 May 2026 @ 7:09 pm
We use a periodic OWASP Dependency-Check job to scan our Java applications.
It would be useful to also use OWASP Dependency-Check to scan other tools that are used in our system, but that are not formally dependencies of anything. This includes Java runtime installations and a database system.
Is there any way to make OWASP Dependency-Check scan those specified products?
For example, this is the CPE for the JDK version: cpe:2.3:a:eclipse:temurin:21.0.9
Can I give this as parameter to Dependency-Check to check in some way?
Or can I maybe create a dummy artifact in some way that makes it check that product?
Or maybe call the code in the scanner JAR file dire
How do I reproduce Coding2GO's CSS carousel?
13 May 2026 @ 7:08 pm
I'm tried making a carousel in HTML/CSS by following exactly Coding2GO's video: https://www.youtube.com/watch?v=KD1Yo8a_Qis
In the video, 6 elements are spinning in the carousel.
Here is the code I reproduced: https://codepen.io/editor/Zibola/pen/019e229f-dce5-778e-a69a-ddfd2f41f2a1
I put it here too:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="./style.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pen</title>
</head>
<body>
<div class="carousel">
<div c
MYSQL JavaScript querys [closed]
13 May 2026 @ 7:05 pm
I am making an online program that connects to a sql server, but need to run some queries like login, how do i run it. All sources don’t work for me. I am using MySQL and vs code in js and i am putting variables into the querie
Can you guys help me to find that how can we make a request in python to do a google search?
13 May 2026 @ 7:02 pm
I have been trying it but neither the requests library is working and nor the PyPi library. I have been trying constantly with selenium and I am unable to fetch the results, can somebody help me? is there any lib which I am not considering?
from pathlib import Path
import platform
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.firefox.options import Options as FirefoxOptions
from selenium.webdriver.firefox.service import Service as FirefoxService
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support.expected_conditions import presence_of_all_elements_located
QUERY = input("Enter your Google search query: ")
base_dir = Path(__file__).resolve().parent
driver_path = base_dir.parent / "geckodriver.exe"
def run_with_selenium() -> bool:
options = FirefoxOptions()
options.add_argument("--headless")
service = FirefoxService(execu
New STCubeMX -how to enable LoraWAN
13 May 2026 @ 7:00 pm
LoraWAN need samething more - RNG and SubGHz enabled
I have been tried to enable SubGHz module after migration from 1.3.1 stack to 1.5.0 (STM32WLE5) in CubeMX - something really changed, and now it is not clear how to enable LoraWAN. Anyone solved this puzzle and may please advise?
Thank you.
Qemu crashes my kernel as I try to run IDT interrupt as a test. Core dumped by qemu [closed]
13 May 2026 @ 6:52 pm
I have been making my kernel based on top of my own bootloader, and ive got all the hard things such as memory and other stuff working relatively good. However I have been trying to initialize idt(interrupt descriptor table) for a while for an x86_64 system. When ever I test an interrupt such as dividing by zero or do "asm volatile ("int $3");". just for testing purposes, this is what qemu says:
"
ERROR:system/cpus.c:504:qemu_mutex_lock_iothread_impl: assertion failed: (!qemu_mutex_iothread_locked())
Bail out! ERROR:system/cpus.c:504:qemu_mutex_lock_iothread_impl: assertion failed: (!qemu_mutex_iothread_locked())
Aborted (core dumped)
"
In the following github repo (look below). will have the whole kernel code, it will not have the bootloader because that is irrelevant regarding this matter as it is done well and not causing any issues related to anything. There will also be just the ".iso" file for thos
Using TypeScript, how do I strongly type PostgreSQL query results?
13 May 2026 @ 6:50 pm
I am writing a back end in TypeScript using Express and PostgreSQL. I use the pg npm package to connect to the PostgreSQL database and execute a query.
I want to perform some mapping and conversion on the response I get from the database. First, I want to type the response that I get from the query in order to avoid TypeScript warnings about properties that I know will always be in the response.
This is my code:
import { Pool } from 'pg';
const pool = new Pool({
// Config
});
const result = await pool.query('SELECT * FROM my_table;')
if (result.rows.length > 0 && result.rows[0]) {
console.log(result.rows[0].id);
}
I know that result.rows will be an array of objects, and each object has an id property. However, working with this property results in TypeScript warnings like Unsafe member access .id on an 'any' value.
result