Skip to content

Instantly share code, notes, and snippets.

@p0358
p0358 / truecharts_pvc_backup.md
Last active October 29, 2024 21:58
How to backup your TrueCharts PVC data before moving on to TrueNAS SCALE 24.10 Electric Eel + Docker

So say that you have been running your TrueNAS SCALE 24.04 or 23.10 or older happily with your TrueCharts apps installed (as happy as you could be with that buggy mess of a project).

You either stuck with 23.10 Cobia, because you didn't want to bother doing yet another TrueCharts troublesome migration where they removed did something with PVC rearrangement and expected you to re-setup all your apps yet again (!), or you upgraded to 24.04 Fangtooth either while ignoring these instructions and apps still kept on working or running the PVC migration script as intended.

You kept your apps config storages to PVC as that was a simple default. (You start to grow a certain regret of not using host path mounts for everything from the beginning, but that's all water in drain now.)

Now you want to backup that data so that you can move to Docker-based apps in upcoming 24.10 Electric Eel release flawlessly and gracefully, and be happy everafter.

This tutorial and a bunch of pointers here is for you then

[WIP] Origin 9.x restoration

This gist documents my research into booting up that old EA Origin client and having it working again. It is incomplete and I currently give up for now, and this gist serves as a bit of info dump in case someone (like me) wants to pick this up again in the future.

Old origin urls

Legacy channel

Those were supported for a short moment after the new Origin 10.x (OriginX) was already out. They didn't include the social features/chat anymore.

@p0358
p0358 / rectangle_hole_reverse.cpp
Created January 11, 2023 00:00
Given rectangular area with holes inside, constructs vector of reversed rectangles (ones that are outside of holes and cover the entirety of the remaining area). This algorithm can be used to for example draw some background around windows on the screen, without drawing over the windows.
#include <iostream>
#include <vector>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
class Rectangle {

Running Titanfall 2 (+Northstar) / Titanfall 1 in Sandboxie for increased security

In the light of recent events regarding an unclear exploit existing between Titanfall/Origin, and since neither Source Engine itself or Respawn/EA are known for their good security track records, I decided it will be a good idea to write a tutorial on how to run the game and Origin in a sandboxed environment, when even if the worst came to the worst, your system and data would still be secure and you could sleep calmly. Even though we try to fix any security vulnerabilities in Titanfall/Titanfall 2 as soon as they're uncovered, nobody can ever guarantee guarantee the game is 100% secure (just like with virtually any software honestly), and running things sandboxed will let you combat any dangers and prevent any damage ahead of time, before any danger is even known.

If you're slightly paranoid about possible security issues and want to sleep calmly while enjoying Titanfalls, you came to the right place. On the other hand, if

@p0358
p0358 / dedi_delete_tfo.txt
Last active December 28, 2021 20:01
Unneeded PKG files that can be removed from TFO's dedicated server: cd Data && cat dedi_delete_tfo.txt | xargs rm
001fc10884c618169cc7f9f9e48430e0.pkg
00223b2d63d2e0b8a5299929bf39610d.pkg
00523282ff2175e5e85dc10dd6c72cba.pkg
006b811f482bff8bd5a5ed9ed74503f1.pkg
00b033bf120ff26a98f182d7410e549f.pkg
00e6b68c3f01c4e96777303e1bfe5b46.pkg
011ed3bbe8285eba7cf37362e9e9d3e4.pkg
0192bc64e82ec56c59bd8a01969411c8.pkg
01a0fac9769bd17f39731934a3ca8730.pkg
02086328c3647de3a44e5e24df6189be.pkg
@p0358
p0358 / videoplayer.html
Created November 15, 2020 22:36
Simple video player which allows you to play videos being fed with a direct link to them, with native controls, on the entire page. Good for use with Metastream, where it will nicely cooperate with it, unlike many source pages which have interferencing scripts.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="referrer" content="no-referrer">
<meta property="og:title" content="Video Player" />
<meta property="og:description" content="Simple video player which allows you to play videos being fed with a direct link to them, with native controls, on the entire page. Good for use with Metastream, where it will nicely cooperate with it, unlike many source pages which have interferencing scripts." />
<meta property="og:type" content="video.other" />
<title>Video</title>
@p0358
p0358 / atlas_extract.php
Created June 9, 2019 21:01
Flappy Bird's atlas.png/txt simple extractor. — Extracts assets from atlas.png into separate files based on assets definitions from atlas.txt
<?php
$atlas_file = file_get_contents('atlas.txt');
// Hardcoded source image size
$x = 1024;
$y = 1024;
@mkdir('out');
@p0358
p0358 / messenger_thread_info.php
Last active October 23, 2018 23:24
Very simple stats about Messenger conversation based on JSON data export from Facebook
<?php
// https://github.com/p0358
// Example output: https://imgur.com/UzAIAMH
function intformat($number) { return number_format($number, 0, '.', ' '); }
if (sizeof($argv) == 1) {
echo <<<'USAGE'
@p0358
p0358 / polish_numbers_within_roman_numbers.php
Created April 21, 2018 15:26
Check which of the roman numbers are valid Polish words
<?php
// https://sjp.pl/slownik/growy/
// Firstly, put into separate file only those words that contain only letters making up roman numbers
$handle = fopen("slowa.txt", "r");
$handle_write = fopen("jakby_rzymskie.txt", "w");
if ($handle) {
while (($line = fgets($handle)) !== false) {
@p0358
p0358 / any_bool_case_in_any_switch.php
Created January 4, 2018 02:17
PHP any bool case in any switch
<?php
// PHP any bool case in any switch
// useful if you want to do also some other switch case
// being exceptional result of some separate check/comparsion
//$t = 'text!';
$t = '';
$b = true; // any bool check you want in the switch, it can be inlined in the case statement too