Skip to content

Instantly share code, notes, and snippets.

View Xevion's full-sized avatar
⚜️
Noblesse Oblige

Xevion Xevion

⚜️
Noblesse Oblige
View GitHub Profile
@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]))
@Xevion
Xevion / gist.sh
Last active September 26, 2023 20:09
❯ type -a pkg-config
pkg-config is /home/linuxbrew/.linuxbrew/bin/pkg-config
pkg-config is /usr/bin/pkg-config
pkg-config is /bin/pkg-config
❯ pkg-config --variable pc_path pkg-config
/home/linuxbrew/.linuxbrew/lib/pkgconfig:/home/linuxbrew/.linuxbrew/share/pkgconfig:/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/os/linux/pkgconfig
warning: variable does not need to be mutable
--> src/item.rs:412:15
|
412 | if let Ok(mut asleep) = (&mut asleeps).try_get(who) {
| ----^^^^^^
| |
| help: remove this `mut`
|
= note: `#[warn(unused_mut)]` on by default
use std::env;
use std::fs::File;
use std::io::{BufRead, BufReader, BufWriter, Write};
use std::path::Path;
use regex::Regex;
use chrono::{FixedOffset};
const HOUR: u32 = 3600;
fn parse_offset(raw_offset: &str) -> i32 {