Skip to content

Instantly share code, notes, and snippets.

View Xevion's full-sized avatar
⚜️
Chaos Order

Xevion Xevion

⚜️
Chaos Order
View GitHub Profile
import { fromJson as fromResultJson } from "@/lib/true-myth/result";
import { fromJson as fromMaybeJson } from "@/lib/true-myth/maybe";
export function unreachable(value: never): never {
throw new Error(`Should have been unreachable with ${value}`);
}
export { fromResultJson, fromMaybeJson };
@Xevion
Xevion / ParserExtensions.cs
Created February 2, 2025 05:50
SuperPower Token Positioning
using System.Linq;
using Microsoft.Diagnostics.Tracing.Parsers.MicrosoftWindowsTCPIP;
using Superpower;
namespace Netophone.Systems.Plot.Parsers;
public interface ILocated {
PositionSpan Span { set; }
}
use std::sync::LazyLock;
use futures_util::{FutureExt, StreamExt};
use salvo::http::{HeaderValue, StatusCode, StatusError};
use salvo::logging::Logger;
use salvo::prelude::{
handler, Listener, Request, Response, Router, Server, Service, StaticDir, TcpListener,
WebSocketUpgrade,
};
use salvo::websocket::WebSocket;

Why SQLite is the right database for Hydrus

If you were directed to this page, one or more of the following may apply to you:

  • you suggested porting Hydrus to another database,
  • you have misconceptions about SQLite,
  • you are uninformed about databases in general.

Don't worry though, you are not the first (hence this document). Please do read on.

#!/bin/env python3
import matplotlib.pyplot as plt
import seaborn as sns
def approximate_memorized(fahrenheit) -> float:
# Nearest memorized temperature
close = round((fahrenheit - 5) / 9) * 9 + 5
# Convert to Celsius
rough = (close - 32) // 9
function shortnumberstring(number)
local steps = {
{1,""},
{1e3,"k"},
{1e6,"m"},
{1e9,"g"},
{1e12,"t"},
}
for _,b in ipairs(steps) do
if b[1] <= number+1 then
@Xevion
Xevion / redisinsight.md
Created January 29, 2024 19:40
RedisInsight Download Links
;;; #1 removeNILTop
(defun removeNILTop (lst)
(remove-if #'null lst))
(removeNILTop '(NIL X NIL NIL Y NIL Z))
(removeNILTop '(X NIL Y NIL Z NIL))
(removeNILTop '(NIL (X NIL Y) (NIL NIL)))
;;; #2 removeNILMost
(defun removeNILMost (lst)
# Get a temporary file for storing encrypted outputs
$encryptedFile = New-TemporaryFile
# Milestone testing function
function TestMilestone($milestone, $inputFile, $outputFile, $keyFile, $expectedOutputFile) {
Write-Host "Running Milestone $milestone... " -NoNewline
echo "" # Use echo to skip the system pause
| ./Debug/cs3843-cryptography.exe -e $inputFile -p SECRET -o $outputFile -k $keyFile -m $milestone
| Out-Null # Suppress output
@Xevion
Xevion / tailwind.config.js
Created November 16, 2023 23:48
Tailwind Fine Grain + Darker Palette Generator
const colors = require('tailwindcss/colors');
const Color = require('color');
// Range generation function
const range = (lower, upper, step) => {
return Array.from(
new Array(Math.floor(upper / step - lower / step) + 1),
(_, i) => lower / step + i
).map((x) => x * step);
};