Skip to content

Instantly share code, notes, and snippets.

@RLovelett
RLovelett / README.md
Last active March 19, 2024 12:52
Force RGB instead of YCbCr output for HDMI on Ubuntu

Force RGB pixel format over YCbCr

There are some monitors, in my case Dell U2413, that report having YCbCr support when plugged in over HDMI. My AMD Radeon RX 570 Series video card sees this YCbCr pixel format and then prefers that over the RGB pixel format. The result is that fonts, graphics and other visuals are pixelated and not smooth in Ubuntu.

This actually is not just a Linux problem. A similar problem exists on macOS with the same monitor hooked up over HDMI. In fact an article by John Ruble on the Atomic Object blog called Fixing the External Monitor Color Problem with My 2018 MacBook Pro attempts to fix the exact same thing.

Solution

All of the articles I could find exploring this topic advocate patching the EDID for the monitor. Unfortunately the macOS solution would not work here. Luckily I found a Reddit post that covered how to get it working.

@RLovelett
RLovelett / delete.sh
Created July 2, 2014 20:07
Delete ZFS snapshots from dataset one-liner
zfs list -r -H -t snapshot -o name stream/lxc/stash | xargs -n1 zfs destroy
@RLovelett
RLovelett / libvirt.md
Last active March 8, 2023 01:53
Setup libvirtd on Fedora Server 28

libvirtd Fedora 28

System Packages

$ dnf install -y \
    libvirt \
    libvirt-python \
    libguestfs-tools \
 qemu-kvm \
@RLovelett
RLovelett / README.md
Last active February 26, 2023 09:40
FT232H user space GPIO device - https://stackoverflow.com/q/60781594/247730

Setting up ftrace

$ sudo su - root
$ cd /sys/kernel/debug/tracing
$ cat available_tracers
hwlat blk mmiotrace function_graph wakeup_dl wakeup_rt wakeup function nop
$ cat available_filter_functions | grep ftdi_sio | cut -d' ' -f1 | tr '\n' ' ' > set_ftrace_filter
$ cat set_ftrace_filter
get_serial_info [ftdi_sio]
@RLovelett
RLovelett / posix_spawnp.swift
Created April 21, 2016 02:22
Spawn a sub-process from Swift
import Glibc
var action = posix_spawn_file_actions_t()
posix_spawn_file_actions_init(&action);
defer { posix_spawn_file_actions_destroy(&action) }
posix_spawn_file_actions_addopen(&action, 1, "/tmp/foo-log", (O_WRONLY | O_CREAT | O_TRUNC), 0644)
posix_spawn_file_actions_adddup2(&action, 1, 2)
let args = [
"ffmpeg",
@RLovelett
RLovelett / binutils-bisect.sh
Last active May 8, 2022 19:53
A Git bisect run script to find the binutils commit that introduced the move bug
#!/usr/bin/env bash
# Good: 2bd25930
# Bad: 71090e7a
set -ex
BINUTILS_DIR=$HOME/packages/trunk
SWIFT_DIR=$HOME/swift
@RLovelett
RLovelett / gist:6791bde80575fc412983
Created October 14, 2015 00:50 — forked from chrislavender/gist:cad26500c9655627544f
HTTP Live Streaming Tutorial

Note: This is an older post that I did back when I thought I might have time to be a blogger. Oh I was oh so wrong. However, it has proven useful for some folks on stackoverflow. Thus I'm keeping it alive here on Gist.

One of my past projects dealt heavily with an open source Apple technology called HTTP Live Streaming. It’s an HTTP based streaming protocol that at its most fundamental level provides a way to stream video and audio from just about any server with nothing but a few free software tools provided by Apple**. However, it has a few additional features that I think make it a really exciting tool. Yet, I haven’t seen HTTP Live Streaming used very much. This is probably mainly due to the combination of a lack of good/clear documentation, and Apple’s Live Streaming Developer Tools being command line based also make the barrier to entry higher than many developers want to deal with.

The hope is to share my understanding of how to use this technology to:

@RLovelett
RLovelett / smb.conf
Last active April 8, 2021 15:26
Samba Configuration
# See smb.conf.example for a more detailed config file or
# read the smb.conf manpage.
# Run 'testparm' to verify the config is correct after
# you modified it.
[global]
workgroup = SAMBA
security = user
passdb backend = tdbsam
load printers = no
@RLovelett
RLovelett / mtoc.sh
Created October 29, 2019 20:50
Compile mtoc on macOS Catalina Xcode 11
# https://github.com/macports/macports-ports/blob/master/devel/cctools/Portfile
curl -o cctools-921.tar.gz https://opensource.apple.com/tarballs/cctools/cctools-921.tar.gz
curl -o llvm-8.0.1.src.tar.xz https://github.com/llvm/llvm-project/releases/download/llvmorg-8.0.1/llvm-8.0.1.src.tar.xz
curl -o ld64-409.12.tar.gz https://opensource.apple.com/tarballs/ld64/ld64-409.12.tar.gz
tar xvf cctools-921.tar.gz
tar xvf llvm-8.0.1.src.tar.xz
tar xvf ld64-409.12.tar.gz
@RLovelett
RLovelett / CMakeLists.txt
Created April 1, 2020 17:59
Example of preferring Python 2 over Python3 with new FindPython2 and FindPython3 CMake modules
cmake_minimum_required(VERSION 3.12.4)
find_package(Python2 COMPONENTS Interpreter)
find_package(Python3 COMPONENTS Interpreter)
if (NOT Python2_Interpreter_FOUND AND NOT Python3_Interpreter_FOUND)
message(FATAL_ERROR "Could NOT find Python2 or Python3")
endif()
# https://github.com/Kitware/CMake/blob/cfc92b483fbd3695d4a67843977e709ba4d7ea47/Modules/FindPython/Support.cmake#L2433-L2439