522[it/she]@5snb.club ~/blog/ARE YOU TIRED OF BEING HUMAN?

Hello!

I’m 5225225. this is my webbed site

i spend too much time tweaking the style and not enough time writing content
but i’ll try and get a post a month at least. if you’re lucky

I post about Stuff here im stuff.

I’ve tried to make the website usable on desktop + mobile, if there’s any problems on either let me know. I use minimal JS, but this is a static site, so I will use JS for things that otherwise would be server-side code. Such as the JS for distortion or the fortune at the bottom of this page.

I have a RSS feed at /rss.xml, also using auto feed discovery. Let me know if there’s any problems with it. It has no limit (for now) and sends over full article content, but CSS isn’t embedded so some things are kinda janky in it, but should be good enough.

have a good day and stay hydrated !!! :3

Part of The Writing Gaggle, a writing group. There’s plenty of well written posts there, go check it out!

Our goal here is to motivate each other to write and publish more, and this page enumerates the results of that.

Best viewed not at all, go away.


C# puzzles

2024 Jan 31

Two puzzles about funny C# behavior I discovered in the past.

The first one is fully defined, the second one is Quite Clever.

Compressing a set of random numbers

2023 Dec 31

Despite what it may seem, compressing a set of random numbers is indeed possible, since not needing to care about the order lets you decrease the entropy by sorting the numbers ahead of time.

One basic scheme for doing this is to just sort the numbers, and then compress the most significant byte separately from the rest, by making an array of counts.

RFC 35140: The Do-Not-Stab flag in the HTTP Header

2023 Nov 17 #rant

Date: March 7, 2111

Abstract

This document defines the syntax and semantics of the Do-Not-Stab header, a proposed HTTP header that allows users to indicate to a website their preferences about being stabbed. It also provides a standard for how services should comply with such user preferences, if they wish to.

printf format validation in rust

2023 Oct 07 #hack

I was watching a talk about Idris 2 and it was mentioned that you can implement a type safe printf using dependent types (around 10 minutes in).

And I was wondering if you could do something like that in rust. And you can, ish!

error[E0308]: mismatched types
   --> src/main.rs:145:13
    |
145 |     let x = printf::<"that's a %s %s, aged %u!">("cute", "dog");
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `"%s%s"`, found `"%s%s%u"`
    |
    = note: expected constant `"%s%s"`
               found constant `"%s%s%u"`

That’s done with no macros, just a lot of const code of dubious quality.

Subpixel Rendering for images

2023 Sep 30

Subpixel rendering is typically used for text to give your monitor an effectively higher resolution. It works by making use of the fact that your monitor has 3 subpixels for every pixel that each light up, and so a red line will appear physically to the left than a blue line.

But what if we used it for not text instead? Such as images.

fun with comments

2023 Aug 14 #hack

Programming languages typically include one or two ways to comment out code so that the compiler doesn’t read it. One being line comments, such as

foo(); // comment here

which will comment out any code up until the end of the line, and the other being block comments, such as

foo(42 /* a 
    good 
    number */ )

which will comment out code in a block.

Block comments aren’t restricted to a single line, and can sometimes be nested (so that /* /* */ */ behaves correctly).

But what happens when you mix the two?

Spot the bug: Bad Escape

2023 Jul 19 #security

Hi! I wrote some Excellent Javascript that lets you change an image based on the funny little characters you type in the box at the bottom. I’ve vaguely heard of XSS, so I know that I should escape the characters, so I copied the escaping rules from Tera.

Namely, replacing &, <, >, ", \``, and /` with their associated HTML entities.

Your task is to call submitFlag with the string value <>. If you succeed, I will alert a fun message for you :)

Sensor noise art

2023 Jul 12 #art

I was playing around with Open Camera with a very long exposure (10 seconds), with a somewhat high ISO (3000ish), with my camera placed against a flat object so it doesn’t see any outside light. This is a great way of capturing sensor noise, though it does seem to be brighter around the outside, and less in the middle. Light leakage? Or just how the sensor works?

Anyways, I did that, and then played around with every nearly filter the stock photos app on my phone had, which results in some neat wallpapers.

PoC Watermark Attack on Restic

2023 May 20 #security

First off, does this matter to you? No. No it doesn’t. Unless you’re backing up gigabytes of completely attacker controlled data, to an attacker controlled service, and need to ensure they don’t know you’re backing up said data, it Doesn’t Fucking Matter.

With that said, it’s a somewhat neat attack!

A watermarking attack is when an attacker who can get you to store an attacker-controlled piece of data can then detect the presence of that attacker controlled data. It’s not a huge deal, but is a concern if someone is able to inject a watermark into, say, copywritten or leaked content, and then automatically terminate the cloud storage/backup accounts of users that can be shown to have that data on their drive.

Your machine isn't turing complete, so why are you mentioning the halting problem?

2023 May 01 #rant

Sometimes I will be part of exchanges such as:

Me: It would be cool if you could prove the lack of stack overflows in code!

Someone: Proving that code will not stack overflow is the same as solving the halting problem though.

Which is very much true, if you demand no false positives. But rather pointless. It’s being overly pedantic as a way of (intentionally or otherwise) being dismissive about useful feature ideas.

some pictures i took today

2023 Apr 18 #art

I was going into town today, and took the chance to take some pictures.

You can click them to open them as a JPEG XL for the original size and higher quality. If your browser doesn’t support JPEG XL, try opening it in something that does.

This was my first time using darktable. I don’t know what I’m doing in it, but at least I managed to nicely censor out the license plates.

(also, these were taken on the 17th, but i’ve not slept since for it is nearly 1AM, so i still consider that today)

Video Streaming Over Dialup

2023 Mar 31

Assuming modern codecs and computing power, could we have video sharing sites over a dialup connection and have it be watchable?

Turns out, yes! Kinda!

zsh and the search for .circleci

2023 Feb 28

I was using my shell one day, and hit tab on a . and ended up with

jess@neon ~
# .circleci
----------Completing external command----------
.circleci    .emscripten  .github
----------Completing builtin command----------
.

what the fuck? why do i have .circleci as a command?

Xonotic now-playing MPD script

2022 Nov 27

First off, the script:

xon_mpc_artist="$(mpc status -f "%artist%" | head -n1 | sed 's/;/;/g' | sed 's/\^/^^/g')"
xon_mpc_title="$(mpc status -f "%title%" | head -n1 | sed 's/;/;/g' | sed 's/\^/^^/g')"
xon_mpc_album="$(mpc status -f "%album%" | head -n1 | sed 's/;/;/g' | sed 's/\^/^^/g')"

if [ "$playing" = true ]; then
echo "say /me ^8np^7 ^x6b6$xon_mpc_artist ^xa44${xon_mpc_title:0:60} ^x345$xon_mpc_album" | head -n1 > "$HOME/.local/share/xonotic/.xonotic/data/np.cfg"
else
echo "" > "$HOME/.local/share/xonotic/.xonotic/data/np.cfg"
fi

And on the xonotic side, it’s just bind n "exec np.cfg".

Reverse Image Search

2021 Aug 01

Many times have I come across an image with no source given, and no signature visible, or someone else is asking where a particular image comes from. I’m writing this in the hopes that next time you post an image you found without a source, you spend the 5 minutes it takes to at least look to see where it came from.

An introduction of Content-defined chunking

2021 Feb 14

Content-defined chunking (CDC) is a method to more efficiently store various versions of the same file, while achieving deduplication both in the same file and across different files.

Trans rights blend

2021 Feb 07 #art

I made a trans flag wallpaper in blender!

I actually made this like a year ago but I’m publishing it now.

unwise, for when unsafe isn't quite right

2021 Jan 31

The rust language has a clearly defined notion of unsafe code. In short, any function for which it is ever possible to cause undefined behaviour by misusing it must be marked as unsafe. And any function for which it is not possible to ever cause undefined behaviour using it, should be marked as safe. Therefore, a codebase consisting of entirely safe code can never cause undefined behaviour.

But what if the kind of unsafety you’re dealing with is not undefined behaviour, but instead something else, like leaking crypto keys, or SQL injection?

A common complaint about rust is that it does nothing to prevent this. Which is true, but perhaps we could re-use the notion of unsafe for these things?

Distortion

2020 Dec 31 #art

When writing a box blur implementation, initially I had a fun bug where the rolling sum for values on the left were incorrect, since I did not include early values in the blur. It looks really cool so I kept the code for it.

If you just want to try it out on your own images, I wrote a JS version.

Below is the code, with the required fix commented out. This does a box blur on a single row of the image, with a specified width.

µ [sic]

2020 Nov 12 #art

here you go have a full on album ig,,,

as always source embedded in the files

music made with (a non-trivial amount of) C

2020 Nov 10 #art

There’s a better post to be made about making music with bitshifting but that post is still due to be released on the year of the linux desktop.

Volume Warning: Is reasonable on my machine. Check yours.

Source Code: Run strings on the file.

(Misusing) Python Unicode Normalisation

2020 Oct 24 #hack

After PEP 3131, python normalises identifiers in order to support non-ASCII identifiers.

That means that if you write 𝚠 = 50, where that character is U+1D6A0 MATHEMATICAL MONOSPACE SMALL W, you can later refer to that variable as w (or, indeed, anything that normalises into w).

So I wrote a program to randomly replace every character in some code with any character that normalises into it while trying not to break the program.

Custom literals in rust

2020 Sep 25 #hack

Ever wanted custom literals in rust? No? Too bad!

let x = "#123456": [[Color]];
// x is a Color

This runs at compile time. If the parser panics, you get a compile failure. Neat, huh?

This also doesn’t only work for strings. Any value known at compile time can be used. As long as you can do your processing in a const fn, it’s fair game.

URLs

2020 Aug 13

My requirements for URLs on websites, and what makes a good URL.

URLs MUST be stable. A link to a specific post, shouldn’t change what it points to 5 years down the line. Nor should it die, if the content’s still available but under a different name.

URLs SHOULD be user editable, and the parts that aren’t should be obviously opaque.

URLs MAY have immediately relevant information in them that isn’t strictly needed to resolve the URL.

How to fix cobalt.rs's feed showing only excerpts

2020 Aug 08

By default, the content in the RSS feed is the post description, then the excerpt (if it exists), and then finally the actual page content.

IMO, this is a bad default. If people want to read the first few paragraphs in a RSS reader but switch to my website to read the rest, they can do that. But I don’t want to force them to do that.

In any case, I’ve included a patch against cobalt.rs’s current master branch to just always use the page content, but still let you use the excerpt for other things, like page contents. And if you’ve not used my site’s RSS feed because it didn’t show full contents, you can use it now.

Formatting’s still a bit weird on my reader, but it’s usable.

My problem with git-annex

2020 Aug 07

I have a few problems with git-annex which lead me to stop using it (I’m running git annex uninit as I write this).

It’s close to what I want, but not quite there yet.

These suggestions are for a new system, not one based on git. And it may be biased towards what I tried to use git-annex for.

This new system should be usable to manage all user data on a system. That means it needs to be able to sync data too, and act as a backup system. My ideal system is one where all user data is versioned, and all system data is handled by NixOS, making a reproducible in 1 command system.

C#'s broken type system

2020 Jul 02 #rant

C# has a broken type system. And by that I mean the vast majority of function signatures that you write in C# are lies, and your function won’t be able to do meaningful work with all values that compile, and that there’s nothing you can do to fix this.

Order Preserving 2d Array To 1d Array Function

2020 Jun 27

Short post here, but I was interested in a problem and think I found a good solution to it.

The problem is: Write a function f that takes a 2 dimensional byte array (Vec<Vec<u8>>), and converts it into a 1 dimensional byte array (Vec<u8>) in an order-preserving way. Empty outer or inner vectors are allowed, and must order correctly. As little overhead as possible is ideal.

Use case is if you have a B-tree and want to query it using tuples instead of a plain key, and have ordering work correctly (as in, a bytewise comparison should give the same results as ordering the tuples do).

Thoughts On Distributed Issue Tracking

2020 May 27

Git’s a distributed code versioning system, but software projects are more than just code. We should be able to version our issues and pull requests in the same repo. When you clone a repo from one service (Say, GitHub), and push that repo to some other service (Say, a self-hosted git server), the code and all issues and pull requests / other items should be moved along with it.

Below I’ve written up some rough thoughts about how we should do this.

Moving to Neovim

2020 May 09

This is a hopefully small post about how I got from my vim setup to a neovim setup.

This does not keep the same config working on vim, and just copies over what I still need. Vim stays functional, they’re running on 2 completely separate configs.

Hello World

2020 May 08

Here’s my “initial commit” of my blog.

I think it’s a legal requirement or something for all blogs to have one.

Anyways, my setup is using cobalt, a static site generator in Rust.

Static site so that all the web server needs to do is be able to serve files from the file system. If it can do that, then I’m good.

Rust because lol borrowchecker go brrrrrr

I have a formatting test page over at /pages/formatting-test. The formatting of the site is liable to wildly change as I get feedback told it looks shit.

Other than that, hello! I’ve got a few post ideas that I will hopefully be posting shortly.

This website best viewed with scripts disabled