Skip to content

Instantly share code, notes, and snippets.

View danieloneill's full-sized avatar

Daniel O'Neill danieloneill

View GitHub Profile
@danieloneill
danieloneill / genimage.sh
Created May 7, 2024 11:55
Bash script to generate and display images from a Stable Diffusion server
#!/bin/bash
# It's expected that you'll have the following commands/programs in your $PATH:
# - base64
# - basename
# - cat
# - cp
# - echo
# - mktemp
# - printf
@danieloneill
danieloneill / showpng.sh
Created April 16, 2024 11:12
BASH script to display a PNG image in a Kitty-compatible terminal emulator (like Konsole)
#!/bin/sh
if [ $# -eq 0 ]
then
echo "Usage: $0 <filepath.png>"
exit 1
fi
echo -n $'\033[0C\033]1337;File=inline=1:'; cat $1 | base64 -w 0; echo $'\007'
@danieloneill
danieloneill / snorblorb.js
Created October 20, 2023 14:29
GS1 GTIN-14 check bit calculation in JS, RFC
function checksum(gtin)
{
const len = gtin.length;
// Split the code into an array of characters
// then map that into an array of numbers:
const chs = gtin.split('').map( (e) => parseInt(e) );
// Since this is just a GTIN-14 example:
if( 14 === len )
@danieloneill
danieloneill / MyControl.qml
Created September 11, 2023 05:57
Qt Quick polyfills for Array.flat, String.endsWith, and String.startsWith
import 'polyjank.js' as PJ
@danieloneill
danieloneill / README
Last active June 15, 2023 22:04
CLI Keyboard tool for KDE Plasma
Just a little keyboard layout tool for KDE Plasma.
I wrote this so I could swap between Dvorak and US when gaming. It isn't strictly necessary since
all my games run on Proton which renders via Xwayland (which you change the layout using setxkbmap),
but I like consistency, so I swap the layout for both Wayland and Xwayland at the same time.
Steam -> Launch Options:
setxkbmap us; kdekbtool -i 1; %command%; setxkbmap dvorak; kdekbtool -i 0
Requires Qt, written/tested with Qt 6.5.2 and Plasma 5.27.5 (Qt 5.15.9) on Fedora 38
@danieloneill
danieloneill / Makefile
Created February 28, 2023 04:15
(C) Benchmark for vertically flipping a 320x240x24bpp image using different CPU and GPU methods, Linux/SDL/CUDA
all:
/usr/local/cuda-12.0/bin/nvcc -o readbmp readbmp.cu sdltest.cu -g `sdl2-config --cflags --libs` -lcuda
from TTS.api import TTS
import pysbd
import os
import time
from datetime import timedelta
print(TTS.list_models())
model_name = "tts_models/multilingual/multi-dataset/your_tts"
sample_wav = "samples_of_voice_to_copy.wav"
@danieloneill
danieloneill / proton-patch-skf4sevr-dlls_ntdll_loader_c.diff
Created January 7, 2023 03:05
Patch for Proton (wine/dlls/ntdll/loader.c) to allow SKSEVR/F4SEVR to load correctly.
*** loader.c.orig 2023-01-04 01:40:00.048623579 -0800
--- loader.c 2023-01-04 04:16:01.124146104 -0800
*************** static NTSTATUS load_native_dll( LPCWSTR
*** 2604,2611 ****
{
void *module = NULL;
SIZE_T len = 0;
NTSTATUS status = NtMapViewOfSection( mapping, NtCurrentProcess(), &module, 0, 0, NULL, &len,
! ViewShare, 0, PAGE_EXECUTE_READ );
@danieloneill
danieloneill / MCalendar.qml
Created November 11, 2022 13:29
Calendar, date range selector in Qt Quick/QML (Qt 6+) - https://imgur.com/QNYaR4h
import QtQuick
import QtQuick.Controls
import QtQuick.Controls.Material
import QtQuick.Layouts
ColumnLayout {
id: calendar
property alias day: gridMonth.selectedDay
property alias month: comboMonth.currentIndex
property alias year: spinYear.value
import QtQuick 2.4
Item {
id: scrollbar
property QtObject target //< The flickable to control
property bool autoHide: true //< If true, the bar will be hidden unless mouseover or moving
property real visibleOpacity: 0.9 //< When visible (not hidden), how "opaque" are we?
property int orientation: Qt.Vertical //< Either Qt.Vertical or Qt.Horizontal