HNHacker News
TopNewBestAskShowJobs

gh123man

456 karma · joined March 28, 2019

Software Engineer, Hobby programmer, Car enthusiast

github.com/gh123man/ Blog - sb1.io

Currently hacking on dateit.io

submissionscomments
gh123man··on OpenLogi
Exactly my thoughts. My point was targeted more towards consumers who usually don't have a voice in the software/hardware they buy. Reverse engineering, de-vendor locking, and open sourcing the protocol gives us freedom to use the device we purchased however we want, for as long as we want.
gh123man··on OpenLogi
Everything is inferred from device traces, and compared against known protocol implementations (ex USB - thanks to the openrazer project) - which AFAIK have remained pretty stable over the years.

So far, it's survived a few device firmware updates with no visible breaking changes, but I can't guarantee it always will.

https://github.com/openrazer/openrazer

gh123man··on OpenLogi
Ive been building something very similar to this for Razer devices

https://github.com/gh123man/OpenSnek

Similar to other reverse engineering threads ive seen recently, AI is empowering us to replace crappy vendor software with something better.

Also - OpenSnek documents a mostly complete bluetooth spec for the Razer vendor protocol which as far as I know, hasn't been done anywhere else yet!

gh123man··on Mouser: An open source alternative to Logi-Plus mouse software
Funny timing, I've been working on essentially the same thing for Razer mice on macOS. I started this project because the basilisk v3 hyperspeed has no native mac OS support, and no documented bluetooth protocol, so I packet captured and reverse engineered it.

https://github.com/gh123man/OpenSnek

gh123man··on Swift Static Linux SDK
I'd love to hear some specific examples. Ive built several iOS apps and a whole backend (on linux) with Swift and other than lack of OSS library support for some SaaS APIs, it's been quite nice.

Sure Swift itself has some sharp edges, but not any more (or worse) than many other popular languages.

gh123man··on Ask HN: How to handle user file uploads?
+1 to vips! It's amazingly fast and stable. I even wrote (some minimal) Swift bindings for it to be used with a Swift backend: https://github.com/gh123man/SwiftVips
gh123man··on Advent of Code 2023 is nigh
I challenge myself to do it in bash one liners. I came up with a clever and shockingly simple solution to part2 using expansion and substitution.

  cat 1.txt | sed -E 's/(one)/\11\1/g; s/(two)/\12\1/g; s/(three)/\13\1/g; s/(four)/\14\1/g; s/(five)/\15\1/g; s/(six)/\16\1/g; s/(seven)/\17\1/g; s/(eight)/\18\1/g; s/(nine)/\19\1/g;' | sed -e 's/[^0-9]//g' | awk '{print substr($0,1,1) substr($0,length,1)}' | tr '\n' '+' | sed 's/\(.*\)+/\1\n/' | bc
gh123man··on The laptop that won't die
I had a T420 in college. One day in a CS class, I bumped my (uncovered) cup of coffee and it spilled into the keyboard. I knew the laptop had ducts to drain water out, but never tested it (for obvious reasons).

I blotted up as much coffee as I could with some napkins and kept taking notes on the soaked keyboard. Worked like a charm. After drying it out, a few keys stopped working so I bought a replacement keyboard for ~$20 and swapping it out was rather fast (from memory).

I use an M1 MBP now, but I still have that thing in the basement. It still works, and I loved it. I don't miss carrying it around though (or the hilariously short battery life due to forcing discrete GPU mode so I could dock it for multiple monitors at home).

gh123man··on Ask HN: What hardware are you running for your home server?
I recently replaced an old, power hungry 2U server with a laptop.

I wanted a NUC, but as it turns out a used laptop on Ebay could fetch the same specs (i7-1185G7, 16gb) for less than half the price of the equivalent NUC (without an SSD or memory).

An added bonus is you get a UPS and KVM included!

gh123man··on When we were first adding Mac OS X guest support at VMware (2022)
Maybe a slightly off topic question, but with the recent-ish news of Corellium winning against Apple in court to sell an iOS virtualization service. How is it that virtualizing macOS (on non-apple hardware) is still NOT ok (illegal?)?

Cloud providers are forced to host mac instances on real mac hardware for example (with a lot of strange restrictions).

gh123man··on Google Analytics 4 was frustrating, so we built our own analytics service
Agree on all points. It's extra frustrating because GA exposes some metrics that are hard to get elsewhere like traffic sources, organic search, accurate user metrics, live geo location, etc. The only reason I keep it activated (alongside a more flexible alternative) is because it's free.

The whole UX drives me mad.

gh123man··on Google Analytics 4 was frustrating, so we built our own analytics service
I am also frustrated with Google Analytics but one thing it does very well (that I can't seem to find elsewhere) is counting unique unregistered visitors. If I had to guess this is done with some advanced fingerprinting - but I'd be curious if anyone has found an alternative for these metrics.
gh123man··on Write a First Person Game in 2KB with Rust
It appears my Appstore agreements have fallen out of date and needed renewal. That's a somewhat embarrassing - but it should be fixed now. Gate Escape should be available in all regions, and thanks for checking it out!
gh123man··on Write a First Person Game in 2KB with Rust
Nice writeup! Building raycasting engines is fun and rewarding. You can get a lot of visual impact with very small and easy to understand code. I took a stab at it and ended up adding portals which I thought was really fun (https://github.com/gh123man/Portal-Raycaster).

I've been thinking about re-writing my raycasting engine in Rust but never really found the time - glad to see someone has done it and documented it so well!

If anyone else is interested in raycasting this page is also worth a read: https://lodev.org/cgtutor/raycasting.html

gh123man··on Tips for analyzing logs
Many frameworks solve this with logger context. Add the properties you want to the logging context and all future logs in that context will have that property.

One simple example - Serilog enrichment https://github.com/serilog/serilog/wiki/Enrichment

This does however assume your entire application uses the same logger. But this is generally a requirement in services that require tracing like this.

gh123man··on Ask HN: Where do you host images for your blog or landing pages?
You can go surprisingly far with a $5/mo Digital Ocean droplet and the Cloudflare free tier. Just host your website the boring way, put CF in front of it and they will cache and serve all of your static content for free.
gh123man··on Implementing parts of the Swift compiler in Swift
You do have SwiftNIO (as far as making network calls) - but that leaves a lot to be desired from an out of the box usability perspective. Otherwise I totally agree, Foundation on Linux is missing some useful things.
gh123man··on Implementing parts of the Swift compiler in Swift
Yes! And it's fantastic.
gh123man··on Implementing parts of the Swift compiler in Swift
Last I checked golang is not packaged either and that doesn't make it any less useful on Linux.

Swift works great on Linux. You can install it manually, or use the official docker image. I prefer using docker and have had a great experience (both developing and deploying).

gh123man··on Implementing parts of the Swift compiler in Swift
https://vapor.codes/ brings Swift to the server and it's quite good! Wrap that in docker and you can be running Swift anywhere pretty quickly.
gh123man··on SwiftUI in 2022
You are probably pulling firebase into your preview code somewhere. You should structure your previews to depend on mock implementations of your model (or mock data). It will make the previews much faster and more reliable.

My app also uses firebase and SwiftUI with hundreds of files (views, view models, and more) with no problems.

gh123man··on SwiftUI in 2022
SwiftUI has been a game changer for me as a solo dev. Sure - you have to make tradeoffs like backwards compatibility, and some strange things are missing/don't work. But - it's been a force multiplier. You can break apart complex views into components by copy/pasting its body into a new `View` struct. It's so much simpler than ripping apart a storyboard into a XIB or fighting with layout constraints. The simplicity lets you try things and fail fast without too much of an investment in design complexity.

I find that I can deliver features and iterate much faster and that makes up for the time I spend fixing edge case bugs or bridging to UIKit when I need an unsupported feature.

gh123man··on Show HN: How did I live without Pipe Watch?
I keep this alias in my zshrc for exactly this purpose

  alias lzf="fzf +s --tac --bind 'enter:select-all+accept' -m"
With the added bonus that you can press return to release the filtered lines to stdout. Really useful for interactively filtering logs.
gh123man··on Please put units in names
In swift I quite like DispatchTimeInterval's approach [1] (see Enumeration Cases). In most of my projects I end up adding a simple extension to TimeInterval to get the same behavior. Which makes reasoning about time very simple eg:

  Date().advanced(by: .hours(2) + .seconds(10))
I'm honestly not sure why TimeInterval doesn't include this representation by default.

1. https://developer.apple.com/documentation/dispatch/dispatcht...

gh123man··on Rustenstein 3D: Game programming like it's 1992
Ray casting is close to my heart as it's easy to understand and has a very high "effort to reward" ratio, especially to someone who is new to graphics programming. I built a game + engine around ray casting portals [1] (think the game Portal). It was a lot of fun trying to figure out how to bounce rays around a scene and intersect with different objects in the environment and immensely satisfying to have built the whole engine from the ground up. Though I'd probably not do it again. Your top-down ray debug view is very similar to one I came up with!

Some of the interesting bits of the engine are open source: https://github.com/gh123man/Portal-Raycaster

1. https://blog.sb1.io/gateescape/

gh123man··on Show HN: What do you think of my new social app?
I'd love to learn how you are handling media/photo storage from both a technical and practical perspective. Some questions that come to mind: are you using a dedicated service or did you build it yourself? Are you using a CDN? How do you plan to deal with abusive content and the liability that comes with storing photos?

I am also working on an app where hosting photos would be a nice feature - but the risk/undertaking without proper and potentially expensive infrastructure is daunting.

gh123man··on A public letter to CloudFlare to fix their snoopy vendor
I just went though this. you need to whitelist the acme-challenge (using page rules) like this:

  *example.com/.well-known/acme-challenge/*
  Disable Security, SSL: Off, Cache Level: Bypass, Automatic HTTPS Rewrites: Off
and one big gotcha:

  Under SSL/TLS -> Edge Certificates -> disable Always Use HTTPS
(assuming you are using the HTTP-01 challenge).
gh123man··on Darling – Run Mac apps on Linux
Has anyone been able to use darling for iOS CI jobs yet? Admittedly I haven't researched this in a while, but one of the biggest hurdles in large scale iOS development is sane DevOps infrastructure. I know due to Apple's TOS that you will never be able to build, sign, and distribute your app on non-Apple hardware. But i'd love to use darling to run unit tests/CI jobs on commodity cloud infrastructure.

Even if you do get dedicated mac instances, managing them is a bit of a nightmare since MacOS isn't designed to be headless.

gh123man··on Apple’s use of Swift and SwiftUI in iOS 15
Indeed you are right. XCode absolute induces some stockholm syndrome as an iOS dev. Maybe anecdotal, but I do find swiftPM based projects to have far fewer issues than cocoapod + Cocoa based apps.

I'd love to see sourcekit-lsp (the swift lsp) to further develop. Though last time I checked it wasn't exactly usable day to day.

gh123man··on Apple’s use of Swift and SwiftUI in iOS 15
I am! I'm building a complete backend in Swift for an app i'm working on. It's actually been really great so far. I develop on my mac in xcode and deploy on linux via docker. See: https://vapor.codes/

I'm a little bias because I really like Swift as a language but Vapor is growing and there are lots of plugins to fill the gaps.

Page 1 of 3Next →