HNHacker News
TopNewBestAskShowJobs

asamarin

106 karma · joined July 27, 2015

[ my public key: https://keybase.io/asamarin; my proof: https://keybase.io/asamarin/sigs/Es7-TtDFitBSncPtX8Ak0gceeaIOhCPgvPqOVUtM52o ]
submissionscomments
asamarin··on VisiData in 60 Seconds
Not sure about saving but, more importantly for me, it can read sqlite DBs, which has been a godsend whenever I need to take a quick glance at some random DB just to see what kind of tables it holds and what does the data look like. I know my SELECTs but I can't, for the life of me, remember what are the commands to check schemas and DB metadata on sqlite ("Was it .describe? Maybe .schema? Or perhaps \t? Gah, let's check the help once again..."), so knowing that visidata gets me there much faster feels good.

> Also looks powerful in it's own right

If you aren't convinced of that yet, I'd simply suggest to take a look at this lightning demo (~5 mins): https://www.youtube.com/watch?v=N1CBDTgGtOU

asamarin··on VisiData in 60 Seconds
> and they're not screenshots

That over there blew my mind, and I had to go back to the page to double-check that. And indeed, it's all clever CSS trickery. Digging further into the source, I found that this was generated using the ansi2html [1] library which I had never heard about before. Thanks for the TIL!

[1] https://github.com/pycontribs/ansi2html

asamarin··on Taking PHP Seriously (2016)
Article written in 2016, mind you
asamarin··on Renaming files with mv without typing the name two times
The latest addition to my renaming-toolbelt has been `perl-rename'. This thing is just wonderful: I can unleash all the power of perl-based regexes to rename things in bulk.

Case in point: I had a directory containing thousands of .jpg images imported from a foreign filesystem, and all of those files had tildes in them, something like:

  $ ls -1
  EL+�CTRICO_0001.jpg
  EL+�CTRICO_0002.jpg
  EL+�CTRICO_0003.jpg
  ...
You get the idea; note those ugly unrepresentable characters over there. On the original filesystem they read as "ELÉCTRICO", but that tilde was saved using who knows what encoding, and I simply wanted to get rid of them and have nice ascii "ELECTRICO_xxxx.jpg" files. After finding out that the strange unrepresentable character was the byte 0xEB (so, in order to form an "É" you needed those two characters together: a literal '+' and 0xEB), I could do the bulk renaming with just:

  $ perl-rename 's/\+\xeb/E/' *.jpg
Felt so good!
asamarin··on Linux Kernel 5.3
So what happens at the very first boot (e.g. after system installation, or cloud instance just being spawned)? Is that the only circumstance where it would be OK to block? Does OpenBSD trust RdRand for such occasions?
asamarin··on How not to hire a software engineer
You pray for rain
asamarin··on GCC 8.1 Released
Yes; C++20 seems likely. See https://isocpp.org/std/status
asamarin··on Blocklist Facebook domains
You can see this in action on musl source code, which is arguably a much more readily understandable implementation of libc:

- Function that actually parses /etc/hosts is name_from_hosts(), implemented here: http://git.musl-libc.org/cgit/musl/tree/src/network/lookup_n...

- Which is called by __lookup_name() on the same file: http://git.musl-libc.org/cgit/musl/tree/src/network/lookup_n...

- Which is, in turn, called directly from getaddrinfo() [http://git.musl-libc.org/cgit/musl/tree/src/network/getaddri...], the actual function exposed to you as libc user.

asamarin··on Three Years on Google App Engine
In the very same post where Google announced Java 8 being generally available on GAE standard [1], they also stated Java 9 support was already in the works. Of course, actual timelines are not publicly known yet, but I wouldn't bet my money they'll take another 3 years to get this ready.

[1] https://cloudplatform.googleblog.com/2017/09/Java-8-on-App-E...

asamarin··on Three Years on Google App Engine
It's currently sitting at #1 feature request by vote count on GAE issue tracker: https://issuetracker.google.com/savedsearches/559750
asamarin··on Three Years on Google App Engine
Bear in mind this article was written back in March 2017; quite a few things have changed/improved in GAE-land since. To name a few, off the top of my head:

- Java 8 is already generally available on GAE standard and, on top of that, previous limitations wr/t class whitelisting, threading capabilities and others have been lifted

- appcfg is pretty much outdated these days; all GAE management operations have been progressively integrated into gcloud app subcommand, which also fully supports newer GAE features like Flex, firewall rules, etc.

- GAE standard instances are indeed limited in computing power, but it should be enough for most web-based applications. Again, GAE Flex fills in the gap here in case more muscle is needed, since it leverages GCE-class instances

- Besides the already mentioned background work options (background threads, task queues, cron jobs), there's also Pub/Sub which can be used to inter-communicate GAE services or even other GCP services like GCE or GKE

asamarin··on Design for readability – A primer on code typography
And it's even impossible to do in some cases, e.g. default arguments in C++, which must be at the end of parameter list
asamarin··on Why I left Mac for Windows: Apple has given up
For me, three reasons:

- Pacman (with pacaur on top of it)

- The Arch Wiki

- Bleeding-edge software

asamarin··on Jq – Work with JSON on the command line
I _love_ jq. It's been an incredibly useful tool for me since I discovered it ~6 months ago. However, article mentions "jq -n"; I personally find jq syntax less appealing when it comes to generating JSON instead of parsing it. For that particular task, I prefer using "jo":

https://github.com/jpmens/jo

jq & jo are the Calvin & Hobbes of the shell: lots of fun together!

A few examples:

- Generate a simple JSON object:

  $ jo foo=12 bar=true baz=null
  {"foo":12,"bar":true,"baz":"null"}
- Want a nested object?

  $ jo foo=12 bar=true baz=null thing=$(jo number=57 test=string)
  {"foo":12,"bar":true,"baz":"null","thing":{"number":57,"test":"string"}}
- What about arrays?

  $ jo thing=$(jo number=57 test=string) anarray=$(jo -a 1 2 3 4 5)
  {"thing":{"number":57,"test":"string"},"anarray":[1,2,3,4,5]}
- Now let's add some jq magic to sum all the values in the array together:

  $ jo thing=$(jo number=57 test=string) anarray=$(jo -a 1 2 3 4 5) | jq '.anarray | add'
  15
Great stuff :)
asamarin··on Amazon Polly – Text to Speech in 47 Voices and 24 Languages
I don't know about Amazon, but Google does have Cloud Speech API; seems to be what you're looking for:

https://cloud.google.com/speech/

asamarin··on Why GNU grep is fast (2010)
You're probably talking about sift

https://sift-tool.org/

asamarin··on GoToMyPC has been hacked, all customer passwords reset
I guess you meant 36 to the power of 5, instead of factorial. 36! is a much bigger number than 60 million; same goes for 1,025,109 a few lines below
asamarin··on There Have Probably Been Aliens
That's called panspermia, and no, it hasn't been ruled out. Main problem with it though is that it doesn't explain how life as we know it came into existence, it simply shifts its origin from Earth to somewhere else
asamarin··on Cipherli.st – Strong Ciphers for Apache, Nginx and Lighttpd
Agreed. After a few mins of reading, it became annoying enough that I felt an urge to remove it via dev-tools.

Nice content, nonetheless.

asamarin··on Autoresizing Persistent Disks in Compute Engine
Yes, of course they're correct; however, invoking gcloud is comparatively much slower than just curl'ing against the metadata server (you know, no Python code to interpret in the latter case).

With regards to JSON, not sure what you mean, since getting e.g. instance zone from metadata server gives you a plain text string like "projects/<PROJECT_NUMBER>/zones/europe-west1-d". AFAIK, the only way to get JSON-like results is by making recursive requests, such as:

  $ curl -H 'Metadata-Flavor: Google' "http://metadata/computeMetadata/v1/instance/?recursive=true"
And even in that case, you can choose plain text format by appending "alt=text" as query string parameter:

  $ curl -H 'Metadata-Flavor: Google' "http://metadata/computeMetadata/v1/instance/?recursive=true&alt=text"
asamarin··on Programming blogs
Some extra suggestions:

- Null Program: http://nullprogram.com/index/

- Insane Coding: http://insanecoding.blogspot.com

- Agner Fog's Blog: http://www.agner.org/optimize/blog

asamarin··on Voltron: A hacky debugger UI for hackers
Indeed. Can't remember last time I installed a package using pip. This one, particularly, sits at https://aur.archlinux.org/packages/voltron-git/
asamarin··on PCB design now supports LEDs and Matias switches
I use xcape [1] to have the best of both worlds: a quick press-release tap means Escape (great for vim), while holding it down makes it act as Ctrl (great for shell and other stuff). It's wonderful :)

[1] https://github.com/alols/xcape

asamarin··on Linux TCP will have lockless listener processing 3.5M SYNs per sec
This is an interesting point. Which makes me wonder: is 3.5 GIPS a realistic measure of nowadays commodity CPUs? Because those figures seem to describe CPU clock frequency instead, and it turns out that most instructions take more that 1 tick to complete execution; on the other hand, instruction pipelining and other optimization strategies may lower the ticks-per-instruction average number closer to (or even beyond) 1. Can anyone more informed than me shed some light on this?