Skip to content

Instantly share code, notes, and snippets.

View Roman-Port's full-sized avatar

Roman Port Roman-Port

View GitHub Profile
@Roman-Port
Roman-Port / gist:191385b4b20ee68ada7f7b9f0de5b8ae
Created February 26, 2026 18:53
Tripping Optos with NexGen Generic UDP
# Tripping Optos with NexGen Generic UDP
The following will allow you to use simple UDP commands to trigger optos into NexGen.
First, add a "generic UDP" board to the CPU in the NexGen config window. Assign a port and a network adapter index. Then, create an input opto with the "generic UDP" type. Restart NexGen.
To determine which network address it's listening on, use ``netstat -a -o -n -b`` from an elevated command prompt window. Search for the port you assigned running under Coyote and verify it's the address you want. Increment the network adapters until it's the desired address.
Then, using a UDP client, send ``OPT:<opto index, starting at 1>`` to it. For example, to trip opto 1, send ``OPT:1``. If this doesn't work, try adding a null character to the end (it doesn't seem to clear out buffers).
@Roman-Port
Roman-Port / README.md
Created February 17, 2026 17:01
Reset UniFi Controller Password

This will clear the UniFi admin password and allow you to reset it.

To begin, you'll need to download an old version of MongoDB Compass on the machine running your UniFi controller. 1.26.1 seems to work and can be downloaded for Windows here. Once downloaded, extract the ZIP file and open MongoDBCompass.exe.

Now, make sure you exit out of your UniFi controller. We'll be accessing the database directly and you'll need to make sure it is shut down.

Now, open a command prompt and navigate to your UniFi install folder located at [USER]\Ubiquity UniFi\ on Windows. Navigate into the bin folder. Now, run the following command to start the database in a way we can access it: .\mongodb.exe --dbpath ../data/db/. If you're accessing it from another machine, add --bind_ip [ip] to it.

Open MongoDB Compass and connect to mongodb://localhost. Once logged in, expand ace on the sidebar and op

@Roman-Port
Roman-Port / gist:0f95f3739ee0bd5158ea4cd43c94e8f9
Created December 3, 2023 03:32
FFMPEG Stereo Difference Split and Join
Creates L+R and L-R channels:
ffmpeg -i test.wav -filter_complex "[0:a]channelsplit=channel_layout=stereo[l][r];[r]volume=volume=-1[ri];[l][ri]amix=inputs=2[diff];[0:a]channelsplit=channel_layout=stereo[l][r];[l][r]amix=inputs=2:weights=0.5[add]" -map "[add]" add.wav -map "[diff]" diff.wav
Merges L+R and L-R back into a stereo file, identical to the original input:
ffmpeg -i add.wav -i diff.wav -filter_complex "[1:a]volume=volume=-1[diffi];[0:a][1:a]amix=inputs=2[l];[0:a][diffi]amix=inputs=2[r];[l][r]join=inputs=2:channel_layout=stereo[outpre];[outpre]volume=volume=2[out]" -map "[out]" testout.wav
@Roman-Port
Roman-Port / gist:f0bc984150a75b76031569412d9345f7
Created December 3, 2023 02:55
FFMPEG create stereo difference
ffmpeg -i input.wav -filter_complex "[0:a]channelsplit=channel_layout=stereo[l][r];[r]volume=volume=-1[ri];[l][ri]amix=inputs=2[diff]" -map "[diff]" diff.wav
@Roman-Port
Roman-Port / gist:be1c4097dfcce623bf9a52707a72d812
Created October 31, 2022 05:43
Repairing Windows Powershell Text Mangling When Piping to File
Hi! Quick tip I found out for anyone (or myself) who accidentally piped or concatenated important data to a file with Powershell and found that text was mangled. You might see "’" converted to "ΓÇÖ" or "Mötley Crüe" converted to "M├╢tley Cr├╝e" for example.
To fix, simply run this command in Powershell after editing the input and output filenames:
```
Get-Content [input] | Out-File [output] -Encoding Oem
```
@Roman-Port
Roman-Port / BufferedTreeView.cs
Created August 8, 2022 17:09
Finally, double-buffered, non-flickering WinForms TreeView in Windows 10
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using System.Drawing;
namespace DddProperyEditorGUI.Util
{
/*
* Mostly based off of https://sites.google.com/a/nomad-net.info/dev/articles/double-buffered-tree-and-list-views
* Updated to work with Windows 10 by RomanPort
@Roman-Port
Roman-Port / core.c
Created July 17, 2022 01:53
STM32F746 I2s IQ recorder to SD card
#include "core.h"
#include "main.h"
#include "fatfs.h"
#define RECORDER_STATUS_DISABLED 0 // Recorder is off.
#define RECORDER_STATUS_RECORDING 1 // Recording normally.
#define RECORDER_BUFFER_STATUS_AVAILABLE 0 // Buffer is available for writing
#define RECORDER_BUFFER_STATUS_PENDING 1 // Waiting to write to disk
#include <string.h>
#include <sys/unistd.h>
#include <sys/stat.h>
#include <driver/i2s.h>
#define SAMPLE_RATE 325000
#define BITS_PER_SAMPLE 16
uint8_t buffer[1024];
#include <string.h>
#include <sys/unistd.h>
#include <sys/stat.h>
#include "esp_vfs_fat.h"
#include "sdmmc_cmd.h"
#include "driver/sdmmc_host.h"
#include <driver/i2s.h>
static const char *TAG = "example";
void run_benchmark() {
int target = 2600000 * 5;
int blockSize = sizeof(buffer);
while (blockSize >= 256) {
//Do benchmark
FILE* output = fopen("/sdcard/out.bin", "wb");
int64_t start = esp_timer_get_time();
int remaining = target;
while (remaining > 0) {
remaining -= fwrite(buffer, 1, blockSize > remaining ? remaining : blockSize, output);