HNHacker News
TopNewBestAskShowJobs

scaladev

726 karma · joined October 20, 2020

submissionscomments
scaladev··on Gradle 7.0
These days you can write build scripts in Kotlin. It provides proper type checking and better auto-completion.
scaladev··on End of support for Firefox on Amazon devices
Desktop Windows won't run there directly (but works just fine virtualized under qemu, I should add). It's a pretty typical all-in-one SoC, but with an x86 core:

https://ark.intel.com/content/www/us/en/ark/products/75203/i...

But I can copy statically linked binaries from my main Linux machine, and they work. (Dynamically linked typically don't because Android userspace is so different from "proper" Linux.)

scaladev··on Ask HN: What to use instead of Bash / Sh for scripting?
Thanks for the suggestion. Adding these flags halves the startup time:

  $ time ./pwsh -NoProfile -NoLogo <<<'' >/dev/null

  real 0m0.456s
  user 0m0.388s
  sys 0m0.040s
Much better, but I still wouldn't use this even as an interactive shell, as I open a few hundred terminal windows each day.

There's no defender (or anything similar) on that other machine. It also has an SSD. With an older HDD powershell started in about 10-15 seconds there (while cold startup time for bash was something like a second, and instantly afterwards).

scaladev··on End of support for Firefox on Amazon devices
The latest version works fine on my x86 phone with Android 5.
scaladev··on Ask HN: What to use instead of Bash / Sh for scripting?
I just checked, if you already have .NET installed, the powershell package is about 20 MBs, which is… tolerable. However, I see that the latest version still starts very slowly compared to *nix shells (and also Python).

The shell was running from tmpfs (so basically a RAM disk). I have a decent processor and an NVMe SSD, and this is what I see (it was tested 10 times in a row to pull everything into the page cache properly, and the numbers are pretty stable):

  $ time ./pwsh <<<"" >/dev/null
  
  real 0m1.050s
  user 0m1.464s
  sys 0m0.067s
More than a second to execute an empty 'script', and even longer to get to the interactive prompt (which is harder to time properly so I'm not publishing any numbers).

It's even slower on an older Windows laptop which I have lying around (starts in about 3-4 seconds). Absolutely terrible for an interactive shell/script execution engine.

Just for comparison's sake, the same laptop can run an empty bash script in 2-3 milliseconds. This is very important when running build jobs, for example.

scaladev··on uBlock Origin works best on Firefox
I see lots of comments here assuming absolutely everybody uses Chromium-based browsers. The Firefox "cult" (which I have been a part of since 1.5) is a bubble inside a bubble.
scaladev··on Surprisingly Slow
One can enable compression by default for all ssh connections by adding

  Compression yes
to ~/.ssh/config

It can pipe many megabytes of text output per second on relatively slow channels (`ssh -vv` prints the total data transfer when you close the connection), as long as it's not encrypted or unable to be compressed for some other reason (which is pretty rare for text output).

Scrolling very large files in vim becomes much faster, for example.

scaladev··on LG is getting out of the mobile phone business
>removable batteries aren't that important now

If you like throwing out your phones every two to three years, then sure.

scaladev··on Egypt demands over $1B in damages after Suez Canal blockage
Did you not read TFA?

> the Ever Given and its some $3.5 billion worth of cargo would not be allowed to leave Egypt

scaladev··on Japan's cherry blossom 'earliest peak since records began'
>think of this as the coolest year for the rest of your life

As someone who had to suffer through −40-45°C winters all my life, I can live with that. I don't know if it's due to climate change, but this winter was pretty tame. Only a few −40°C days in total, not three to four weeks as it always had been previously.

scaladev··on The Deno Company
> It just exists because JavaScript developers don’t want to learn something new.

Are you sure? I started building a desktop application recently. As much as I abhor Electron and refuse to touch anything built on top of it, there basically wasn't any other choice due to the absolutely massive amounts of libraries written for the web. I threw a couple of them in and it saved me at least 90% of work compared to what I would have to do if I'd chosen Qt (or anything else native). Would I rather spend a week and have something to show to my client, or roll up my sleeves and re-implement everything myself (which would take about half a year before I'd have anything working at all)?

(For the record, I didn't downvote you. I consider it a shitty practice to downvote somebody for their opinion, without even replying.)

scaladev··on Developer tools can be magic but instead collect dust
Don't forget there are a couple hundred countries besides US. I make a relatively decent living by our standards, but nowhere near close to $100k/year. $150-250 per year is quite a bit of money for us.
scaladev··on Fairphone suggests Qualcomm is the biggest barrier to long-term Android support
Jesus, what a pain. Why the hell do you need to wait for your proprietary OS vendor or BIOS vendor to update anything? On Linux the kernel does that for you, just configure your bootloader to point the kernel to a microcode image and that's it. Why can't windows do the same?
scaladev··on How GitHub Actions renders large-scale logs
vim does this too. If it hangs on you when opening a very large file, don't hesitate to press Ctrl+C. It does not terminate the whole process, but aborts the syntax highlighting, and the editor becomes very snappy.
scaladev··on Funds for Open Source
TBH I have absolutely no desire to pay taxes for yet another JavaScript framework. I'd be happy to set aside, say, 5% of my monthly salary to be divided between the applications and libraries I actually use. (I do something like this, but manually and pretty unfairly, because it's difficult to cover thousands of projects with any meaningful sum as I don't have billions in my banking account).

The OS of my choice has this:

https://pkgstats.archlinux.de/

although it would probably be easy to inflate these numbers if your income depended on it.

scaladev··on Japanese typography: Kilograms of sinograms
>there's a bunch of stuff that kind of looks like it would make sense when reading a Chinese word in Japanese, but turns out there's a lot of meanings are very different

As someone who knows nothing of the Japanese language beyond the very basics, I found these videos quite entertaining:

https://www.youtube.com/watch?v=-E6vHCT0wpw

https://www.youtube.com/watch?v=rzJqXd-1dEU

It looks like many characters are familiar to his respondents, but their combinations make absolutely no sense.

scaladev··on DeaDBeeF – A modular audio player for Unix-like systems
mpv also works fine as an image viewer if you don't view many high-res photographs (I don't).

https://github.com/mpv-player/mpv/issues/7983

scaladev··on Living Like It's 99, No Social Media, No Smartphone
> The cherry on top was to stop paying each year for a new smartphone, that does nothing more than the previous one

Why were you buying new phones every year? This is such a non-argument. I've been using the same Android phone for almost 7 years. It does everything I want it to do. Sure, I spent a couple of days trimming down the system, and carefully selecting applications (for example, the Google Clock from 2015 weighs about 3 MB and is very fast, while the same application from 2020 is about 30 MB and is extremely slow to start, despite having the same feature set).

scaladev··on Bitwarden_rs: Unofficial Bitwarden compatible server written in Rust
Did you try KeePassXC? It's much more actively developed and runs circles around the original KeePass:

­— it's a native application (starts instantly on less powerful machines)

— can check your accounts against haveibeenpwnd.com database

— has full browser integration which works flawlessly IME

— can store SSH keys and work as an SSH agent

https://keepassxc.org/

edit: it does not support synchronization, I misremembered. Sorry.

scaladev··on A curated list of .NET performance resources
>Can I expect non-UI .NET code to port well to Linux

If it wasn't written with tons of pinvoke to win32 or using Windows-only services (like WCF), then sure.

I've been building NET Core applications for Linux and exclusively on Linux for a few years now, mostly using Rider as the IDE. No complaints. I haven't seen any Windows-exclusive libraries worthy of any attention in all that time. Even libraries with tons of native code (like imagemagick) have Linux support.

The official MS tooling is behind what they offer on windows, but it's getting there. You can collect GC and memory dumps

https://docs.microsoft.com/en-us/dotnet/core/diagnostics/dot...

https://docs.microsoft.com/en-us/dotnet/core/diagnostics/dot...

traces:

https://docs.microsoft.com/en-us/dotnet/core/diagnostics/dot...

and here's the port of the veritable sos tool:

https://docs.microsoft.com/en-us/dotnet/core/diagnostics/dot...

scaladev··on Do not use redirection characters in your shell prompt
When pasting something to the terminal (especially if it's longer than one line or was copied from an untrusted source), I like this approach:

1. open your terminal emulator;

2. press Ctrl-X + Ctrl-E in a shell prompt;

3. it opens your $EDITOR, paste the command there, check it for anything unusual, then save and exit;

4. the shell runs whatever was in that script you saved.

scaladev··on FreeBSD 13.0 – Full Desktop Experience
I thought the original idea behind free software was to provide more freedom to the users (to thinker with, replace, and learn from said software), and not to pad the bottom line of a multi-billion dollar company by saving them the need to spend millions of man-hours building their own OS from scratch?

If GPL didn't force companies to contribute back, would Linux ever be where it is today?

scaladev··on Self-Hosting Git
You can disable registration (and authentication through third-party providers) if that's what you mean.

Personally I'd rather use gitea though. It has a more healthy development community (as in more than one developer) and is gaining new functionality at decent pace.

scaladev··on Can We Stop Pretending SMS Is Secure Now?
In my country you can easily buy a few thousand SIM cards for a cent or two each. I've seen them in classified ads, they're not even hiding.
scaladev··on Loss of myelin is one of the major factors of age-related brain deterioration
One course of an antibiotic might not "rot your brain", but one course of a corticosteroid certainly can.

https://en.wikipedia.org/wiki/Steroid_dementia_syndrome#Case...

I was on prednisolone for a couple of months a few years ago. I can't say I was very intelligent before that, but it's certainly took a toll on my memory and cognitive abilities. (No, it's probably not hypochondria, I didn't even know corticosteroids could have such consequences when I noticed the problem.)

scaladev··on Why are tar.xz files 15x smaller when using Python's tar compared to macOS tar?
>xz

It may not be ancient, but it's certainly not the greatest compression format out there. I found this article to be very informative:

https://www.nongnu.org/lzip/xz_inadequate.html

(The author worked on lzip so it's probably somewhat biased, but facts are facts.)

scaladev··on Systemd 248 RC3: systemd-oomd is now considered fully supported
If you're using systemd, drop docker and start your browser through something like this:

  #!/bin/sh

  systemd-run \
    --user \
    --scope \
    --property=MemoryHigh=4G \
    --slice=background \
    /usr/bin/firefox "$@"
Theoretically this does not prevent Firefox from using more than 4 GBs of memory (you need MemoryMax for that), but practically it does.

  MemoryHigh=bytes
    Specify the throttling limit on memory usage of the executed processes in this unit. Memory usage may go above the limit if unavoidable, but the processes are heavily slowed down and memory is taken away aggressively in such cases. This is the main mechanism to control memory usage of a unit.

  MemoryMax=bytes
    Specify the absolute limit on memory usage of the executed processes in this unit. If memory usage cannot be contained under the limit, out-of-memory killer is invoked inside the unit. It is recommended to use MemoryHigh= as the main control mechanism and use MemoryMax= as the last line of defense.
I use a similar script to prevent my torrent client from pushing more useful data out of the page cache.

You can put resource limits on basically anything (see systemd.resource-control(5)).

scaladev··on Wayland in 2021
I am a happy Wayland user, and have been for a long time. There are many more out there. You don't often hear us because we don't spend every waking hour shitting on Xorg and praising Wayland for how good it is (maybe we should?)

>I wonder if it will ever reach the adoption level of x11

It will, considering that Xorg is effectively no longer maintained and its developers have switched to working on Wayland protocols long ago, which they have stated on multiple occasions.

Somehow I doubt that the loudmouths you often hear will step up to maintain X.

scaladev··on Docker Security Cheat Sheet
All of these isolation techniques (and much more) can be used inside systemd units. Write your .service as usual, then run this command on it:

  $ systemd-analyze security service-name
It prints out a long list of hardening flags that can be applied inside of your service, like so:

    NAME                                                        DESCRIPTION                                                             EXPOSURE
   PrivateNetwork=                                             Service has access to the host's network                                     0.5
   User=/DynamicUser=                                          Service runs as root user                                                    0.4
   CapabilityBoundingSet=~CAP_SET(UID|GID|PCAP)                Service may change UID/GID identities/capabilities                           0.3
   CapabilityBoundingSet=~CAP_SYS_ADMIN                        Service has administrator privileges                                         0.3
  ...
Here's what I typically use for a .NET 5 application:

  WorkingDirectory        = /opt/appname/app
  ReadWritePaths          = /opt/appname/data
  UMask                   = 0077
  LockPersonality         = yes
  NoNewPrivileges         = yes
  PrivateDevices          = yes
  PrivateMounts           = yes
  PrivateTmp              = yes
  PrivateUsers            = yes
  ProtectClock            = yes
  ProtectControlGroups    = yes
  ProtectHome             = yes
  ProtectHostname         = yes
  ProtectKernelLogs       = yes
  ProtectKernelModules    = yes
  ProtectKernelTunables   = yes
  ProtectSystem           = strict
  RemoveIPC               = yes
  RestrictAddressFamilies = AF_UNIX AF_INET AF_INET6
  RestrictNamespaces      = yes
  RestrictRealtime        = yes
  RestrictSUIDSGID        = yes
  SystemCallArchitectures = native
  ProtectProc             = invisible
  CapabilityBoundingSet   =
  SystemCallFilter        = ~@clock @module @mount @raw-io @reboot @swap @privileged @cpu-emulation @obsolete
ReadWritePaths should be replaced with a combination of DynamicUser + writing local persistent data to $STATE_DIRECTORY, but I'm too lazy to do that yet.

See systemd.exec(5) for more.

scaladev··on Flameshot – Simple, powerful screenshot tool for all major operating systems
OBS Studio + some mechanism to connect it to your compositor.

For wlroots-based compositors like sway here's the most lightweight solution: https://hg.sr.ht/~scoopta/wlrobs

For mutter (GNOME): https://github.com/flatpak/xdg-desktop-portal + pipewire

← PreviousPage 2 of 6Next →