Skip to content

Instantly share code, notes, and snippets.

View xor-gate's full-sized avatar
👽

Jerry Jacobs xor-gate

👽
View GitHub Profile
@xor-gate
xor-gate / 01README.md
Last active March 11, 2024 12:05
Semhosting

QEMU Cortex-m3 with semihosting

@xor-gate
xor-gate / 0-README.txt
Created January 20, 2024 12:49 — forked from yan-foto/0-README.txt
DeDRM Adobe Digital Edition Books
Convenient DeDRM Scripts
-------------------------
**NOTE**: read https://blog.quaintous.com/2021/02/16/remove-drm-from-ebooks/ to find out what this gist is good for.
* ./init.sh: extracts Adobe Digital Editions private key and required files to DeDRM.
* ./dedrm: removes DRM from given ebook (pdf/epub)
If you are using this for the first time, make sure that you have authenticated your Adobe Digital Editions (ADE) and run './init.sh'. Import any DRM-protected file into ADE and run 'dedrm.sh':
@xor-gate
xor-gate / ConfigFormat.c
Last active January 17, 2024 11:17
ini-parser-xmacros
#include "ConfigFormat.h"
#include <string.h>
const struct ConfigFormatField *ConfigFormatGetFieldByName(const struct ConfigFormat *Format, const char *Name, void *Structure)
{
static struct ConfigFormatField Field;
for (size_t n = 0; n < Format->num_members; n++) {
if (strcmp(Name, Format->names[n]) != 0) {
continue;
@xor-gate
xor-gate / CMakeLists.txt
Created June 13, 2016 09:30
CMake libusb windows
project(stlink C)
cmake_minimum_required(VERSION 3.1)
set (CMAKE_C_STANDARD 99)
include(CheckCCompilerFlag)
find_package(PkgConfig)
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_SOURCE_DIR}/cmake/modules")
file(DOWNLOAD
#include <WiFi.h>
#include <SPIFFS.h>
#include <ESPAsyncWebServer.h>
#include <WebSocketsServer.h>
// Constants
const char *ssid = "ESP32-AP";
const char *password = "LetMeInPlz";
const char *msg_toggle_led = "toggleLED";
const char *msg_get_led = "getLEDState";
@xor-gate
xor-gate / README.markdown
Created April 1, 2023 08:21 — forked from openfirmware/README.markdown
Restoring ZFS Snapshots of PostgreSQL Database

ZFS Snapshots and PostgreSQL

I recently set up a host running Ubuntu 14.04 LTS, ubuntu-zfs, and PostgreSQL 9.3. Using the ZFS snapshot feature I was able to make a snapshot of the file system holding the PostgreSQL database, write the snapshot to a compressed file, transfer it to another Ubuntu 14.04 LTS host running ubuntu-zfs, restore it, and launch PostgreSQL using that data directory with all the data (seemingly) intact.

The database is very low-traffic, so I do not know how effective this strategy would be for a busier database.

I take no responsibility if you attempt this setup and it causes data loss or other issues. Use it at your own risk; this document is meant to explain a potential setup and open discussion about limitations and potential improvements.

First Host Setup

@xor-gate
xor-gate / QJSEngine templating example
Last active September 20, 2021 20:05
QJSEngine template engine
Download ejs.min.js from https://cdn.jsdelivr.net/npm/ejs@3.1.6/ejs.min.js
See also https://cpp.hotexamples.com/examples/-/QJSEngine/toScriptValue/cpp-qjsengine-toscriptvalue-method-examples.html
/*
* robot.js
*
* You'll need three keys in order to unlock the
* Algorithm: the red key, the green key, and the
* blue key. Unfortunately, all three of them are
* behind human-proof barriers.
*
* The plan is simple: reprogram the maintenance
* robots to grab the key and bring it through
/*************
* ambush.js *
*************
*
* Oh. Oh, I see. This wasn't quite part of the plan.
*
* Looks like they won't let you take the Algorithm
* without a fight. You'll need to carefully weave your
* way through the guard drones.
*
/**********************
* fordingTheRiver.js *
**********************
*
* And there's the river. Fortunately, I was prepared for this.
* See the raft on the other side?
*
* Everything is going according to plan.
*/