Skip to content

Instantly share code, notes, and snippets.

View markwylde's full-sized avatar

Mark Wylde markwylde

View GitHub Profile
@markwylde
markwylde / build-coreboot-for-chromebook-c201.md
Last active December 29, 2023 17:10
Build Coreboot for ARM Chromebook - C201 Veyron Speedy

These instructions will take you through the step by step process of building and flashing a custom build of the Coreboot ROM to a Chromebook C201.

This guide expects you to have a Chromebook C201, and another ARM computer with Ubuntu installed. Specifically I used the Odroid XU2. You may be able to do this on an Intel platform, using a cross compiler. See the sidenotes section for more information.

Setting up your Ubuntu

Install dependancies

Update your Ubuntu aptitude and install the dependancies we will need.

sudo apt update
@markwylde
markwylde / README.md
Last active December 4, 2023 13:34
ESP32-C6 ZigBee LED Blinker

The following firmware can be uploaded onto an ESP32-C6 to expose a ZigBee device.

At the bottom is the zigbee2mqtt device definition.

Firmware:

#include "esp_zigbee.h"

void setup() {
    // Initialize Zigbee stack configuration for a Zigbee end-device
@markwylde
markwylde / theme.css
Created September 2, 2022 07:35
HackerNews Dark Theme
/* ==UserStyle==
@name HackerNews Dark
@namespace gist.github.com/markwylde/1d25a9c2237dd79cf4d1a1fc2f4e0d45
@author Mark Wylde
@description Change the HackerNews style to dark
@version 1
@license MIT
==/UserStyle== */
@-moz-document domain("news.ycombinator.com") {
body {
@markwylde
markwylde / setup.sh
Created August 25, 2022 07:42
Creater an X11 server in Docker with VNC
apt-get update
apt-get upgrade -y
DEBIAN_FRONTEND=noninteractive apt-get install -y x11vnc xvfb fluxbox
Xvfb :2 -screen 0 1024x768x16 &
DISPLAY=:2 fluxbox &
DISPLAY=:2 x11vnc -display :2 -bg -forever -nopw -quiet -listen localhost -xkb &
@markwylde
markwylde / create-swarm-cluster.sh
Last active December 10, 2021 13:06
Create a Docker Swarm cluster with a configuration amount of workers on Digital Ocean or using Virtual Box
# How many swarm workers do you want?
WORKER_COUNT="${WORKER_COUNT:-5}"
# What would you like to prefix all your VM's with?
CLUSTER_NAME="${CLUSTER_NAME:-mycluster}"
# Set this to true to use virtualbox instead of digitalocean driver
LOCAL_VIRTUALBOX="${LOCAL_VIRTUALBOX:-true}"
# Virtualbox Configuration
@markwylde
markwylde / docker-compose.yml
Created December 10, 2021 13:05
Docker mongodb instance with custom network
version: '3'
services:
mongo:
image: mongo
restart: always
ports:
- 27017:27017
environment:
MONGO_INITDB_ROOT_USERNAME: root
@markwylde
markwylde / actualStringify.js
Created June 5, 2021 08:54
Actual Stringify
function actualStringify (object) {
const newObject = {};
for (const key in object) {
if (['String', 'Object', 'Number'].includes(object[key].constructor.name)) {
newObject[key] = object[key];
}
}
return JSON.stringify(newObject, null, 2);
}
@markwylde
markwylde / cacheWorker.js
Last active April 3, 2021 05:30
Service worker to cache everything
// This code should be accessable from your root domain
// As in, don't bundle
const cacheName = 'cache-v1';
// The activate handler takes care of cleaning up old caches.
self.addEventListener('activate', event => {
const currentCaches = [cacheName];
event.waitUntil(
caches.keys().then(cacheNames => {
return cacheNames.filter(cacheName => !currentCaches.includes(cacheName));
@markwylde
markwylde / setupNotifications.js
Created March 29, 2021 05:12
Cordova notifications
function checkNotificationPermission (requested) {
FirebasePlugin.hasPermission(function (hasPermission) {
if (hasPermission) {
console.log('Remote notifications permission granted')
// Granted
getToken()
} else if (!requested) {
// Request permission
console.log('Requesting remote notifications permission')
FirebasePlugin.grantPermission(checkNotificationPermission.bind(this, true))
@markwylde
markwylde / index.js
Created December 30, 2020 01:17
server rendered mithril
const fs = require('fs');
const http = require('http');
const handler = require('serve-handler');
const render = require('mithril-node-render');
const htmlTemplate = fs.readFileSync('./index.html', 'utf8');
const ui = require('./js/ui');
const server = http.createServer(async function (request, response) {