Skip to content

Instantly share code, notes, and snippets.

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

Xevion Xevion

⚜️
Chaos Order
View GitHub Profile

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);
};
{
"Response": {
"status": 200,
"flightInfo": {
"logo": null,
"airlineName": null,
"airlineCode": "ASA",
"airlineCodeIata": null,
"tailNumber": "N976AK",
"flightNumberInfo": "ASA541",
Error detected while processing WinEnter Autocommands for "*":
E5108: Error executing lua Vim:E495: no autocommand file name to substitute for "<afile>"
stack traceback:
[C]: in function 'expand'
[string ":lua"]:1: in main chunk
@Xevion
Xevion / dist.py
Created September 27, 2023 21:36
def score(distribution):
count = len(distribution)
deviation = [abs(1 / count - d) for d in distribution]
avg_deviation = sum(deviation) / count
return 1 - sum(deviation) / count
print(score([1 / 5 for _ in range(5)]))
print(score([0.12, 0.33, 0.55]))