1. 4

    Apartment hunting and playing around with my creation myth generator. I’ve been a digital nomad for 3 years, so I’m unreasonably excited to own things like a desk or a tiny potted plant.

    1. 3

      Relaxing with season 2 of Westworld and hacking on my creation myth generator. Last weekend wrapped up my 4th wedding of the year, and honestly I’m just looking forward to a lazy weekend that’s actually a weekend.

      1. 2

        Sans-screen will be mostly relaxing and enjoying the fantastic weather we’ve been having. Maybe get together with some friends for a hike.

        Screen-wise I’m gonna start work on a cross-platform text expander. I use OSX at work and Arch at home and it bugs me that there isn’t a cross platform solution there. Main goals are that it works on those platforms, can sync with a snippet repo (so updates bridge computers), and that snippets are scriptable so you can dynamically have pieces filled in.

        1. 1

          @rocx mentioned M4, and while it’s kinda old and hairy the GNU version might be what you need.

        1. 2

          Could one store the IP address of the initial request that causes you to generate a JWT in the token itself? Then you can validate that the current request comes from the same IP. If they’re different, then force them to log in again from their current IP.

          The user would need to re-login if they turn on a VPN or change locations, but that’s a small price to pay if that reduces the possibility for certain types of attacks. I’m definitely not a security expert, but working on a fairly sensitive app where a breach would be bad for a user. The fact that I haven’t seen this suggested next to more complex safeguards makes me think there’s a fundamental flaw in it that I’m just not thinking of.

          1. 5

            IPs aren’t a great factor to base stuff like this one, although that’s a good idea.

            I think what’s better is something like token binding (https://datatracker.ietf.org/wg/tokbind/documents/) which is a way to pin a certain token to a specific TLS session. This way you have some basic guarantees. But in the real world things are sorta messy =p

            1. 2

              Most home users would have to re log in every day. Services that tie my login to an IP address piss me off so much because they are constantly logging me out.

              1. 2

                The fact that I haven’t seen this suggested next to more complex safeguards makes me think there’s a fundamental flaw in it that I’m just not thinking of.

                It’s not a safe presumption that a users requests will always come from the same IP - even from request to request. Their internet access could be load balanced or otherwise change due to factors like roaming.

                1. 1

                  Yeah that is also a common technique for cookies. If the remote IP changes you can invalidate the cookie.

                1. 5

                  I absolutely love to code in my free time. For some reason I don’t get that same buzz when coding for work. I don’t hate it or anything, it’s just not thrilling in the same way and it’s become a slog for periods of time before. I’ve considered getting another gig that isn’t programming so that I can really dive head first into my hobby coding without worrying about burn out. I can’t ever see myself not programming though.

                  1. 5

                    This is the most useful engineering book I’ve read. It balances theory and application in very plain English. Many things I knew fell into perspective and a cohesive “why” even after working in the space for a while.

                    There’s a special moment when the magic disappears and reveals itself as a simple set of rules to either work with or around. DDIA made me feel like I warped to this point and could approach the often overly complex systems out there by understanding intent instead of mechanics. I wish I had read it years ago.

                    1. 5

                      Off topic-ish, but anyone know a minimal but complete APL interpreter that is written idiomatically in it’s host language? I wanna understand how things work under the hood but every one I come across is written in APL-ized C and I just can’t wrap my head around them.

                      1. 6

                        OpenAPL is written in reasonably normal C, and GNU APL is in fairly normal C++. Unfortunately, neither one’s especially minimal.

                        1. 3

                          Well now I feel a bit silly for not seeing those! Non minimal is fine, at least it’s something I can sink my teeth into. Thanks so much!

                      1. 3

                        Those are some great results, but I still think that Python and Numpy are more readable once you get to use them than the implicit looping Nim suggests. While it may be shocking at first, vector operations and broadcasting usually results (IMHO) in incredibly concise code.

                        1. 5

                          incredibly concise code

                          Also known as APL.

                          1. 4

                            incredibly concise code.

                            There’s a notion in the programming circles (especially functional?) that conciseness is a good thing. I guess it’s a reaction to some “anti-conciseness” styles in languages like Java and C++, but I think we have went too far in a few places.

                            1. 1

                              “Concision” is a broad term. Concise semantics, concise syntax, concise tokens, and concise programs in terms of character counts are all very different and have different trade offs. The fact that they are lumped together during discussion is a shame.

                              1. 1

                                Brevity usually helps readability, other things being equal, though.

                            1. 3

                              Love the idea, but I’d prefer to abstract one level higher. Overhead when reading code comes from recurring structural patterns that have to be mentally re-parsed, not individual tokens. I’d love to have definable sugar over stuff like

                              x, err := fnCall("wat")
                              if err != nil {
                                 return err
                              }
                              

                              or

                              var new []int
                              for i, x := range old {
                                 new = append(new, fn(x))
                              }
                              

                              Being able to spot those common patterns in my code and refer to them as reterr x := fnCall("wat") or new := map(old, fn) would be awesome. I get that it’s much more difficult, but I like the idea of writing in something with more control but reading in something higher level. Can always “dive in” to the actual impl much like you’d do with a function call.

                              1. 2

                                That sounds something like macro expansion. rustc with --pretty=expanded will expand, though it may be too much detail.

                                1. 2

                                  It does! Just kind of…backwards. Macro contraction? I’d love the actual file and what I write to be the full lang, but to have a way to apply some kind of semantic compression for skimming

                              1. 4

                                Did a silly with a friend and speed-ran the design, build and deploy process for https://antiprise.io in 2 days. Crazy simple site (1 endpoint api lol), but was fun to do all the parts including billing, accounts, setting up servers, SSL, etc with a time constraint since it’s always so easy to handwave what goes into an actual deployed product. So unless people actually use it I’ll probably not code outside of $work. If people do actually use it, I’ll be really confused and I guess working on that!

                                Gonna do another speed run next weekend, but using pieces of this as boilerplate/starter.

                                1. 3

                                  $dayjob: Mostly working on support tooling. There are some issues that support needs to diagnose that aren’t hard per se, but definitely take alot of time since the proof requires collecting data from way too many places. Should actually be really fun to write the diagnostic/pattern matching code…the rest is plumbing and string handling.

                                  $sideproject: Kicked off work on a new SaaS over the weekend. Co-founding with an old coworker who is a great product manager and business guy (without sarcasm quotes.) It’s already insanely different compared to building on my own. We took the raw idea and workshopped it, cut crazy amounts of scope for the MVP but left enough to provide tons of value, and found a way to launch into an open part of the industry where we can then grow to the next step.

                                  As someone who constantly needs to remind themselves to step back from the product, code, and pure ideal vision…it’s crazy exciting to see them make such a massive improvement right off the bat.

                                  1. 4

                                    $work: a strange week where I’m wrapping up a bunch of tiny projects that probably shouldn’t have been done at the same time. Life of a internal tools engineer I guess.

                                    $play: Gonna get some work in on my pet language Tiko. Dunno if it’s more than I can reasonably get done in a week since I’ve never done it before, but I’m gonna try to generate some LLVM IR and get it moved over from an interpreter to a compiler!

                                    I only have so much play time until the 10th when a friend of mine and I are gonna start a more serious project, so getting all the code-frivolity out before then. Probably wouldnt be a bad idea to give myself a bit of a screenbreak either.

                                    1. 1

                                      This makes me wonder what blessed syntax would be for a positive assertion equivalent of an if-statement would be. ensure timer != null has a taste to it…

                                      1. 2

                                        Might place more requirements on both lang and lib than you were asking for, but I’ve been messing with a reterr (return error) keyword in my language Tiko that works alot like Rust’s try! macro/? operator.

                                        Tiko uses an Option instead of null, so

                                        func doThing(x Option<T>) {
                                            reterr x
                                            fmt.Println("only reached if not null!")
                                        }
                                        

                                        desugars into

                                        func doThing(x Option<T>) {
                                            match x {
                                              None => return
                                            }
                                        
                                            fmt.Println("only reached if not null")
                                        }
                                        

                                        reterr returns on any falsey expression, any Result<T, E> that is an Error, and any empty Option<T>. Anything else continues through. It will also pass the error up from Result iff the func’s type signature returns an Error.

                                        I like it alot. It makes for some VERY clean code that reads declaratively but doesn’t seem out of place in the imperative style. Preconditions and Go-like if err != nil { return err } handling are readable but don’t take up the majority of visual space on screen.

                                        I worry because it does quite alot of things. It blesses Result and Option, plus it just happens to work with falsey expressions which aren’t necessarily errors. It’s got utility, but not exactly the greatest in terms of aesthetics from a language design standpoint. reterr and return are also super similar visually and might be confused/missed. Since this is mainly a toy language it’s mostly just me having fun and I haven’t had much issue with it so maybe I’m just too hesitant to commit ;)

                                        It’s definitely not a new idea (mostly ripped off from rejected ideas in the Rust ? operator RFC) but given your comment I thought it might be interesting enough to merit a reply.

                                        1. 2

                                          That’s rad! cheers! I imagine it might end up looking a little Eifel like eventually with a neat stack of precondition reterrs at the beginning.

                                        2. 2

                                          Some languages (like lisps/schemes) have when and unless. (when foo bar ...) is similar to if (foo) { bar ... }, (unless foo bar ...) is like if (foo) {} else { bar ... }.

                                          1. 2

                                            Yeah, I’m solidly on the “unless is a useful keyword camp” in Ruby land. I kinda want something that combines that with a return or raise or something though… /u/badtuple has some neat thoughts below.

                                          2. 2

                                            ensure is probably one of the better terms to use for this. I might steal this!

                                            1. 3

                                              Another one you might like is require for preconditions.

                                              1. 2

                                                require for preconditions and ensure for postconditions is lovely!

                                                1. 1

                                                  I think require may be ambiguous in JS land :)

                                              2. 2

                                                I personally like unless keyword, though unfortunately it’s not present in Java. Also one I really liked (maybe most) is a pattern-matching-like approach I saw in Erlang:

                                                execute_timer(entity) when entity /= null ->
                                                    sound_alarm(entity);
                                                execute_timer(_) ->
                                                    do_nothing.
                                                
                                                1. 2

                                                  Ah yeah, I’m most familiar with pattern matching in Scala and agree it’s pretty rad, but the Erlang way seems better in some ways since it groups cases together from a definition standpoint (?). I think Haskell does that too, and it makes for really clean stuff there.

                                                2. 1

                                                  Swift has the guard statement.

                                                  Here is a rough translation of the function in the linked article.

                                                  func run(timer : Timer) throws
                                                  {
                                                      guard timer.enabled else {
                                                          return
                                                      }
                                                      guard timer.valid else {
                                                          throw InvalidTimerException()
                                                      }
                                                      timer.run()
                                                  }
                                                  
                                                1. 2

                                                  How fast is fast and how fast is fast enough? Terrible internet causes me acute pain all the time while traveling, but I have no idea what numbers to shoot for when developing.

                                                  1. 1

                                                    A good starting point is being faster than your competitors. Depending on your industry/market that may set the bar very low or extremely high though, so YMMV.

                                                    Generally, for sites my team works on, I set targets at a minimum of Speed Index < 5000 on Slow 3G, < 3000 on Cable/DSL – using https://www.webpagetest.org/ to verify and taking the median of 5+ runs.

                                                    If you want to test a site on Slow 3G on Slow Android phone to see what a painful experience would look like, you can use https://www.webpagetest.org/easy

                                                    You can also use the Audit panel in Google Chrome’s developer tools, this integrates Lighthouse (https://developers.google.com/web/tools/lighthouse/) which includes metrics like “Time to Interactive”, “Time to First Contentful Paint” etc which are useful for determining what the experience will be for your users.

                                                  1. 3

                                                    Your post was the one that pushed me over the edge! Just created https://mastodon.social/@badtuple . Let’s see how this goes!

                                                    1. 27

                                                      I finally found what works for me after years of being unproductive and waiting for that flash of inspiration to strike. Most systems worked for ~2 days and then I’d slack off or drop the system. Pomodoro was the best one, but in the end I just couldn’t stick to it.

                                                      My system now has one simple rule: If you catch your brain/attention cycling then make a list.

                                                      Bored, not prepared, overwhelmed, distracted, tired…they all manifest in me the same way when I’m trying to get stuff done: I cycle. I stare at an empty vim buffer restarting the same thought over and over lazily, while just moving the cursor up or down, or I cycle between tabs of content quickly. All of a sudden 4 hours have past. I’ve become hyper aware of when this happens now.

                                                      If I feel my brain cycle, I stop and go “Ok, I don’t know how to progress (for whatever reason). Time for a list.” I open a new vim buffer / notebook (paper vs screen doesn’t matter except for my mood), and I break down the steps of that problem. It doesn’t matter how big it is or how small it is or how trivial…if you’re cycling make a list. Then start from the top and do the list.

                                                      This is a recursive process. If I make a list and I start cycling trying to do the first bullet point, I make a list on how to do that bullet point. This is fine…it means you haven’t thought through the steps OR don’t have the motivation/attention span to break it down in your head…just break it down again. Lists don’t take long, and they don’t stick around forever like they do in other systems.

                                                      It doesn’t require a master list, it doesn’t require real planning, it doesn’t require much structure, and if I’m in a flow moment or just “on” that day my brain just won’t cycle so I won’t have to make a list. It kind of scales to how much I need it. I also find the first 2 or 3 lists usually jumpstart my interest because I’m making progress and I don’t cycle much after as long as I’m honest with myself about when I’m cycling.

                                                      This is probably super personal to how my brain works, but it worked wonders for me and has helped my self-esteem like you wouldn’t imagine. Give it a shot just for shiggles, maybe it’ll work for you too :)

                                                      1. 3

                                                        This works for me too. It’s a pretty common ADHD mitigation strategy. For me it’s the only thing that reliably works.