HNHacker News
TopNewBestAskShowJobs

p4l4g4

58 karma · joined March 25, 2020

submissionscomments
p4l4g4··on Stable Diffusion renders pretty images which are QR Readable
Great for steganography! We can finally put our passwords on post-its again!
p4l4g4··on AMD has a one-liner to help speed up Linux system resume time
Having meaningful output is useful, artificial pauzes like this are only for dramatic effect. I rather have a linear, timestamped log, so I can confirm my suspicions, than a progress bar with artificial delays, that suggest progress.

But that's the techy point of view. Most non-techies will probably prefer feel over functionality. I think most people do. If something is instant, it feels too good to be true. If something takes ages, you'll get bored or frustrated. While things that take a proportional amount of time feel satisfying.

p4l4g4··on Load Balancing
I like the idea. I guess you could do something with pubsub to simulate this model. A regular http stack (load balancer and reverse proxies in front of some http framework) would probably need major modifications to work.

It would be great if such a mechanism was part of the http standard, so you could easily connect compliant tools.

p4l4g4··on Engineers Need to Write
This happens more often than I'd like to admit. More often it's on work chat or a call, but the principle holds: I try to explain my problem to someone else and while deepening the explanation, I get a face-palm moment (the answer was there all along!), thank the person for its time and franticly start working on the solution.

Rubber ducking can be a highly productive measure when your mentally clouded and can take many forms.

p4l4g4··on Don't Share Java FileChannels
I would say you can get a long way with trying to prevent your own code from emitting interrupts. But how do you stop libraries or the JVM from emmiting them?
p4l4g4··on Don't Share Java FileChannels
You can't just lock on the file operations, since this problem comes from thread interruptions. No interrupt, no problem. So, instead you need to make file operations and _any_ thread interrupt mutual exclusive.

Finding and patching all possible locations which could interrupt your threads doing file operations is probably a foolish effort.

So, raising the limit, or load balancing (depending on the type of application) is probably the best solution.

p4l4g4··on Ask HN: Small scripts, hacks and automations you're proud of?
Awesome snippet! I organize most of my work using something similar to the Johnny decimal system[0] and use CDPATH for quicker lookups. But I love how you build a dynamic system with a simple oneliner!

[0] https://johnnydecimal.com/

p4l4g4··on Ask HN: Small scripts, hacks and automations you're proud of?
I work at a database heavy company as an infra engineer. From time to time we get requests from devs or customer success to run a query on all customer databases to see or certain assertions hold (e.g. If the latest update fixed a problem or estimate the impact of a change).

To automate this process, we have some ansible playbook to automate most of it: give it a query and you'll get a bunch of files with the results.

While useful, the setup and cleanup can get tidious. So, I whipped up a little shell script that creates a temporary directory and symlink it to a location somewhere in $XDG_STATE_HOME. I created a few subcommands to create the directory structure, add a query, run the query, aggregate results and destroy the state. This keeps things simple for me. Even if I forget to cleanup after myself, a reboot will make sure nothing is left behind. The symlink trick to xdg state home helps me a lot to track my state, while I work on a certain problem. It allows me to easily handle multiple request at the same time, when necessary.

p4l4g4··on Why I stopped using an external monitor
I maintain the cloud infrastructure at my company and I went the other way around: from laptop only to an 3 screens (laptop on a stand + two screens on the side at a 90 degree angle). When I need a browser window at the right resolution, I just drag it to my laptop screen.

The two vertical screens are configured a little different. Vertical screens are terrible for screensharing. For that reason I virtually split one of them in 2 parts (using xrandr). This gives me two square screens that are ideal for screen sharing.

So, virtually, I have 4 screens in 3 different sizes and have no issue assigning stuff to them. The vertical screen is always used for Emacs and different chat apps used for work (have a workspace with all chats stacked vertically, so I can keep tabs easily). One of the square screens is used for browsing, while the other is used for screen sharing (or general browsing/terminal when my screen is not shared). The laptop screen is often used as a scratch pad (short term stuff).

I know it might be a bit overblown, but it works well for me. I really like the fact that I can run multiple things and monitor their output, without interrupting my workflow.

p4l4g4··on Ask HN: I just want to have fun programming again
How i love these quirky side project! Do you have a link to a repo? Would like to see his setup!
p4l4g4··on Git security vulnerabilities announced
A logic bug can be dangerous too though. E.g. Bumping a user ID, to get a "fresh" one or calculate port to open based on offset. When not bounded to a known range, this kind of logic can easily pose a serious security risk. Most of the time, it will probably just work, but under extreme conditions, it will fail. If your language at least catch the overflow and crash instead of wrapping around, you "only" have a denial of service.

Can imagine that implementing bounds checking can be costly, when done in software. Wonder if there are any hardware improvements that could reduce risk in this area.

p4l4g4··on Ubuntu 22.04 LTS servers and phased apt updates
That's why we only allow RFC9225 compliant packages on our systems!
p4l4g4··on Ask HN: Programs that saved you 100 hours? (2022 edition)
Did a lot of data wrangling this year. The usual grep, sed, awk, jq and even find has sped up my days significantly. Sed is among my favorites to whip up some quick, ad hoc, transformations.

This year I added Miller [0] to my list; a tool to process tabular data, similar to sed, awk, etc. It handles csv, tav, json lines, etc. in a consistent way. I like the delimited key-value pairs format, which allows me to write simple oneliners in bash to collect some data (e.g. "ip=x.x.x.x,endpoint=/api/x") and use Miller to crunch the results. Not sure it saved me 100h, but it was one of the biggest time savers this year!

[0] https://miller.readthedocs.io/en/latest/

p4l4g4··on Show HN: Lldap, a Simplified LDAP Server
I have the same experience! On the integration side of things, ldap is often easy to configure. Most software just works, when you know your parameters. The server side, however is a whole different story. It feels like most enterprisey implementations are ancient, even though they have active development going on.
p4l4g4··on Cold Showers
I think this analog is close to the dynamic vs static debate. However, there are probably more factors to consider, such as competence of the driver (will the driver even care to slow down?), location of the intersection (an intersection just around a shallow corner) and value of the driver's car (does the driver care about a little damage?).

In my experience similar arguments hold for software developers. Especially caring can be a big factor; i.e. the "move fast, break things" mentality.

I've been back and forth between typed and untyped languages (somewhere in the range of haskell and tcl) and personally prefer less typing when hacking things together and more typing for high quality software. I'm currently working an infra job where we use both ansible and terraform. They're not direct competitors, but I tend to prefer terraform over ansible when possible, as terraform gives me more "static" guarantees, which translates to more confidence when we apply our code.

p4l4g4··on Ansible 2.13
I know the feeling. We use ansible extensively in our company. While it is probably the best tool at the moment to get the job done, it is not a pleasant tool for larger/complex setups.

Like you said, it's the small things. The thing that annoys me most are probably variable scoping and precedence rules. Scoping is practically non-existent; a variable declared in one role can be freely accessed in another, which can easily lead to clashes when your variable names are too generic.

p4l4g4··on The Birth of Tcl
Same here! Tcl/tk is a lovely little language and much under appreciated by many! Interesting software started in tcl, such as redis, expect and sqlite. Still use some tcl through environment-modules, in my personal work setup.

Have to say that lisps are very nice too, in my opinion. Started learning a little common lisp recently and was surprised by its elegance. I think lisps can be very maintainable, when care is taken. It's easy to write unreadable programs, but this also holds for tcl. With great power comes great responsibility.

p4l4g4··on Kubernetes Cluster API v1.0, Production Ready
"Optimizing based on a lottery event seems counter-productive"

I think it depends on how often you "win" the lottery. If a lottery event happens once or twice a year and it's fairly hard to resolve, we classify them as land mines (or sea mines for the more maritime oriented people among us). These issues get a lower priority, but we'll try to work through them to avoid emergencies or lower their impact. So, maybe not optimizing, but increase resilience against lottery events.

p4l4g4··on Show HN: Luna is a Clojure domain specific language that translates to regex
Took me a while to appreciate rx. I like the conciseness of normal regexes, but rx is so much more readable and maintainable! I love the extensibility options and the fact it's just a macro. So, at runtime, there is no difference.

Glancing over the examples of this post, I think I like rx better, due to its lispy syntax.

p4l4g4··on EU plans to force OEMs to use a common charger for all phones
Just charged my phone with my laptops Usb-C charger, without any issue. Apart from special features like fast-charge, I'd say compatibility is very good.
p4l4g4··on Home Price to Income Ratio
My eye was drawn to the graphs. Especially the house price / income graphs. There seems to be a trend in the US graph: if you zoom in far enough, you can see a consistent drop in Januari (every year). The UK graph does not show this trend..

Does someone know the origin of this trend? And why the two countries don't show the same trend?

p4l4g4··on Show HN: I wrote a free Mac app to OCR any text on screen
Forgot a crucial parameter in the first xclip call: -t image/png. Without this, your system don't know its png data and will paste the raw data when you hit ctrl-v.
p4l4g4··on Show HN: I wrote a free Mac app to OCR any text on screen
Nice! Although I'm linux user, I got inspired by the idea. I often combine imagemagick import with xclip to quickly snap parts of the screen to clipboard (import png:- | xclip -sel clip). This can easily be extended with tesseract for ocr support (just add 'tesseract - -' between import and xclip in the pipeline)!
p4l4g4··on The unreasonable effectiveness of print debugging
I used this a lot! Combined with scripting support, you can make the experience even more interactive.

Used gdb scripts in the past to make debug sessions repeatable. Stuck beyond the point your interested in? No problem, just restart the session with your gdb script and your right back on track! You can also add custom functions to output your state in a more meaningful way or to mock some state. In longer debugging sessions, a good debugger can be a life safer!

Still, for shorter sessions, reading logs and adding occasional prints are hard to beat.

p4l4g4··on How often do people copy and paste from Stack Overflow?
This, yes! Not necessarily the copy/paste part, but definitely the debug part!

I generally like deeper debug sessions, preferably without too much pressure. Getting deep understanding for a problem and figuring out a solution were the most valuable learning experiences in my career. The satisfaction you get from finding a solution to a hard problem, makes them more memorable. Even if the lessons learned afterward are not spectacular, then at least you got a chance to sharpen the tools in your belt to pin point problems as they occur!

p4l4g4··on What was the point of [ “x$var” = “xval” ]?
Wondered for ages whether there is a real situation where this is needed. Good to see this publicly debunked. Now I have a resource to point to when I get the "better safe than sorry" argument.
p4l4g4··on Why does my PC crash only when my cat is nearby?
This problem sounds more familiar to me. Cat - keyboard interaction is one of the most destructive, besides cat - carpet and cat curtain interactions..
p4l4g4··on Guthib
Nice! Shame it shows 404 when accessing sub directories.
p4l4g4··on I Chose Emacs as My New Text Editor
Good read, thanks! I liked the flow of this article.

Looks liken the author had a good introduction from his friend. The pages he found in a short time took me years to collect!

Although it only scratches the surfaces of what emacs is capable of, it nicely illustrates how emacs fills day-to-day gaps that otherwise would require learning completely new environments.

p4l4g4··on Magit – A Git Porcelain inside Emacs
I've used vim for about 5 years and switched directly to "vanilla" emacs (no evil or doom).

My main motivator was similar to yours. Most functionality I used came from plugins, but the language used to write plugins or other modifications felt crippled. When I came across orgmode, during my years on the university, I tried it in vim, through some Plugin. I liked how the format allowed me to dump most of my brain in plain text, but it still felt unnatural to edit it with vim.

During a history course on computer science, I learned more about lisp and its integration in emacs. At that point I decided to try it out. I wanted the full experience, to be able to form an honest opinion. So, I forced myself to do an entire course using emacs instead vim. No evil, just plain emacs. During this time, I fell in love and never looked back.

I still like vim, I just don't find any use for it anymore, except quick editing on servers. Knowing vi key bindings is useful, as vi is almost always present. However, I think that known/understanding emacs key bindings is underrated. Understanding the logic of emacs key bindings will not only makes you more proficient at handling emacs, it also makes moving around most shells more efficient. I know you can configure shells (or more specific: readline) to use vi key bindings, but the default is emacs!

My advise in learning emacs would be: dedicate some time on using it for something real. I'd say, don't get too tempted by the vimify plugins, as they will hide some of the logic of how emacs works. This might slow down or dumb down the learning process. But I'm not discouraging the use of vim plugins all together, just make sure you understand the core product, before modifying it beyond recognition.

Page 1 of 2Next →