Skip to content

Instantly share code, notes, and snippets.

@ariel-co
ariel-co / video_modes.cs
Created September 15, 2026 03:22
list supported video modes
// Source - https://stackoverflow.com/a/744609
// Posted by Deltax76, modified by community. See post 'Timeline' for change history
// Retrieved 2026-09-14, License - CC BY-SA 2.5
// expanded by arielCo - queries all active displays; marks current mode
using System;
using System.Linq;
using System.Runtime.InteropServices;
using System.Windows.Forms;
@ariel-co
ariel-co / acer odk930 hdmi modes.txt
Created September 15, 2026 03:17
acer usb hdmi adapter modes
DEVICE #1
Name: \\.\DISPLAY2
String: Intel(R) Iris(R) Xe Graphics
3840 × 2160 32 bits 30 Hz
3840 × 2160 32 bits 25 Hz
3840 × 2160 32 bits 24 Hz
3840 × 2160 32 bits 29 Hz
3840 × 2160 32 bits 23 Hz
2560 × 1440 32 bits 59 Hz <- CURRENT MODE
2560 × 1440 32 bits 60 Hz
@ariel-co
ariel-co / log base conversion.png
Last active September 29, 2026 09:23
log base conversion
log base conversion.png
@ariel-co
ariel-co / Get-PowerSourceChanges.ps1
Last active July 9, 2026 07:48
powershell: get power source changes
function Get-PowerSourceChanges {
[CmdletBinding()]
param (
[int]$Hours = 6
)
$StartTime = (Get-Date).AddHours(-$Hours)
$prevTime = Get-Date
Get-WinEvent -FilterHashtable @{
LogName = 'System'
@ariel-co
ariel-co / user.css
Created June 11, 2026 12:43
inkscape UI css
/* put this inside ui/ under User config folder (see Preferences > System)
e.g. $env:appdata\inkscape\ui */
/* https://gitlab.com/inkscape/inkscape/-/work_items/3116 */
#InkRuler { font-size: 12px; }
@ariel-co
ariel-co / xml-noattrs-to-json.py
Created May 21, 2026 20:02
xml (no attrs) to dict / json
import json
import xml.etree.ElementTree as ET
def _normalize_xpath(root_tag, xpath: str):
if not xpath.startswith(".//"):
return xpath
rest = xpath[3:]
if rest.startswith(root_tag + "//"):
@ariel-co
ariel-co / mod11.py
Created May 19, 2026 21:55
modulo-11 validation for Vz bank acct and RIF
def chkdigit_mod11(digits: list[int]|str) -> int:
if isinstance(digits, str):
_digits = list(map(int, list(digits)))
elif isinstance(digits, list):
_digits = digits
else:
raise ValueError(f"Wrong input type {type(digits)}")
# 2, 3, 4, 5, 6, 7...
weighted_sum = sum( d * (2 + i%6) for i, d in enumerate(reversed(_digits)) )
print(weighted_sum)
@ariel-co
ariel-co / logging-multiline.py
Created May 15, 2026 03:53
logging formatter for multi-line entries
# UNTESTED
class MultiLineFormatter(logging.Formatter):
def format(self, record):
# Save the original message
original_msg = record.msg
# Get the formatted message (this handles string interpolation)
full_msg = record.getMessage()
result = []
# Split by newline and format each line individually
@ariel-co
ariel-co / Start-TCPListener.ps1
Created December 24, 2025 01:40 — forked from jdgregson/Start-TCPListener.ps1
Simple example of listening on a port and reading from a socket in PowerShell.
$listener = [System.Net.Sockets.TcpListener]9999
$listener.Start()
while ($true) {
$client = $listener.AcceptTcpClient()
$rEndpoint = $client.client.RemoteEndPoint
$data = ""
$stream = $client.GetStream()
$buffer = New-Object System.Byte[] 1024
while ($client.Connected -and $stream.DataAvailable -and
($i = $stream.Read($buffer, 0, $buffer.Length)) -ne 0) {
@ariel-co
ariel-co / gnupg-static-howto.md
Created November 11, 2025 16:45
static GnuPG build

this is for Amazon Linux 2

compiler etc

sudo dnf groupinstall -y "Development Tools"

minimal GnuPG dependencies

sudo dnf install -y libgpg-error-devel libgcrypt-devel libassuan-devel libksba-devel npth-devel