Skip to content

Instantly share code, notes, and snippets.

View IronOxidizer's full-sized avatar
🦀

Iron Oxidizer IronOxidizer

🦀
View GitHub Profile
#!/bin/sh
#This script reduces boot times from 60s to 19s on the RPi0w
if [ "$(id -u)" -ne 0 ]; then
echo "This script must be run as root"
exit 1
fi
echo '
[all]
def minimize_all_windows():
# create a display object
disp = display.Display()
# get the root window
root = disp.screen().root
# get the atoms for minimizing and for the window list
wm_state = disp.intern_atom('_NET_WM_STATE')
wm_state_hidden = disp.intern_atom('_NET_WM_STATE_HIDDEN')
@IronOxidizer
IronOxidizer / xcb_search_window_by_name.c
Last active April 10, 2023 14:48
xcb search window by name
xcb_window_t search_window_by_name(xcb_connection_t *conn, xcb_window_t window, const char *search_string) {
// check name
xcb_get_property_reply_t *name_reply = xcb_get_property_reply(conn, xcb_get_property(conn, 0, window, XCB_ATOM_WM_NAME, XCB_ATOM_STRING, 0, 256), NULL);
if (name_reply) {
char *name = xcb_get_property_value(name_reply);
free(name_reply);
if (name && !strcmp(name, search_string)) return window;
}
// get window tree
@IronOxidizer
IronOxidizer / views.rs
Last active January 5, 2021 04:58
Horizontal scroll glitching
use druid::{Color, Data, KeyOrValue, LensExt, RenderContext, Widget, WidgetExt, Env, EventCtx, Event,
im::{Vector},
widget::{Flex, Label, List, ViewSwitcher, Button, Container,
Scroll, TextBox, Painter, CrossAxisAlignment, Controller}};
use super::lcu_api::*;
use super::AppState;
#[derive(Copy, Clone, PartialEq, Data)]
pub enum AppView {
@IronOxidizer
IronOxidizer / main.rs
Created December 20, 2020 16:25
Lensing a non-AppState type causes an error
use druid::{AppLauncher, Widget, WidgetExt, WindowDesc, UnitPoint,
Lens, Data, ExtEventSink, widget::{Flex, Label}};
use std::sync::Arc;
use std::rc::Rc;
#[derive(Clone, Data, Lens)]
struct AppState {
pub event_sink: Arc<ExtEventSink>,
pub current_avatar: Rc<Avatar>
}
@IronOxidizer
IronOxidizer / minetest-pinephone.sh
Last active March 9, 2022 00:55
Buildscript for Minetest for the PinePhone
sudo apk add build-base git cmake bzip2-dev libpng-dev jpeg-dev libxxf86vm-dev mesa-dev sqlite-dev libogg-dev libvorbis-dev openal-soft-dev curl-dev freetype-dev zlib-dev gmp-dev jsoncpp-dev luajit-dev
git clone --recursive --depth 1 -b ogl-es https://github.com/zaki/irrlicht
git clone https://github.com/minetest/minetest
cd irrlicht/source/Irrlicht
sed -i '1s/^/#define NO_IRR_COMPILE_WITH_OGLES1_\n#define NO_IRR_COMPILE_WITH_OPENGL_\n/' ../../include/IrrCompileConfig.h
sed -i 's/<GLES\/egl\.h>/<EGL\/egl\.h>/g' CEGLManager.h
make -j$(nproc)
<canvas id=c width=256 height=256></canvas>
<script>
var TORAD = Math.PI/180,
f = 360,
d = f/256,
canv = document.getElementById("c"),
ctx = canv.getContext("2d"),
cx = canv.width/2,
cy = canv.height/2,
t = 0,
@IronOxidizer
IronOxidizer / h2rgb.js
Created August 26, 2020 04:08
Hue to RGB
function h2rgb(h) {
let o="rgb(";
h=(h+60)%360-120;
for(let i=0;i<3;++i)o+=((h=(h+120)%360)<=120?255:(180<=h&&h<=300?0:(Math.abs(h-240)-60)*64/15))+",";
return o.slice(0,-1)+")";
}
@IronOxidizer
IronOxidizer / audio-flatpak.md
Last active June 18, 2020 16:10
Audio Flatpak

Thanks @CrashyBang and @KaMiila, your solutions worked wonderfully for my similar issue with Discord Flatpak. I'll detail my exact procedure for anyone else:

Step 1: Add the following lines to ~/.xinitrc (before the line that starts WM)

mkdir -p "$HOME/.cache/xdg_runtime_dir"
export XDG_RUNTIME_DIR="$HOME/.cache/xdg_runtime_dir"

Step 2: Create a script (mine is ~/.local/bin/Discord) with the following lines

#![no_std]
#![no_main]
#![feature(asm)]
#![feature(abi_efiapi)]
extern crate compiler_builtins;
#[macro_use]
extern crate log;
#[macro_use]