HNHacker News
TopNewBestAskShowJobs

auraham

1,929 karma · joined July 27, 2014

submissionscomments
auraham··on Awk One-Liners Explained
This is the kind of book that I'd like to read on my Kindle while commuting to work. However, the author only offers the book as PDF. I'd would be nice if other formats are also available, at least EPUB.

Right now, I am reading Django for Beginners [1] which is available in EPUB. I could read it in PDF but the experience will not be the same.

[1] https://djangoforbeginners.com

auraham··on Neovim: Plugins to Get Started
Wonder if vim plugins like vim.fugitive are compatible with Neovim, what is your experience?
auraham··on Git-Delta: Better Diffs
Demo https://www.youtube.com/watch?v=91p1Fp7Db5c
auraham··on Analyze Meta Tags with Elixir
Nice to see this kind of projects in Elixir. They help me discover libraries like finch and floki. I do not know them, but for what I understand from the post, they are similar to requests and beautiful-soup in Python.
auraham··on How to Convince Me That 2 + 2 = 3 (2007)
According to 1984, 2 + 2 = 3 could be possible if we shrink our language and mutate our history to the point that, in a few generations in the future, nobody could even think or remember that 2 + 2 = 4. If we remove "freedom" from our vocabulary, and simplify our language over the years, how can we know we are actually free if we cannot it find words to express what freedom means?
auraham··on Dotfiles Management
Related:

Using GNU Stow to manage your dotfiles (2022) https://news.ycombinator.com/item?id=32253018

auraham··on Code Smell of the Day: Type Keys (2021)
When I started reading the post, I though the author would talk about pattern matching to get rid of the switch block. In that case, creating a user can be expressed in Elixir as follows:

    def createUser(attributes, "admin") do
        create(attributes) |> setupAdmin |> setupNotifications
    end

    def createUser(attributes, "customer") do
        create(attributes) |> setupCustomer |> setupNotifications
    end

    # example
    User.createUser(%{name: "laura", age: 30}, "admin")
Here, we chain functions using a pipe, |>, assuming that each function returns a user-like variable, like %User{}

I also liked the idea of using a callback for decoupling code (although that approach was discouraged by many users in this post). It could be done in Elixir as follows:

    def createUserCallback(attributes, callback) do
        create(attributes) |> callback.() |>  setupNotifications
    end

    # example
    User.createUserCallback(%{name: "laura", age: 30}, &User.setupCustomer/1)
    User.createUserCallback(%{name: "laura", age: 30}, &User.setupAdmin/1)
Since callback can be any kind of function, we can use pattern matching to enforce that the return type of each function is a user, ie %User{}:

    def createUserCallback(attributes, callback) do
        user = %User{} = create(attributes)
        user = %User{} = callback.(user)
        user = %User{} = setupNotifications(user)
        user
    end
Another approach is using a @spec annotation to define the signature of the callback.

Full code:

    defmodule User do
      defstruct name: nil, age: nil, type: nil

      defp create(_attributes = %{name: name, age: age}) do
        %User{name: name, age: age}
      end

      defp setupNotifications(user = %User{}) do
        IO.puts("User created #{user.type}: #{user.name}")
        user
      end

      def setupAdmin(user = %User{}) do
        %User{ user | type: "admin" }
      end

      def setupCustomer(user = %User{}) do
        %User{ user | type: "customer" }
      end

      def createUser(attributes, "admin") do
        create(attributes) |> setupAdmin |> setupNotifications
      end

      def createUser(attributes, "customer") do
        create(attributes) |> setupCustomer |> setupNotifications
      end

      def createUserCallback(attributes, callback) do
        user = %User{} = create(attributes)
        user = %User{} = callback.(user)
        user = %User{} = setupNotifications(user)
        user
      end
    end
auraham··on Over-engineering an emoji webcam filter with a neural network
I think a (N, D) array can be used as a lookup table. Here, N is the number of emojies and D is the dimensionality of the color space (say 3 for RGB). Each emoji is converted to a D-dimensional vector by computing the dominant color. Then, we can take a D-dimensional vector from an input image and compute the closest emoji by using cosine similarity. To minimize the loss function, we can increase the number of dominant colors, so the table would be (N, DxM). In this case, each emoji is represented by M D-dimensional vectors, each one encoding a dominant color.
auraham··on Over-engineering an emoji webcam filter with a neural network
I think there is an algorithm for determining the dominant color in an image (in this case, in a emoji). I do not its name, though.

https://stackoverflow.com/questions/3241929/python-find-domi...

https://dev.to/producthackers/creating-a-color-palette-with-...

auraham··on Ruby-Nix: Generates reproducible Ruby/bundler app environment with Nix
There is a section called "Building a Docker image". Why do you need Docker if you are using Nix? It is like creating an environment inside another environment(?).
auraham··on Poll: What's the best laptop for Linux these days?
What distro are you using? I read somewhere in HN that the 12th gen is not recommended for Linux (previous gen was suggested instead).
auraham··on The Bitter Truth: Python 3.11 vs. Cython vs. C++ Performance for Simulations
Side note: Can somebody explain the difference between real, user, and sys? I understand that real is basically the time spent from start to finish (which can be affected by other processes), whereas user and sys consider the amount of time where the CPU was actually busy running a program (not waiting for other things like I/O). For example, what is the meaning of user and sys from this example? [1]:

    $ time wget https://download.virtualbox.org/virtualbox/6.1.28/virtualbox-6.1_6.1.28-147628~Ubuntu~eoan_amd64.deb

    real   0m8.515s
    user   0m0.125s
    sys    0m0.487s
According to [2], user + sys would be a better measurement than real for comparing Python, Cython, and C++.

[1] https://www.hostinger.com/tutorials/linux-time-command

[2] https://stackoverflow.com/questions/10265162/the-meaning-of-...

auraham··on XFCE 4.18
I have almost the same config as you. Wonder what distro you are using. I use Ubuntu 22.04 with XFCE and i3, installed in that order. However, I noticed that the file chooser for snap apps (firefox, chromium) does not work. Every time I want to save a file, a 'Save as...' dialog appear and when you start typing the file name, the dialog starts showing all file names that matches whatever your are typing (ie it triggers the file searcher).
auraham··on What is in a modern code editor?
Today I was very excited after installing Helix. I gave it a try and loved it. I liked the default theme, the select-before-action approach for editing text, the file chooser, too many good things out of the box. Then, I downloaded elixir-ls and started to notice some flaws. The LSP worked great after installing it. However, after a few minutes it stopped working, it just showed an error message. On the other hand, elixir-ls complained about "Elixir sources not found (checking in /home/build/elixir)". I did not find anything about that error message, maybe the LSP or Helix are "too new" for finding workarounds (keep in mind that the latest version of elixir-ls is v0.12).

I like to play with new toys. However, it's hard to find solutions for novel tech, though.

auraham··on Vim After 15 Years (2017)
> Here's the thing, the best part about it vim is that it is not slow (plus paired with a terminal emulator like kitty/wez/alacritty). When I type the characters actually appear on the screen as I type them.

I just noticed that ~/.vimrc adds a small delay, even if it is empty. This is the test case:

Create a file with about 10 emtpy lines and type:

    esc                 switch to normal mode
    gg                  go to the top
    ctrl + v, G         select all lines
    shift + i           switch to insert mode
    - line              just type something
    esc                 this will duplicate the first line until the end of the file
If you repeat the test case with no ~/.vimrc, you will notice that the lines are changed faster.
auraham··on Vim After 15 Years (2017)
This is the list of features (in Eclipse) that I'd like to use in Vim:

- Show in Breadcrumb to show the package name > class > function in the top of the editor

- Open Call Hierarchy to show all places where a class/variable is used.

- Show Type Hierarchy to show how a given class is derived from Object.

- Debug Shell for running snippets in the debugger.

I know that I can use grep or ag for some of them, but I rather prefer to see the hierarchy as shown in Eclipse.

auraham··on Ask HN: Examples of Top C# Code?
Thanks for the repo! I love to compare programming languages side by side as you did. For example, a few months ago I was learning about Java streams, but they looked a bit convoluted to me, especially the collectors. Then, I reviewed the same concept in Elixir and then it was clear to me why the collectors are needed.
auraham··on Ask HN: Examples of Top C# Code?
Somewhat related, does anyone know of a repository than manages CRUD like Django models?
auraham··on TinyWM – A tiny window manager in around 50 lines of C
Wonder how hard could it be to add tiling support?
auraham··on From zero to 10M lines of Kotlin
The only thing that prevents me from using it is the license that shows up during installation. Has anyone read the license? The same applies to Dart (Flutter).
auraham··on An Industrial-Strength Audio Search Algorithm (2003) [pdf]
I read that paper many years ago. I loved it.
auraham··on Ubuntu 22.10 Kinetic Kudu
I've been using Ubuntu 22.04 for a while. These are my complaints:

- The login page (gdm3) does not detect when I touch the touchpad. I need to press it hardly to get a click. I read somewhere that it is a feature for tablet-like devices.

- For some unknown reason, gdm3 is listening for click events. As a result, I cannot use my touchpad in i3. The only fix I've found is to install Xubuntu. So I end up installing Ubuntu, i3, and Xubuntu in that order. The login page of Xubuntu (lightdm) does not mess with the touchpad in i3. You can say, just install lightdm alone. However, that does not work, though.

- Regarding snaps, my only complaint is the file dialogs of Firefox (file chooser, save as...) in i3. Again, some process is capturing events. Every time I want to type a file name when saving a file, the dialog instead trigger the autocomplete menu. So instead of typing the name for saving the file, the dialog shows me file matches. Very annoying. That only happens in i3.

auraham··on Why Rust?
I've heard about Web Assembly/Wasm many times. I thought it was a new kind of JS framework, so I did not pay attention since I am not a JS developer. However, after seeing the egui.rs demo [1], I was impressed! Now, I am interested in knowing more about programming languages that compiles to Wasm. Is it possible to create that sort of UI using other programming languages?

[1] https://www.egui.rs/

auraham··on Lite: A lightweight text editor written in Lua
I would like to know more details about how the UI is build. So far I have found this [1]. A tutorial-like post will be welcome, though.

[1] https://rxi.github.io/lite_an_implementation_overview.html

auraham··on Tauri in 100 Seconds [video]
These days I've been looking for options in the desktop-apps field. We have .NET Framework (Windows only), Wails (Golang + JS), Tauri (Rust + JS), Electron (JS), Flutter (Dart), just to name a few. My main concern with all these technologies is which one should I use? Many of these tools rely on JS. Despite the fact that JS has many flaws, I do not like the idea of using JS (Vue, React, etc) for the UI. I rather prefer to do both backend and frontend using the same language.

I would like to use a tool like Tauri or Wails that relies on Python and that let me choose the underlying framework (Django, Flask, etc). That will be great for packaging a web application as an executable.

auraham··on Vectors are over, hashes are the future
Old post of Yann LeCun [1]:

> But another important goal is inventing new methods, new techniques, and yes, new tricks. In the history of science and technology, the engineering artifacts have almost always preceded the theoretical understanding: the lens and the telescope preceded optics theory, the steam engine preceded thermodynamics, the airplane preceded flight aerodynamics, radio and data communication preceded information theory, the computer preceded computer science.

[1] https://www.reddit.com/r/MachineLearning/comments/7i1uer/n_y...

auraham··on Structured concurrency and Lua
I skimmed the code example and although I understand that it spawn two tasks, the syntax is not so clear for me. I rather prefer the actor-based model of concurrency of Elixir/Erlang instead of async functions and Go channels. I somewhat biased, though.
auraham··on Simplest Backpropagation Example
Broken link
auraham··on Ask HN: Name 3-5 books that had the most impact on your career and knowledge?
> * Beyond Java, by Bruce Tate

> Convinced me to leave Java and start doing Ruby instead. Did a lot more programming languages since then.

So you did not like the book?

auraham··on Hacker News stylized as a retro 90s macOS desktop
I was about to say that :/
← PreviousPage 3 of 8Next →