Skip to content

Instantly share code, notes, and snippets.

diff ... TTR difference between players
P(diff) ... winning probability in percent
exact winning chance
P = 1 / (1+10^(diff/150))
rule of thumb for winning chance
if (diff =< 50)
P = 50 + 4 × (diff ÷ 10)
else
@CennoxX
CennoxX / FeedWatcher.gs
Last active October 30, 2025 11:17
A Google Apps Script to monitor RSS and Atom feeds, automatically detect new entries, and send email notifications with the new post.
function monitor(feedName, url, author, filter = null) {
console.log(feedName);
let startTime = Date.now();
let scriptProperties = PropertiesService.getScriptProperties();
let lastUpdate = scriptProperties.getProperty(`lastUpdate${feedName}`);
let errorCount = parseInt(scriptProperties.getProperty(`errorCount${feedName}`) || "0");
let root;
try {
let res = UrlFetchApp.fetch(url);
root = XmlService.parse(res.getContentText().replace(/content:encoded/g, "content").replace(/&amp;#(\w.+?);/g, (_, p) => {return String.fromCharCode(p)})).getRootElement();
@CennoxX
CennoxX / startup.lua
Last active August 22, 2025 10:03 — forked from patstew/startup.py
notepad++ startup.lua
local function indent_auto_detect()
for i = 0, editor.LineCount - 1 do
local pos = editor:PositionFromLine(i)
local indent = editor.LineIndentPosition[i] - pos
if indent > 0 then
if string.byte("\t") == editor.CharAt[pos] then
print("Indentation: Tabs")
editor.UseTabs = true
return
elseif indent == 2 or indent == 3 or indent == 4 or indent == 8 then
@CennoxX
CennoxX / termux-deno-setup.sh
Last active October 8, 2025 09:01 — forked from CodeIter/termux-pacman-glibc-setup.sh
Install deno on Termux by setting up glibc-runner with pacman
#!/usr/bin/env -S bash -xeuo pipefail
pkg update && pkg upgrade
pkg install which time ldd tree
set -xeuo pipefail
pkg install pacman patchelf which time ldd tree
echo
pacman-key --init
echo
@CennoxX
CennoxX / ZipExtractor.cs
Last active April 5, 2023 07:23
Extract a zip file to a folder if there are multiple files inside, extract directly if there is only one file. Afterwards the zip file will be deleted. As it should be.
using System;
using System.Diagnostics;
using System.Text.RegularExpressions;
partial class ZipExtractor
{
static void Main(string[] args)
{
// get the name of the zip file to extract
string filename = args[0];
@CennoxX
CennoxX / convertCutlistToM3u.js
Last active October 30, 2025 13:04
Converts OnlineTvRecorder cutlists to m3u format, to play with VLC-Player, set the starttime to change the beginning of the video.
function convertCutlistToM3u(cutlist, starttime = null) {
var obj = {};
var lastKey;
cutlist.split(/\n\n?/).forEach(l => {
var [, key] = l.match(/\[(.*)]/) || [];
if (key) {
obj[key] = {}
lastKey = key;
} else {
var [prop, val] = l.split("=");
@CennoxX
CennoxX / sublime.js
Created May 31, 2022 09:26
Bookmarklet to use shortcut [Ctrl]+[Alt]+[d] for Select Next Occurence on Tampermonkey
javascript:document.addEventListener("keydown",function(e){if(e.ctrlKey&&e.altKey&&e.key=="d"){[...document.querySelectorAll(".editormenu>li:nth-child(3)>table>tr:nth-child(10)")].filter(i => i.closest('[name="tabview_contentmain"]').style.display != "none")[0].click();[...document.querySelectorAll(".editormenu>li:nth-child(3)>table")].filter(i => i.closest('[name="tabview_contentmain"]').style.display != "none")[0].classList.remove("visible");}});
m(x) ... minutes of the time x
h(x) ... hours of the time x
add time
a+b=c
if (m(c)>=60) || (h(a)+h(b)>h(c))
c=c+40
subtract time
a-b=c