News for hackers. Stuff that matters.

npretto

a couple of prompts of claude code gave me this, works well enough, but while I agree that this is sometimes useful, it may indeed better served by a couple of aliases in the terminal ``` #!/bin/bash

# SwiftBar Port Monitor # Monitors processes on TCP ports 2000-6000

# Menu bar title echo " Ports" echo "---"

# Get processes listening on TCP ports 2000-6000 processes=$(lsof -iTCP:2000-6000 -sTCP:LISTEN -n -P 2>/dev/null | awk 'NR>1 {print $2 "|" $1 "|" $9}' | sort -t'|' -k3 -n)

if [ -z "$processes" ]; then echo "No processes found on ports 2000-6000" exit 0 fi

# Process each line while IFS='|' read -r pid name port_info; do if [ -n "$pid" ] && [ -n "$name" ] && [ -n "$port_info" ]; then # Extract port number from format like :3000 port=$(echo "$port_info" | sed 's/.://')

        # Menu item with port and process name
        echo "[$port] $name | color=blue"
        
        # Submenu items
        echo "--Kill (TERM) | shell=kill param1=$pid terminal=false refresh=true"
        echo "--Kill Force (KILL) | shell=kill param1=-9 param2=$pid terminal=false refresh=true"
        echo "--Process Info | shell=ps param1=-p param2=$pid param3=-o param4=pid,ppid,user,command terminal=true"
        echo "-----"
    fi
done <<< "$processes"

# Refresh option echo "---" echo "Refresh | refresh=true

Re:A 10-Year Battery for AirTag on Thursday December 19, 2024 @03:22PM (#42465342)
Surely going to lunch with 10k of equipment is safer, especially when you'll need to go to the toilet.
Re:Svelte is migrating from TypeScript to JSDoc on Wednesday May 10, 2023 @03:42PM (#35892481)
this has nothing to do with "TS support" at all.
Re:Google Stopping Coding Competitions on Wednesday February 22, 2023 @01:42PM (#34900535)
is this a sign that finding developers is not that hard anymore, and they don't need to organize these competitions with the hiring budget?
Re:An M1 for Curl on Friday December 30, 2022 @09:22AM (#34185223)
It could be that the donation comes from matching the donations of some employees, or similar programs.
I think he published this video when I was starting to think about the same things, especially about working out, where it's more important to workout consistently with a decent form/weight than to spend hours reading up science and working out very little.

Most "benchmarks" or data that we have mean very little because of the context (or lack of) they are done.

I often read critics to benchmarks in here and how they are not "real life scenarios", seems like CS is not the only world where this happens

I can confirm that your posts, tweets and replies in reddit/hn are helpful to people like myself
Re:Ask HN: What stack for a multiplayer board game? on Monday July 11, 2022 @12:16PM (#32058109)
You mentioned electron so I suspect you're interested in games playable via browser, in that case these two come to my mind in the javascript/typescript ecosystem:

- https://boardgame.io/

- https://www.colyseus.io/

React native and flutter are very, very different from a PWA.

While a PWA is a web app, react-native renders actual native components, and flutter has its own rendering engine. I wouldn't call them "web-based" tech

Re:GitHub Actions Has Overbilling Bug on Wednesday April 13, 2022 @06:36PM (#31021168)
Came to hackernews to check if somebody else had this problem after I saw my usage was $24,522,457.08 and I barely use github actions
Re:I’m porting the TypeScript type checker tsc to Go on Wednesday January 26, 2022 @11:02AM (#30087124)
So this is a "This week vercel is sponsoring" episode...
Re:The Windows 11 taskbar is an annoying step backward on Friday January 21, 2022 @09:45AM (#30024157)
Yep, that's because of Fitts’ Law: the time we need to click a button is a function of the distance between the pointer and the button, divided by the area of the button.

When the button is in a corner the size is virtually infinite (we can move the mouse all we want in one direction and we'd still be over the button)

Re:A tour to my Zettelkasten note clusters on Wednesday January 19, 2022 @12:47PM (#29997113)
There's also obsidian-export[1] that converts the few things that are not plain markdown (`[[links]` and `![[links]]`).

To be honest, obsidian not being open source doesn't bother me too much, what is important to me is that I own the data and that it is in a fairly common format so i can move it to another software in 10 years. An open source software with a weird binary format to save the data will probably do more harm in the long term

[1] https://crates.io/crates/obsidian-export

Re:Gameboy CT scan – design lessons learned on Monday January 03, 2022 @09:52AM (#29781312)
try increasing font size with [cmd]+[+] instead of using pinch-to-zoom, it works perfectly for me with that
Thanks for pointing that out, the link is actually kinda hidden. I added it to the readme
Two years ago I had to make a project about pathfinding for a university project, and I just realised I never showed it anywhere.

I made this little interactive playground for various pathfinding algorithms showing how they can be seen as a general algorithm with different a different queue and different heuristic in use.

The readme has some theory but the cool thing is the link to the app on netlify where you can experiment moving the positions of start, goal and of the obstacles.

If you're interested I'd suggest you keep the readme open while toying with the app, as the readme has more theory.