Skip to content

Instantly share code, notes, and snippets.

@eendeego
eendeego / rc.local.switch-screen.sh
Created October 30, 2021 19:34
Selective HDMI vs Hyperpixel switch
#!/bin/sh
# Original source in https://forums.pimoroni.com/t/hyperpixel-selective-output-eg-on-boot/5193/15
#
# Reboots the RPi enabling/disabling HDMI/Hyperpixel depending if HDMI is used or not
# If the machine starts to reboot on a loop, mount /boot on a different machine, and
# create a file in /boot/no-display-reboot
_HDMI_DEVICE=$(tvservice -l | perl -n -e '/Display Number (\d+), type HDMI 0$/ && print $1')
@eendeego
eendeego / main.rs
Created April 25, 2022 03:37
Raspberry Pi's hello_triangle2.c ported to Rust
#![allow(dead_code)]
#![allow(non_upper_case_globals)]
extern crate egl;
extern crate libc;
use egl::{EGLConfig, EGLDisplay, EGLNativeWindowType, EGLSurface, EGLint};
use gr_context::Context;
use opengles::glesv2 as gl;
use std::ffi::CString;