Threads for 3digitdev

  1. 3

    First “real” week at my new job! Huge codebase to learn, and have to re-orient myself in Typescript after a few years of pure Python.

    Looking forward to the challenge!

    1. 1

      Flying to Hawaii for a company retreat and my first week with the company for my new job! Helluva start to a new job, gonna be hard to top.

      1. 7

        Just bought a drone on my friend’s recommendation (DJI Mini 2) in preparation for a trip to Hawaii in about a week.

        Going to spend my weekend with that friend, flying our drones and learning the ropes a bit more from him (I have some experience but he’s quite good at it).

        ….Provided it STOPS RAINING HERE

        1. 2

          10 years of python and I never knew about that last one! That could actually be really handy, thanks for the article!

          1. 5

            I just accepted a new job offer! I will be putting in my 2 weeks tomorrow morning.

            36% pay raise, more stable company, and bonus: my first day at the new job will be spent in HAWAII for a well-timed company meetup! I’m pretty stoked about it all.

            Sad to leave behind Python (my sweet prince) for Typescript, but excited to expand my horizons again!

            1. 1
              • Pokemon Legends: Arceus
              • Basic planning for re-doing our fire pit area with flatstone + brick
              • …Pokemon Legends: Arceus. It’s really fun, okay?!
              1. 2

                That’s a great tip! I personally just made a terminal alias so I can do jira 1234 and it opens but I am glad to see solutions for people who don’t live in the terminal! I might even add this so I can find one no matter where I am without switching applications.

                1. 6
                  • on Saturday I will be live-streaming my wife and I as we find out the gender of our first child! So fucking excited!
                  • celebrating my birthday on Saturday (along with the above!)
                  • noobish carpentry: trying (and so far failing) to build a floating shelf. Oh well, such is the learning process. Just wish plywood wasn’t so damned expensive right now haha
                  • if I manage to get a shelf done, I’m gonna finally be able to set up my projector and then I can spend my remaining time (and most of the next month) playing Elden Ring and Horizon Forbidden West on the giant new projector setup!
                  1. 1

                    Update: The second attempt shelf is looking much better! Thank god…

                    1. 1

                      celebrating my birthday on Saturday (along with the above!)

                      Parabens/happy birthday!

                    1. 1

                      Not super interesting I reckon. But the ones I use the most.

                      ..='cd ..'
                      ip='ip -br -c'
                      home='git --work-tree=/home/fox --git-dir=/home/fox/.config/home.git'
                      
                      i3conf='vim ~/.config/i3/config'
                      zshrc='vim ~/.config/zsh/.zshrc && source ~/.config/zsh/.zshrc'|
                      

                      I don’t really have a lot of super useful aliases. Most of the time is spent making git config aliases and vim stuff.

                      1. 1

                        Is that BSD or a mac? My ip doesn’t know either flag.

                        1. 2

                          That is iproute2. The goal is to have ip be brief by default because I simply do not care about all the information.

                          λ ~ » /usr/bin/ip a
                          1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
                              link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
                              inet 127.0.0.1/8 scope host lo
                                 valid_lft forever preferred_lft forever
                              inet6 ::1/128 scope host
                                 valid_lft forever preferred_lft forever
                          2: wlp0s20f3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
                              link/ether 10:3d:1c:e9:f5:cf brd ff:ff:ff:ff:ff:ff
                              inet 192.168.1.11/24 brd 192.168.1.255 scope global dynamic noprefixroute wlp0s20f3
                                 valid_lft 78751sec preferred_lft 78751sec
                              inet6 fe80::9f2c:5a98:d8ef:b06e/64 scope link noprefixroute
                                 valid_lft forever preferred_lft forever
                          3: enp0s31f6: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
                              link/ether 90:2e:16:5e:1a:b5 brd ff:ff:ff:ff:ff:ff
                          14: enp36s0u1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
                              link/ether 00:50:b6:9f:fe:25 brd ff:ff:ff:ff:ff:ff
                          
                          λ ~ » ip a
                          lo               UNKNOWN        127.0.0.1/8 ::1/128
                          wlp0s20f3        UP             192.168.1.11/24 fe80::9f2c:5a98:d8ef:b06e/64
                          enp0s31f6        DOWN
                          enp36s0u1        DOWN
                          
                          1. 1

                            Thanks, but that’s why I was asking:

                            ii  iproute2                              5.5.0-1ubuntu1
                            

                            ip -br doesn’t work and neither does ip -c or ip -br -c.

                            And now I finally grasped that it would output the same as 'ip' - so it is -brief -color. Sorry, brainfart (ofc I searched before I asked that last question..) :P

                            Apparently I have never used either flag and didn’t notice them in the manual. – signed, someone gowing up with ifconfig

                            1. 1

                              Yeah I found the documentation for these commands a bit lacking when I started utilizing them initially.

                        2. 1

                          ..='cd ..'

                          I was going to post this as my most useful, because I just it all the time.

                          I also have ...="cd ../.." and so on for going up more levels. Probably not useful beyond four or five levels due to how quickly can you count how deep you are in the CWD.

                          Edit: Just to be clear, I’m talking about me visually counting up how many levels deep I am in the directory tree. Beyond three or four, I tend to just go up that much, and then look and see where I am and maybe do it again, with my finger hovering over the ‘.’ key. I don’t have a problem rapidly tapping out the ‘.’ nine times to go up 8 levels, the difficulty (for me) is determining that I want to go up 8, vs. 7 or 9 levels.

                          1. 1

                            Don’t want to keep posting it so I’ll link to the reply i made to the parent:

                            https://lobste.rs/s/qgqssl/what_are_most_useful_aliases_your_bashrc#c_fqu7jd

                            You might like to use it too!

                          2. 1

                            You (and others) might be interested in the one from my post to this:

                            function up() {
                              local d=""
                              limit=$1
                              for ((i=1 ; i <= limit ; i++))
                                do
                                  d=$d/..
                                done
                              d=$(echo $d | sed 's/^\///')
                              if [ -z "$d" ]; then
                                d=..
                              fi
                              cd $d
                            }
                            

                            Allows you to just do up 4 to get cd ../../../..

                            LIFE-saver.

                            1. 2

                              Even more fun (only works in zsh, as far as I know):

                              function rationalize-dot {
                                  if [[ $LBUFFER = *... ]]; then
                                      LBUFFER=${LBUFFER[1,-2]}
                                      LBUFFER+=/..
                                  else
                                      LBUFFER+=.
                                  fi
                               }
                               zle -N rationalize-dot
                               bindkey . rationalize-dot
                              

                              You can make this even better by adding setopt auto_cd to your config, so that if you type a directory path zsh automatically changes to that directory.

                              1. 1

                                I tend to use https://github.com/wting/autojump for smart CDing, personally!

                              2. 2
                                alias .="cd .."
                                alias ..="cd ../.."
                                alias ...="cd ../../.."
                                alias ....="cd ../../../.."
                                
                                1. 1

                                  Interesting. I’ve never tried to install / use those “smart” cd replacements, where you can type “cd foobar” and it looks at your recent working directories to find a “foobar” and go there.

                                  I was thinking about a variant of your up function that does something like that, where I can type “up foo” in the current directory:

                                  /home/username/foobar/one/two/three/four/
                                  

                                  And so it just looks into successive parent directories for anything matching “foo”, and the first one it finds is the destination.

                                  1. 2

                                    oh man – just use Autojump https://github.com/wting/autojump. I use it on every machine i own and it’s a GODSEND.

                                    1. 1

                                      That was what I was talking about. I’ll have to give it or maybe zoxide a try and see if I stick with it.

                              1. 3

                                Aliases I always add:

                                alias ..='cd ..'
                                alias new='mkdir && cd'
                                
                                  1. 3

                                    I make k a function which inspects the args and splices in $KUBE_CONTEXT and $KUBE_NAMESPACE in appropriate places, so that I can use .envrc and direnv(1) to work in the appropriate kubernetes context and namespace for a given app.

                                    1. 2

                                      God yes. When people see I have that they chuckle, and then after maybe 10 minutes of working in k8s with them, they immediately make the alias too.

                                    1. 1

                                      .. for cd ..
                                      sl for ls
                                      gittree for "git log --graph --all --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)'" for displaying a nice git history tree.

                                      1. 2
                                        alias reload="source ~/.zshrc"
                                        alias zshrc="vi ~/.zshrc; reload"
                                        

                                        (replace vi with whatever you want)

                                        1. 1

                                          Hah! I did similar with vizsh and srczsh (and accompanying vizshe/srczshe for the .zshenv file)

                                        1. 5

                                          Opening JIRA tickets at work (replace DEV with your prefix):

                                          (simple? yes. Took me forever to consider even doing? yes. HUGE timesaver in meetings where people just rattle off ticket numbers? god yes.)

                                          function jira() {
                                            open https://<our_domain>.atlassian.net/browse/DEV-${1}
                                          }
                                          

                                          Up command (copied from stackoverflow) – Takes optional number of levels to cd ../:

                                          function up() {
                                            local d=""
                                            limit=$1
                                            for ((i=1 ; i <= limit ; i++))
                                              do
                                                d=$d/..
                                              done
                                            d=$(echo $d | sed 's/^\///')
                                            if [ -z "$d" ]; then
                                              d=..
                                            fi
                                            cd $d
                                          }
                                          
                                          1. 1

                                            Have done similar thing, will attest to its utility.

                                            1. 1

                                              Doing this with DNS search domains company-wide is also a good idea: typing http://jira/1234 should redirect you to the correct ticket.

                                            1. 2

                                              Last 3 computers in reverse order:

                                              • Surface Pro 3 (Yes going back a ways): Loved it because I could code just fine on it, but also use it for D&D character sheets and DMing. It was so valuable for me to use that 2 other players in my group bought them as well just because of that. I ended up using that computer until it got smashed when I got rear ended.
                                              • Dell XPS 15: I ended up buying mine for $1200 – it was the lowest specced one that I could get that still had an i7. I then spent $500 on a 2TB NVMe + 32GB RAM to upgrade it. I absolutely adored that computer. It was so good that my wife, who has been a long-time Apple-only user, actually bought one as her new laptop. She recently bought a NEW one after her old one died. It was amazing for dev work for me – I dual-booted linux/windows on it for coding/gaming. I had that computer for several years, until a really unfortunate drop broke a corner of it and then wear and tear on that corner over the next few months severed something important and it just completely stopped functioning.
                                              • M1 Macbook Air (current): I bought this very recently after my Dell XPS 15 died. I had my eye on it after the M1 came out, and was waiting for a few months until all the dev software I cared about supported ARM and/or Rosetta. I bought it because, to be frank, I don’t need a fancy-ass computer. This thing was $1200 (for a Mac) and it has done everything I could possibly need. My entire dev environment is running including 1+ docker images and PyCharm, and it doesn’t even get warm (I don’t think I’ve ever heard sound from it either). Battery lasts for seemingly forever. My only gripe is that I wasn’t willing to get an MBP that just came out – magsafe + all the ports again was attractive, but it was almost double the price. No way.
                                              • Future?: Unsure. If Apple keeps on the track they’re on right now with better prices and reasonable specs, I might legitimately stick with it. I am in no way married to a brand though, so I would readily move back to Dell/Lenovo/etc if it matched my needs.
                                              1. 1

                                                it doesn’t even get warm (I don’t think I’ve ever heard sound from it either)

                                                The M1 MacBook Air is completely fanless.

                                              1. 8

                                                US taxes. I’m so salty Intuit has lobbied to keep them so complicated. TurboTax is basically the only service that let’s non-US addresses file. Everything about cryptocurrency taxes are obtuse as well.

                                                1. 5

                                                  If you can afford to do it I highly recommend hiring a CPA at a local tax accounting place to help out. My wife and I had multi-state taxes, a new house/car, several 1099s from securities trading, some crypto, and a few other complications. We brought all of our tax shit to a CPA and she had it all done in like an hour flat and we paid $175 for the entire thing. was TOTALLY worth it, IMO.

                                                1. 1

                                                  Bachelor party for a childhood friend – 6 of us renting a giant airbnb cabin for a weekend to hang out in a “resort” town and do whatever.

                                                  1. 8

                                                    Now can someone make a spreadsheet app with the same and call it “holy-sheet”?

                                                    1. 26

                                                      Personally, having alternative syntaxes is more disruptive than the weirdness of regex to begin with. Sure, maybe your new syntax is technically superior in every regard, but it’s just more non-standard info I have to jam into my head.

                                                      1. 10

                                                        Let’s go ahead and add emphasis to that maybe… from one of the linked example projects:

                                                        const SuperExpressive = require('super-expressive');
                                                        
                                                        const myRegex = SuperExpressive()
                                                          .startOfInput
                                                          .optional.string('0x')
                                                          .capture
                                                            .exactly(4).anyOf
                                                              .range('A', 'F')
                                                              .range('a', 'f')
                                                              .range('0', '9')
                                                            .end()
                                                          .end()
                                                          .endOfInput
                                                          .toRegex();
                                                        
                                                        // Produces the following regular expression:
                                                        /^(?:0x)?([A-Fa-f0-9]{4})$/
                                                        

                                                        It’s fun to pretend that somehow “SuperExpressive” was the verbose established king… the Java of pattern-matching… and this snippet is from the README of an upstart competitor… a radical idea called “regex” – all you have to do is change the comment “Produces the following regular expression” to “With our approach, the above becomes the single line”, and that is the whole sales pitch.

                                                        1. 1

                                                          Fun to imagine sure but that’s not the reality. The reality is that hundreds of thousands of people have all learned Regex, and while it may not be pretty it works and isn’t actually that difficult to learn if you take the time, so GP’s point still stands.

                                                          1. 2

                                                            I think you misread my comment. I was agreeing with GP, and making the same point you are.

                                                          2. 1

                                                            I think part of it is that anything complicated enough where you’d really appreciate the readability and composability of a ‘builder’ type system… you probably shouldn’t be using regexes for in the first place.

                                                            1. 1

                                                              I think in such cases the sheer length of the builder version would still make it worse. Especially in a language like ruby that supports splitting regexes over multiple lines with inline comments:

                                                              regexp = %r{
                                                                start         # some text
                                                                \s            # white space char
                                                                (group)       # first group
                                                                (?:alt1|alt2) # some alternation
                                                                end
                                                              }x
                                                              

                                                              Fundamentally, the assumption underlying the builder approach – that verbosity is always an aid to understanding – is simply not true (see, eg, Objective C variable naming as another classic counterexample where verbosity harms readability).

                                                              1. 1

                                                                But also, this syntax doesn’t handle interpolating strings from elsewhere nicely:

                                                                foo = "?*!"
                                                                re = %r{#{foo}?bar}
                                                                # throws RegexpError (target of repeat operator is not specified: /?*!?bar/)
                                                                

                                                                You have to remember to Regexp.quote it.

                                                                And while in Ruby it looks like you can interpolate a regex into another regex because it has built-in regex literals, in Python this happens:

                                                                >>> foo = re.compile("foo?")
                                                                >>> re.compile(f"{foo}?bar")
                                                                re.compile("re.compile('foo?')?bar") # definitely not right!
                                                                >>> re.compile(f"{foo.pattern}?bar")
                                                                re.compile('foo??bar') # also not right
                                                                >>> re.compile(f"({foo.pattern})?bar")
                                                                re.compile('(foo?)?bar') # there we go
                                                                

                                                                And it has the same ‘you have to remember escape a string when you interpolate it’ problem.

                                                        1. 37

                                                          This one isn’t really a “this week”, though there will be plenty to do every week for a while, but…

                                                          I’M GONNA BE A NEW FATHER!!

                                                          Finally hit the 12-week mark and told friends/family the news, and my wife and I are absolutely ecstatic still about it. Due date is in August. So much to buy, so much to prepare, so much to learn!

                                                          1. 8

                                                            First of all, congrats!

                                                            So much to buy,

                                                            My advice, if you want it, is holding back on buying too many things. Buy the minimum and adjust. In the first weeks/month children really do not need that much stuff. They need their parents and care. They do not need all these “OMG you need all these things” on baby lists. With online ordering you can always get something quickly, if you see a need for it. We def. bought things we never needed or could get by without them easily. Less is more!

                                                            1. 2

                                                              Yes this. The stuff can take on an oppressive weight of its own.

                                                              1. 1

                                                                Fantastic advice thank you! Are there any things you can think of that are the “must buy” things right away? Don’t assume anything is “too obvious” to suggest please!

                                                                1. 3

                                                                  Diapers+wipes. Your child will either need (from my local sizing guide) “n” or “1”. Don’t overbuy the “n” but have the “1” available.

                                                                  Infant clothes.

                                                                  Onezies.

                                                                  “Burp cloths” (though any fabric that can be washed regularly as well as thrown over your shoulder will do)

                                                                  Any soft place to put down a child on the floor. (any towel or rug or carpet or possibly even hardwood will do this job.) They can roll, accidentally, long before they can intentionally roll.

                                                                  That’s it. Oh, and if you will be driving back from the place of birth, you will need an infant car seat.

                                                                  1. 6

                                                                    One secret is that you very very very badly need onesies with zippers or snaps, not buttons. The people who put buttons on infant clothes are sadists.

                                                                    1. 3

                                                                      There needs to be an ISO on the number and placement of onezie snaps because every single one puts them in different places and it’s impossible to keep straight.

                                                                    2. 4

                                                                      I would add a sleeping bag - for babies, not for camping (better 2 so you can wash/dry one) and a heat lamp for changing diapers/clothes.

                                                                      You def. do not need any sort of toy, plush animals, books, fully furnished children room or any of that stuff. That will all come a lot later. Remember the first 3 months your child is basically doing its fourth trimester, just outside the body of its mother.

                                                                      1. 1

                                                                        Hospitals give you diapers and blankets, so there’s no point in buying those now. Definitely do stock up on baby blankets when you’re in the hospital though. You’re paying for them!

                                                                        1. 1

                                                                          Not if you don’t give birth in a hospital. Home births, birthing centers, and hospitals, are all valid choices people make eyes wide open to the risks and rewards of each approach.

                                                                          1. 1

                                                                            That depends on your country/city/hospital etc. We did not get any take-home blankets or diapers from the hospital, but that may have been due to the pandemic. Not sure.

                                                                            1. 1

                                                                              We had a pandemic baby and took home a bunch of blankets again. They don’t give you the blankets; you just take them when you leave because, again, you’re totally paying for them.

                                                                              1. 1

                                                                                In your country. In my country I am not paying the hospital one cent out of my own pocket. It is all covered by public health insurance.

                                                                                1. 1

                                                                                  It’s nice that you live in a civilized country, but you’re still paying for it, just on tax day. Anyway this is not worth arguing about. Either the hospital has a bunch of extra blankets or they don’t.

                                                                      2. 1

                                                                        Yeah, we were given so many hand-me-downs I don’t think we have actually bought any clothes for our kids ourselves still, three years later. We did have to break down and buy some shoes though, alas.

                                                                      3. 4

                                                                        Congrats! It’s off topic for this forum, but I think we are really living in the golden age of parenting. Really, congrats!

                                                                        1. 1

                                                                          Why a golden age of parenting?

                                                                          1. 7

                                                                            In the past we’ve seen two extremes of “parenting” (this pseudo science to describe being responsible for little people). One extreme is Control, where you make kids do things and they will do it. The other is “Whatever kids do, they do.” We now are re-learning the lessons of time immemorial that children are little people.

                                                                            These lessons have become mainstreamed in recent years, making this the golden age of parenting.

                                                                            Show them empathy. Be the responsible one, setting bounds. Prune negative behavior, cultivate positive behavior, but don’t pretend you can declare what positive or negative behavior a child will or will not exhibit. State things the child can accomplish (You did a good job putting that puzzle together) rather than the things a child can’t change (You finished the puzzle? You are so smart!) Let children help. They will want to unless you stop them (You brought me a dozen eggs? Thank you! as opposed to Stop! Put down the eggs!) Let children play. Danger of mild bodily harm during play is good for children over time, even if occasionally individual children will need stitches or casts.

                                                                            These “respectful” styles of parenting that also don’t allow children to run roughshod over all the adults in their lives are out there. Parenting is no longer about self sacrifice or discipline above all else, but about building real relationships with little people that survive while those little people become bigger. (and of course real relationships involve sacrifice)

                                                                            Not everybody subscribes to a single worldview. But this worldview is available, with support groups for those who want them. A golden age.

                                                                            1. 2

                                                                              I presume because it was never easier to work from home and spend time with your children.

                                                                              1. 3

                                                                                if you are in tech…

                                                                                1. 1

                                                                                  As the majority of people on here are, I think :)

                                                                                2. 2

                                                                                  Not quite :) explanation

                                                                                  1. 2

                                                                                    ? You can’t watch a child and get any work done. (I guess if your job is doing social media. Paternity leave was a great time for Twitter for me.) People act like working from home makes child care easier, but all it means is you have a short commute so you can “get home” faster.

                                                                                    1. 2

                                                                                      People act like working from home makes child care easier, but all it means is you have a short commute so you can “get home” faster.

                                                                                      That is huge though. That means saving multiple hours each day for many people.

                                                                                      1. 2

                                                                                        Oh yes, it’s definitely a plus, but it seems like there’s some common misconception I run into that you can somehow both watch a baby and do work, and that is just not possible for a job with any mental demands whatsoever.

                                                                                        1. 1

                                                                                          Though you could hold a child and type, if you had a one handed keyboard.

                                                                              2. 1

                                                                                Congratulations!

                                                                                1. 1

                                                                                  Congrats!!

                                                                                  1. 1

                                                                                    Congrats!!

                                                                                    1. 1

                                                                                      Congratulations to your family!

                                                                                      1. 1

                                                                                        Mazel tov!

                                                                                        1. 1

                                                                                          Congrats! If you’re not part of it, the /r/daddit community on Reddit is pretty nice, especially for those early “are they supposed to be this exhausting?” days :)

                                                                                          1. 2

                                                                                            I feel like you just sent me down the deepest rabbit hole of my life…😂

                                                                                            1. 2

                                                                                              The answer to that question is, of course, always an emphatic yes.