![avatar](/images/avatar.png)
My cool blog
“We have two ears and one mouth so we can listen twice as much as we speak.” - Epictetus
Contact 🔗Hello, please contact me through any of the following services:
email: daestrada@pm.me Mastodon: @diegoest@mstdn.social Matrix: @daestrada:matrix.org Presence 🔗 Student at the Department of Computer Science at Universidad de Puerto Rico, Recinto de Río Piedras Git: https://sr.ht/~diego-est/ ORCID: https://orcid.org/0009-0000-6779-8166 Association for Computing Machinery member since June 2024 LinkedIn: in/diego-alejandro-estrada-rivera/ Twitter: @SunglYou Instagram: @dart.
The Code 🔗int main() { int a, b; auto _0 = +[]mutable{}; decltype(_0) _[] = {_0,_0}; a = *(int*) +_0; b = *(int*) +0[_]; b = ([&]<auto >-> auto{_0(-[] ->auto{});}, b >> (sizeof(_0) - b)); a /= !(!(int*)&[_,_0]{0[_](),[__=&_0]() -> auto{(*__)();};}) * b; char str[] = {a+=a-b,a-=b+1,a+a-3}; std::cout << str << std::endl; } Let’s walk through this…
We declare two variables a and b. We initalize a variable _0 with a pointer to an empty mutable lambda.
Context 🔗I had been trying to figure out a more efficient way of backing up directories on my computers. For example, I have a huge directory where my Obsidian vault lives. This vault is filled with a bunch of pdf and markdown files that I use for my everyday notes. I do like keeping this folder backed up in case my laptop or PC dies.
The way I would backup this folder was by simply turning it into a GitHub repo and uploading everything privately to my GitHub account.
The Prompt 🔗From Bartosz Maliszewski’s “Category Theory For Programmers”:
2.7 Challenges:
Define a higher-order function (or a function object) memoize in your favorite language. This function takes a pure function f as an argument and returns a function that behaves almost exactly like f, except that it only calls the original function once for every argument, stores the result internally, and subsequently returns this stored result every time it’s called withh the same argument.
Intro 🔗After a grueling five hour match our team couldn’t solve a single exercise. We were very out of it at the end and just couldn’t find a way to solve any of the exercises. Even though the exercises were pretty hard some of our solutions were indeed correct but couldn’t beat the time limit they gave us for those exercises. For example one of the exercises was to find out all the numbers between 2 and N that fit the following description:
Following last week’s ICPC contest I spent all week trying to make a C++ matrix class template we could use for the commpetitions.
The problem was a very basic fibonacci-like recurrence relation of the form:
f(n) = f(n-1) + f(n-2) + 2 * n * n + 5
The main issue with this was the fact that the largest input size was 10^18. Computers on average (mildly lower than average nowadays) can do around 10^8 cycles per second.
Mandelbrot fractal research repo
Why? 🔗I’ve refactored this piece of code like 6140275936420759697 times so here’s the collection of all those efforts.
How? 🔗The C directory has everything you need for a 100% portable version to generate on whatever piece of hardware you want.
nobuild courtesy of tsoding at:
nobuild The c++ directory has three sub directories. mandelbrot/ has my first c port from:
The Coding Train mandelbrot-gamma/ using openmp for multithreading; a very optimized version of that same code mandelbrot-lambda/ is in the works but it’s supposed to be the same as mandelbrot-gamma but using lambdas
I accidentally deleted it :P
Colors 🔗I used pywal to generate this colorscheme, feel free to do the same.
pywal GitHub Black: #222F30 Grey: #A59D9C Red: #86999B Green: #86A78F Yellow: #8592A5 Blue: #87B0AF Magenta: #B0A7A9 Cyan: #DCBCB6 White: #EDE1E0 Fetch Program 🔗Provided is a rust crate called fetch with a basic template to make a hard-coded fetch program. (That’s the one I used for the screenshots.)
The program displays:
UserName@HostName Distro ~ DistroName Shell ~ ShellName Term ~ Terminal WM ~ WindowManager ▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅ So simply modify the variables in the source file to fit your setup and cargo build --release to get the binary.
rdbm is a rust program for getting and setting a custom ron resource file.
Similar to .Xresources, rdbm will create a resources.ron in your ~/.config/ directory.
You can then use rdbm to set multiple “key-value” pairs similar to .Xresources.
In this case rdbm aims to replace xrdb.
ron Documentation xrdb Information Documentation 🔗Here is a short preview of each subcommand:
View Current Resource File 🔗rdbm all Set a Key-value Pair 🔗rdbm set "color0" "#222F30" Get a Value 🔗rdbm get "color0" Rdbm Help Page 🔗rdbm --help rdbm help rdbm set --help Project Goals 🔗 Remove entries Get/Set multiple values Custom resource.
As I had mentioned in my past blog about the Mandelbrot Research Repo “I’ve refactored this piece of code like 6140275936420759697 times…”, so I guess that makes it “6140275936420759697” plus one.
This time around I finalized the implementation for a Canvas class that collects all the pixels you want and writes to a file you give it. By making it a class it is now much easier to work on the underlying byte buffer without having to get your hands dirty.