HNHacker News
TopNewBestAskShowJobs

alkh

214 karma · joined March 2, 2023

submissionscomments
alkh··on Small Archives
While I haven't personally tried it myself, ArchiveBox seems to be tailored specifically for archiving[1]. Mb you should give it a try? [1]https://archivebox.io/
alkh··on fd: A simple, fast and user-friendly alternative to 'find'
Imo, everyone should check https://terminaltrove.com/ from time to time. There, I have found easy replacements to commonly used tools:

find -> fd, time(for runtime comparison) -> hyperfine, grep->ripgrep, asciinema + converting to .gif -> t-rec[1], manually creating convertional commits -> koji[2], etc.

[1]https://terminaltrove.com/t-rec/ [2]https://terminaltrove.com/koji/

alkh··on The features of Python's help() function
When parameter names are meaningless for the final result

  def abs_days_difference(date1, date2, /):
    # note that swapping passed params will yield the same result

    delta = abs((date2 - date1).days)
    return delta

  d1 = date(2023, 1, 1)
  d2 = date(2024, 1, 15)
  abs_days_difference(d1,d2)==abs_days_difference(d2,d1)
The function returns the absolute diff in the number of days, so date1, date2 are meaningless variable names. It looks like then introduce an order(could #1 be the earlier date, while #2 be the later one?). If you don't get users any options it is clear that the order is meaningless

Compare with

  def day_difference(earlier_date, later_date):

    delta = (later_date - earlier_date).days
    return delta
Note that now

  d1 = date(2023, 1, 1)
  d2 = date(2024, 1, 15)
  day_difference(d1,d2)!=day_difference(d2,d1)
If you function signature is day_difference(date1, date2,*) you have to specify params as kwargs only, removing the confusion:

  d1 = date(2023, 1, 1)
  d2 = date(2024, 1, 15)
  #this now doesn't work
  day_difference(d1,d2)
  # this works and is much clearer for caller
  day_difference(earlier_date=d1,later_date=d2)
alkh··on Why “alias” is my last resort for aliases
Yeah, it's very convenient. Here are a few of mine(tested on OS X):

  alias -g L="| less"
  alias -g T="| tee"
  alias -g C="| pbcopy"
  alias -g @all="> /dev/null 2>&1"
  if command -v rg > /dev/null; then
   alias -g G="| rg"
  else
   alias -g G="| grep"
  fi
alkh··on Why “alias” is my last resort for aliases
I have an alias reload="exec zsh" for fast reloading. Admittedly, this does wreck up everything set up locally but I doubt you will be modifying ~/.[zsh|bash]rc file often
alkh··on Why Vermont farmers are using urine on their crops
Unfortunately, poop and urine is one of the main reasons for soil contamination by Perfluoroalkyl and Polyfluoroalkyl Substances (PFAS).[1] [2] . I think farmers will have to rethink using those as fertilisers soon

[1] https://www.nytimes.com/2024/08/31/climate/pfas-fertilizer-s... [2] https://www.npr.org/2024/03/28/1241473455/pfas-forever-chemi...

alkh··on Show HN: Benchmarking VLMs vs. Traditional OCR
What is the best solution for recognizing handwritten text that combines multiple languages, especially in cases where certain letters look the same but represent different sounds? For example, the letter 'p' in English versus 'р' in Cyrillic languages, which sounds more like the English 'r'.
alkh··on Amazon now discloses you're buying a license to view Kindle eBooks
Thanks for the useful link! I guess I am being overly paranoid, but I always also add a virus total check on top of it to make sure the file is clean [1] [1] https://www.virustotal.com/gui/home/upload
alkh··on Lynx Browser: The Land That Time Revived (2022)
To add a few cents, I just tested it and it seems mandatory nowadays to add --display_charset=utf-8 option if you are viewing non-english websites. Otherwise, lynx seems to be converting non-ascii chars into ascii. [1] [1] https://stackoverflow.com/questions/51548306/lynx-utf-8-supp...
alkh··on Bzip3: A spiritual successor to BZip2
Hey, I didn't confuse them but I guess I should have been more specific. I've addressed 2 main points in my text. 1) In my opinion, for the vast majority of cases you don't need to be worried about comparability, as you can easily install better alternatives to gzip for platforms a lot of people use. 2) I think zstd can become a primary replacement for gzip due to its high speed of compression and good compression ratio, even when compared to such great algorithms like xz/lzma. Sacrificing some compression ratio for (de)compression speed is worth it, for me at least
alkh··on Bzip3: A spiritual successor to BZip2
I am a huge proponent of zstd after I learned about it on HN. I've recently had to compress a 12 Gb csv file. zstd took ~3 sec for compression and ~11 sec for decompression and got the file to ~1.1 Gb. Xz took ~3.5 min for compression(!) and the resulting file was ~740 Mb(I didn't measure the decompression time). I just realized that in most cases it's more efficient to use zstd, especially for file transfer.

The majority of OS that people use either have it installed or can be trivially downloaded to, so I see no point in using gzip nowadays, unless it is mandated by API

alkh··on Bitwarden is turning 2FA on by default for new devices
Today, I almost had a heart attack cause I couldn't log in into BW Web. Strangely, both mobile and Desktop versions worked fine with the same password... The issue resolved automatically in a few hours, still no idea what this was.

Still, I backed up my passwords as soon as I logged into the mobile app, so like some people here say I highly recommend everyone do periodic backups and not be like me (:. I would have lost everything if something did happen to my vault access

alkh··on C is not suited to SIMD (2019)
I thought you could simply add `restrict`[1] to indicate that only one pointer points to a specific object? Shouldn't this help?

[1]https://en.cppreference.com/w/c/language/restrict

alkh··on Show HN: Habby – A straightforward bullet journal with habit tracking
Just gave it a try, looks promising for sure. What I don't get is how to add more habits. Are you only allowed to keep 3 by design or am I missing something?
alkh··on Conda: A package management disaster?
+1. On top of that, even with the new resolver it still takes ages to resolve a dependency for me, so somethimes I end up just using pip directly. Not sure if I am doing something wrong(mb you have to manually tweak something in the configs?) but it's pretty common for me to experience this
alkh··on Problems with Python dependency management
Would recommend you to install pyenv[1]. It was very useful when my team had to update a lot of projects using <=3.10 to 3.11 [1] https://github.com/pyenv/pyenv
alkh··on Tenstorrent and the State of AI Hardware Startups
Kudos to the Tenstorrent team for being so open to having a discussion. I wish more companies would be like that, as constructive criticism is very useful, especially for a startup
alkh··on Linux EFI Zboot Abandoning "Compression Library Museum", Focusing on Gzip, ZSTD
As far as I can tell, one of zstandard's main benefits is compression/decompression speed. Is the ratio still worse than xz though?
alkh··on Interview gone wrong
In my mind,I just automatically translate a EXPRESSION1 b EXPRESSION2 c as (a EXPRESSION1 b) and (b EXPRESSION2 c), so there's no ambiguity. But I agree, it can be very confusing,so I tend to write code that is easy to read without being a master. For example, what would have guessed this evaluates to:

False is False is False. If you thought, True, you were right :)

I would recommend to take a look at one of my favourite repos for more[1].

[1]https://github.com/satwikkansal/wtfpython

alkh··on Notepad++ is 21 years old
Is there anything similar and lightweight that is cross-platform(or at least is available both on Linux and OS X)? I am not a Windows user, so that's a secondary priority for me
alkh··on The Shell Hater's Handbook (2010)
Thanks for reminding me about this gem! :)
alkh··on Overengineering a way to know if people are in my university's CS lab
In my university you could technically use any computer but must ensure that your code would work/compile on lab PCs cause that's where TAs would check it. As a result, during labs most people would just use computers there(too much hassle otherwise)
alkh··on Overengineering a way to know if people are in my university's CS lab
I swear to God that all of these CS labs at different unis look the same. I am getting flashbacks of labs in Toronto that looked exactly like pictures in the post
alkh··on Microsoft BitNet: inference framework for 1-bit LLMs
Sorry for a stupid question but to clarify, even though it is a 1-bit model, it is supposed to be working with any types of embeddings, even taken from larger LLMs(in their example, they use HF1BitLLM/Llama3-8B-1.58-100B-tokens). I.e. it doesn't have an embedding layer built-in and relies on embedding provided separately?
alkh··on I'm Peter Roberts, immigration attorney who does work for YC and startups. AMA
Just to chime in, what's the situation with getting an H1B visa for a Russian Citizen? Are there similar issues or is it still possible to get one?
alkh··on Started a guide to writing FUSE filesystems in Python
To be honest, I knew about the speed limitations of sshfs already, so I typically use rsync to work with large files. This way, I wouldn't write the data locally even if the connection fails. I've checked the github repo and it looks like there are a number of issues related to network timeout that hasn't been addressed for a long time[1]. However, I mostly used it on OS X, so my experience might be different from yours Thanks for the info as well, I was under the impression sshfs was under active development (: [1]https://github.com/libfuse/sshfs/issues/77
alkh··on Started a guide to writing FUSE filesystems in Python
I've recently discovered sshfs and learned about needing to have FUSE as a dependency for OS X, which spiked by interest. The code looks very clean and easy to understand, so thanks for that! Is there any guide/course you would recommend for the introduction to FUSE? It looks like all you have is to provide implementations to certains functions your filesystem will use but it's hard without knowing the details(ex. I wouldn't know I had to implement readdir without your code, and so on)
alkh··on Show HN: Screensavers for your terminal (Bevy/Ratatui)
I am personally using https://github.com/st3w/neo (from the Matrix) as my screensaver. Feels good to feel yourself looking at that side of the world from time to time :)
alkh··on Coffee Stats – Maximize Caffeine Intake and Get to Bed at Night
Makes sense, thanks for the confirmation! :)
alkh··on Coffee Stats – Maximize Caffeine Intake and Get to Bed at Night
I had a similar idea to track my caffeine intake(assuming that the half-life is 6 hours). The only question I haven't had time to look into yet is what is the biological effect of previously taken vs newly taken caffeine? Say I had a cup of coffee at 9 am and then have another one at 9+6 hours=3 pm. Assume that 1 cup of coffee has 90 mg of caffeine. Does it mean that at that moment, I will have to track 2 different half-lifes? That is, I have 90/2=45 mg of caffeine from cup #1 and 90 mg of caffeine from cup #2 at 3 pm. Should I just add those up and track the combined amount now or should it be kept separate? I am leaning towards the latter because I think that the effect(i.e. alertness) will be higher with the newly digested caffeine and not the one taken 6 hours ago? No idea how true this is though as I am not a biologist :)
← PreviousPage 3 of 4Next →