GeistHaus
log in · sign up

Yabir's blog

Part of yabirgb.com

stories primary
The New Dark Ages
Show full content

One of the fears that I have with our approach to AI and LLMs is the threat of creating a new Dark Age. I won't enter into the details of what caused the medieval Dark Ages or if they were indeed that "dark".

Commonly, the medieval Dark Ages are considered to have started right after the collapse of the Western Roman Empire. The Roman Empire provided stability, reducing the number of civil wars. The existence of an army that secured merchants in every corner of the empire allowed for successful, growing trade and provided security to the population.

When instability grows, society collapses. People left big cities and went to rural areas to be safe from incursions, the economy collapsed as there wasn't a safe way to transport goods, and knowledge vanished.

The Catholic Church preserved books and gatekept knowledge. Basically, if you weren't part of the church, you didn't have access to the knowledge.

My point of view is that we are living through something similar in modern times. Just as Rome crumbled under administrative bloat and an inability to maintain its borders, modern nations are struggling under the weight of economic fragility. We are seeing the collapse of the global economy due to high government debt. Politicians don't have incentives to fix the situation since they will lose support if they try to do anything. Spending money on things that make them look good (in front of the people who vote for them) is better for their careers. The way to break nations in our times is by breaking their economic base.

The other critical point is cultural tension. Even if you don't share my ideas, you can see how there is political tension that drives cultural tension.

Right now, LLMs are a source of truth for many people. We are becoming more and more dependent on them and rewiring ourselves to make use of them instead of reading books or original sources. At some point, we will forget how to research, and by the time we want to do anything, the knowledge will be gone.

Getting access to a book will be really complicated because there won't be many of them, and they will be reserved for the wealthy. You won't be able to download them because it is illegal (YOU ARE STEALING!!!!) and then your only source of information is LLMs that digest everything for you... until you can't afford to pay for them, and then you will have nothing.

It is a bit exaggerated, but I really feel that the chances are not zero. That puts fear in me. Something similar was developed by GeoHot in his blog. It is something more plausible and somehow similar to the idea that I've been maturing for a few weeks already.

As he said: Have you considered not participating? I would add that owning is more important than ever: gathering books, resources, and knowledge.

https://yabirgb.com/posts/dark-age/
How I feel about vibe coding
Show full content

LLMs have come a long way. Last year, you couldn't fully trust them, but right now they are very capable and can solve many problems faster than any human.

Personally, I use them to find bugs faster and prototype ideas that I can iterate on later. I also use them for repetitive tasks during refactors or for setting up the foundation for tests, finding fixtures, configuring them, and so on.

But that is the extent of my usage for now. It seems like the "trend" is to spawn a container, assign it a task, and let it run in "YOLO mode." Somehow that feels wrong to me because you no longer pay attention to what is being changed, the codebase becomes foreign to you. Code reviews aren't the same because if it "just works," you become lazy. LLMs generate code so fast that it's impossible to keep pace while fully understanding the logic. You can read it later and understand it, but by then, the code is already in the repo.

I'm under the impression that code quality is getting worse every day. While these might be extreme cases, just look at Boeing or Microsoft. It's not 100% due to LLMs, but it feels like software is becoming worst. For example, "obvious" errors like LLMs leaking private keys in GitHub repos are becoming more common. My overall impression is that while software can be built much faster now, people have lost the desire to craft something they are proud of. Now, it's more a case of: "if it works, it works."

At some point, you have to stop and think about whether you can trust open-source dependencies. If they contain vulnerabilities or are inefficient because they are the output of an LLM, they become a liability rather than a help.

LLMs are also shifting how open-source projects are sustained, for example, look at the recent drama with Tailwind.

The amount of code that can be produced in a certain span of time is no longer a limitation. We are transitioning to a world where the priority is solving real problems, and the better your code, the better the solution. It will be more important than ever to be the person who knows exactly what is happening, someone who can understand large codebases quickly, navigate them, optimize, debug, and generally be a "person of ideas".

I also wonder about the future of packages in NPM, crates.io, or PyPi. I suspect a more careful approach to adding dependencies will be key, something that Odin (a project I'm following) encourages.

We are in the middle of a revolution like the great ones of the past. We just need to survive and adapt.

It isn't only software that is changing, but other sectors too. Some websites are already closing (I know of a couple in Spain) because people don't read them anymore. Google gives you a summary on the search page, or people just ask ChatGPT or Gemini. Advertising will change, and so will our way of consuming media.

Personally, I'm a bit fed up with algorithmic timelines and how content is presented to me. Recently, I started consuming blogs via RSS/Atom, and I'm taking much more care with what I read and watch. I want to take control back and be the owner of my time deciding for myself what I want to consume and what I don't.

https://yabirgb.com/posts/vibe-code/
Collaborating in mozilla projects
Show full content

This last week I've been working on different projects at the mozilla repositories in github.

I enjoy working with other people in open source projects that I believe have a positive inpact. This is the case of the projects I had the oportunity to work on.

The one I'm more proud about is a little tunning I did to a struct used to create json request to an API. This is the commit. The reason I'm so proud about this one is that this one is my first rust commit to a project that is not mine.

Rust is a lenguage that I've played with earlier but never seriously and during this time at home I've been more serious with it.

Also I made a couple of contributions to domain_utils. As far as I know this library is being used in some serious projects and my help was good.

Lastly I cuntributed to bugbug a project to use AI to improve how mozilla handles bug reports. I'm happy with this one because let me learn something new, the struct module in python.

If you want to contribute to mozilla and don't know where to start I recommend you this page where you can filter by labels, for example good-first-issue.

https://yabirgb.com/posts/open-source-mozilla/
Arcade: A new static site generator
Show full content

I want to make a little post talking about Arcade, my latest public project.

The objetive was to create an easy to use static site generator that didn't require a complex installation process and let me quicly focus on just writting. Previously my blog was generated using hugo, but my biggest issue was that I needed to have go and install the dependencies. Whenever I wanted to write something it just happend that I didn't have the right tools installed and I had to go to the documentation and restart the installation process. Also go doesn't come by default in my system, so I have to worry about having it installed.

For this reasons I wanted to create something that was just plug and write and allowed me as much as hugo did.

The tooling

I went with python3 because most of the linux distros (if not all of them) bring python by default in the system and to install my package you only need pip and an easy

python3 -m pip install arcade-generator

and you have everything you need.

Capabilities

I did't want to lose some good things from hugo like:

  • command line utility
  • live server that shows changes after saves
  • easy script to create the basic folder structure
  • theme system

those are strong points that I believe every static site generator should have and arcade must match those.

How I did it

It surprised me because it was quite easy. In one afternoon I had more or less the basic code without much effort.

To read commands from the command line I used click wich I've used previously and makes everything related to command line tools consistant, conviniant and easy.

To get live previous of my files I used livereload. Again super easy to use and provided much all the features I was looking for.

To get my markdown text to html I use the markdown package. It supports many of the things you can imagine from markdown so it was the obvious decission.

On my side what I did was to track for changes the content and themes folder so every time something changes on disk the html files are updated. I provided basic functionalities like a most recent section, history of posts and configurable social icons.

Finally to make easy to use themes I use jinja so everything is passed to certain variables and the only thing left to do if you want a new theme is edit the templates.

There are 3 basic commands

  • init
  • watch
  • build

The last one builds all the html structure with the static content and prepares it in a folder ready to be uploaded.

The future

In the future I want to add more functionalities like integration with github-packages and optimizations in the source code.

Hope you enjoy it!

https://yabirgb.com/posts/arcade/
Creating a sepia filter with python
Show full content
Introduction

Last week I wanted to emulate the css effects in python on images. The filter that caught my attention was the sepia filter. I write this because I couldn't find much information about the topic on the web.

Basics

A quick search on your favourite search engine leads to this page where as mentioned in stackoverflow ([^1]) what you have to do is:

outputRed = (inputRed * .393) + (inputGreen *.769) + (inputBlue * .189)
outputGreen = (inputRed * .349) + (inputGreen *.686) + (inputBlue * .168)
outputBlue = (inputRed * .272) + (inputGreen *.534) + (inputBlue * .131)

The result is (Image by Andrea Ranalleta on Unsplash):

Coding this on python

With this information what you have to do is to ignore the alpha layer and for each pixel calculate a bunch of numbers.

You can use Pillow for this and then on your program:

from PIL import Image

def sepia(image_path:str)->Image:
    img = Image.open(image_path)
    width, height = img.size

    pixels = img.load() # create the pixel map

    for py in range(height):
     for px in range(width):
         r, g, b = img.getpixel((px, py))

         tr = int(0.393 * r + 0.769 * g + 0.189 * b)
         tg = int(0.349 * r + 0.686 * g + 0.168 * b)
         tb = int(0.272 * r + 0.534 * g + 0.131 * b)

         if tr > 255:
             tr = 255

         if tg > 255:
             tg = 255

         if tb > 255:
             tb = 255

         pixels[px, py] = (tr,tg,tb)

    return img

Here I'm assuming that the image is a jpeg, but in case of a png is similar but taking care of the alpha layer. This is easy, but very slow, so ... how can this be faster?

My next search was for applying filters to images and I discovered cv2. Scrolling fast the docs I wrote this:

import cv2
import numpy as np
from PIL import Image

def sepia_cv(image_path:str)->Image:
    """
    Optimization on the sepia filter using cv2
    """

    image = Image.open(image_path)

    # Load the image as an array so cv knows how to work with it
    img = np.array(image)

    # Apply a transformation where we multiply each pixel rgb
    # with the matrix for the sepia

    filt = cv2.transform( img, np.matrix([[ 0.393, 0.769, 0.189],
                                          [ 0.349, 0.686, 0.168],
                                          [ 0.272, 0.534, 0.131]
    ]) )

    # Check wich entries have a value greather than 255 and set it to 255
    filt[np.where(filt>255)] = 255

    # Create an image from the array
    return Image.fromarray(filt)

What is happening here is that the previous sums and products are no more than a linear transformation between subspaces of the reals, so we can represent this as a matrix. But loading cv2 and numpy for this is too much so let's just use numpy.

def sepia_np(image_path:str)->Image:
    """
    Optimization on the sepia filter using numpy
    """

    image = Image.open(image_path)

    # Load the image as an array so cv knows how to work with it
    img = np.array(image)

    # Apply a transformation where we multiply each pixel
    # rgb with the matrix transformation for the sepia

    lmap = np.matrix([[ 0.393, 0.769, 0.189],
                      [ 0.349, 0.686, 0.168],
                      [ 0.272, 0.534, 0.131]
    ])

    filt = np.array([x * lmap.T for x in img] )

    # Check wich entries have a value greather than 255 and set it to 255
    filt[np.where(filt>255)] = 255

    # Create an image from the array
    return Image.fromarray(filt.astype('uint8'))

In this solution take care of ([^2])

Improving the filter

In CSS you can apply an scale to the filter. After searching a lot I found this link where it specifies how to apply the filter using this scale. The thing is that aside the linear map, you are using a movement. The transformation matrix is:

    matrix = [[ 0.393 + 0.607 * (1 - k), 0.769 - 0.769 * (1 - k), 0.189 - 0.189 * (1 - k)],
    [ 0.349 - 0.349 * (1 - k), 0.686 + 0.314 * (1 - k), 0.168 - 0.168 * (1 - k)],
    [ 0.272 - 0.349 * (1 - k), 0.534 - 0.534* (1 - k), 0.131 + 0.869 * (1 - k)]]

where k is the interval [0,1].

Here are some examples:

  • Sepia with amount = 0 (original image)

  • Sepia with amount = 0.3

  • Sepia with amount = 0.7

  • Sepia with amount = 1 (the same filter we created initally)

Measuring times

Calling python -m cProfile test.py (cProfile) with my Pentium G3258 on the image used in this post (2453x2453 pixels):

    ncalls  tottime  percall  cumtime  percall filename:lineno(function)

         1    0.007    0.007    0.293    0.293 test.py:34(sepia_cv)
         1    0.033    0.033    0.499    0.499 test.py:56(sepia_np)
         1    7.857    7.857   16.634   16.634 test.py:7(sepia)

This times don't count the time importing the modules used.

https://yabirgb.com/posts/sepia_filter/
Using Oracle DB in Ubuntu without dying
Show full content
Introduction

At my subject of fundaments of databases we use Oracle as database (yes I hate it). I don't have a windows machine and installing all the stuff from oracle to make my exercises is pure pain to me. So this is a guide to have fun while installing it.

What we are going to use is docker to put in a container Oracle XE and we'll install Oracle SQL Developer.

You need an account in the Oracle system to download this tool.

Install dependencies

We need to install docker. A guide for your system can be found in it's offcicial webpage. At the side nav you can find your distro.

Probably you'll need to add your user to the docker group. As described here , you can do it with

sudo usermod -a -G docker $USER

(you will need to log-out and log-in back or reboot your computer so the changes takes effect. If you used snap to install docker follow this steps )

Once you have docker installed we'll use a docker image for the Oracle XE. The one I used is this from wnameless.

What you need to do is

docker pull wnameless/oracle-xe-11g

this will download the container and then run it

docker run -d -p 49161:1521 wnameless/oracle-xe-11g

The last one will run the database listening on port 49161. As described in the container page the details for the db are

hostname: localhost
port: 49161
sid: xe
username: system
password: oracle

This method is clean and your computer won't be filled with dependencies and things that at least I'm not going to use soon (or atleast I don't want).

To install the Oracle SQL developer I followed this guide where what you need to do is

  1. Install java if you don't have it

    sudo add-apt-repository ppa:webupd8team/java
    sudo apt-get update
    sudo apt-get install oracle-java8-installer
    sudo update-alternatives --config java
    
  2. Download SQL Developer from the official page

  3. Extract files

    sudo unzip sqldeveloper-*-no-jre.zip -d /opt/
    sudo chmod +x /opt/sqldeveloper/sqldeveloper.sh
    
  4. Create a symbolic link to the app

    sudo ln -s /opt/sqldeveloper/sqldeveloper.sh /usr/local/bin/sqldeveloper
    
  5. Edit the start script at /opt/sqldeveloper/sqldeveloper.sh so it contains

    #!/bin/bash
    unset -v GNOME_DESKTOP_SESSION_ID
    cd /opt/sqldeveloper/sqldeveloper/bin && bash sqldeveloper $*
    
  6. Run sqldeveloper

    sqldeveloper
    

You can create a icon in your launcher too but we aren't not using this again so.

You can stop the docker container using the stop option. To list your containers use docker ps.

After this you can configure SQL Developer to connect on port 49161 with the credentials provided and you

Note: If the cursos is not showing in the SQL Developer go to

Tools > Preferences > Code Editor > Fonts

and chage the font size (I use 14)

https://yabirgb.com/posts/oracle-xe/
Looking back: Summer 2018
Show full content
What did I do / What I'm doing
  • I'm getting federation ready for my project Anfora.
  • I traveled to Berlin and Morocco.
  • I'm re-learning rust and taking it serious.
  • Deployed a mastodon instance using docker.
  • I've send my CV for some intenships the next year.
  • Finally installed from zero arch in a dual boot. I had problems with my network card not being compatible with something and I rolled back. I'm using i3 wm.
Links

I've colected various links this summer:

Videos
https://yabirgb.com/posts/2018-summer/