Skip to content

Instantly share code, notes, and snippets.

Avatar

Anders Evenrud andersevenrud

View GitHub Profile
@andersevenrud
andersevenrud / README.md
Last active Jul 18, 2022
Raspberry Pi Low Voltage Warning
View README.md

Raspberry Pi Low Voltage Warning

Resolving the Low Voltage warning (aka the "lightning bolt" ) on a Raspberry Pi.

Please note that this research was done on Pi 3 and lower. I don't own a Pi 4 which uses another USB spesification and different power requirements.

Introduction

This is a document that was produced from a mess of personal notes in order to try to create a resource that might be useful for someone that runs into the same issues as me when it comes to powering a Pi in different scenarios.

View README.md

UE5 on Arch Linux

Just some personal in order to make Unreal Engine 5 compile on Arch Linux (25th of June 2022).

Don't even bother trying to make the marketplace run. You gotta do that shit under Wine (Lutris is great for auto-setup) and copy assets over to your Linux drive.

Dependencies:

sudo pacman -S dotnet-sdk xdg-user-dir clang make git
@andersevenrud
andersevenrud / README.md
Last active Jun 30, 2022
How to rotate (invert) Raspberry Pi 7" Touch LCD screen & input (RasPi 1, 2, 3)
View README.md

Rotate Official Raspberry Pi 7" Touch Screen

Shows how to easily rotate (in this case invert to make orientation correct within a case) the Raspberry Pi 7" Touch Screen.

This will also update the calibration for the touch screen so it will work correctly.

References:

View index.js
/**
* Parse fstab from either string (from file) or an array of lines
* @author Anders Evenrud <andersevenrud@gmail.com>
* @license MIT
*/
const parse = input => (input instanceof Array ? input : input.split('\n'))
.map(line => line.replace(/\s+/g, ' ').replace(/(\s+)?,(\s+)?/g, ',').trim())
.filter(line => line.length > 0 && line.substring(0) !== '#')
.map(line => line.split(/\s/g))
.map(([dev, dir, type, options, dump, fsck]) => ({
@andersevenrud
andersevenrud / iframe.html
Created Jul 27, 2020
PoC to do bi-directional communiction between a parent and iframe document
View iframe.html
<html>
<body>
<img id="image" />
<script>
const image = document.getElementById('image')
const postMessage = (data) => {
top.postMessage(JSON.stringify(data), '*')
}
@andersevenrud
andersevenrud / index.js
Created Feb 25, 2020
OS.js Webcam application example (localhost or https only)
View index.js
//
// NOTE: THIS ONLY WORKS ON "localhost" OR A HOST WITH "https:"
//
import osjs from 'osjs';
import {name as applicationName} from './metadata.json';
const createVideoElement = () => {
const video = document.createElement('video');
video.style.width = '100%';
video.style.height = '100%';
@andersevenrud
andersevenrud / index.js
Last active Jul 24, 2021
OS.js x-frame-bypass iframe example
View index.js
/*
This is just a demonstration of how this browser hack could be used
to make a "browser".
NOTE: This just bypasses *some* of the ways a browser allows loading
content within an iframe. Most google services etc does not work as
expected, and might just crash or not load.
*/
import './index.scss';
@andersevenrud
andersevenrud / README.md
Last active Dec 24, 2019
Very basic OS.js Chat application
View README.md

Based on example from https://manual.os-js.org/v3/guide/framework/#react

Very basic chat application:

  • Uses a custom websocket server
  • Uses React to render UI
  • Uses event subscription model to handle websocket messages

THIS IS JUST FOR DEMONSTRATION PURPOSES

@andersevenrud
andersevenrud / alacritty-tmux-vim_truecolor.md
Last active Aug 6, 2022
True Color (24-bit) and italics with alacritty + tmux + vim (neovim)
View alacritty-tmux-vim_truecolor.md

True Color (24-bit) and italics with alacritty + tmux + vim (neovim)

This should make True Color (24-bit) and italics work in your tmux session and vim/neovim when using Alacritty (and should be compatible with any other terminal emulator, including Kitty).

Testing colors

Running this script should look the same in tmux as without.

curl -s https://gist.githubusercontent.com/lifepillar/09a44b8cf0f9397465614e622979107f/raw/24-bit-color.sh >24-bit-color.sh
@andersevenrud
andersevenrud / index.js
Last active Apr 1, 2019
Simple OS.js Application w/Server API
View index.js
//
// Just a standard OS.js application
//
// The "index.js" file.
//
import osjs from 'osjs';
import {name as applicationName} from './metadata.json';
const register = (core, args, options, metadata) => {
const proc = core.make('osjs/application', {args, options, metadata});