1. 1

    Still no code on their GitHub profile :’(

    1. 3

      check the FAQ

      1. 5

        Needs a new distributed version control system where the versioned objects are sheets of paper and changelists are composed of paper cutouts and glue.

        1. 3

          It’ll certainly bring a fresh perspective to the “your project is still stuck on CVS?” :)

    1. 2

      Why is this a surprise? Function calls will always have slight overhead, because of the indirection of a jump. That’s why inlining is a thing.

      1. 10

        The surprising thing is I would expect {} to be syntactic sugar for dict().

        1. 3

          Really? Since {} is recognized by the parser, I’d expect to generate the opcode directly as part of the bytecode compilation pass.

          Frankly, I’m surprised that dict() doesn’t compile to an opcode, since it’s easy to inline. I guess doing that would take away the ability to rebind what dict() does in the local scope (but I don’t know why anyone would care besides that).

          1. 7

            You can even rebind it globally.

            $ python3
            >>> dict({1: 2})
            {1: 2}
            >>> import builtins
            >>> builtins.dict = list
            >>> dict({1: 2})
            [1]
            

            EDIT: use builtins instead of __builtins__, compare https://stackoverflow.com/questions/11181519/python-whats-the-difference-between-builtin-and-builtins

      1. 3

        My requirements for a laptop are pretty simple, but they’re apparently impossible to meet:

        • A sturdy, metal chassis. It shouldn’t bend easily, nor should I be able to create screen artifacts when I push on the back
        • A 1080p display or better (it’s absurd to me that many laptops today still ship with 1024x768 displays)
        • A decent keyboard
        • HDMI (or mini-HDMI) out
        • SSD, 128GB is more than sufficient
        • Not be Apple (I don’t like how locked-down their hardware is)
        • Cost less than $2500

        Thus far, I have found nothing that meets these requirements.

        1. 3

          I haven’t used one myself, but the laptops from puri.sm look pretty good. A bit of a gamble, though (small company with not much of a track record yet).

          1. 1

            Reviews on YouTube have been helpful and reassuring, in my experience.

          2. 2

            I’ve had reasonable success with the Asus ZenBook. It’s a total ripoff of the macbook air design, but I’m fine with it. Runs Linux nicely and has reasonable support for OpenBSD (sans trackpad). It’s my daily driver for when I’m at school and can’t use a huge desktop machine like I normally would.

            1. 1

              I returned the ZenBook because the fan was so noisy and would start as soon as you thought about moving the mouse. Instead, I got the HP Spectre x360, which was so silent I had to make -j something just to prove to myself that there was a fan. It also looks much better (one of the few laptops that look really good without being a Macbook ripoff).

              Both seem to run Ubuntu just fine, though I’ve of course tested the Spectre much more.

          1. 1

            But… why not just pass a lambda with a pattern match and call it a day? I know ruby doesn’t have pattern matching but a switch statement can be used with the .class method and its way less code.

              1. 5

                Some people don’t understand why URLs should not change: https://www.w3.org/Provider/Style/URI

              1. 2

                I’m not seeing this issue at all when testing with clang 4.0.1 and 6.0.0 (slightly out of date trunk), but the issue (if it exists in a different version) isn’t that function pointers are bad. That dead code should be removed in an early analysis passes of LLVM so there’s no chance of calling it later on.

                1. 1

                  FWIW, I think it’s with some versions. I see it with Clang 3.9.1:

                  > clang --version
                  clang version 3.9.1-4ubuntu3~16.04.1 (tags/RELEASE_391/rc2)
                  Target: x86_64-pc-linux-gnu
                  Thread model: posix
                  InstalledDir: /usr/bin
                  

                  with -O1:

                  0000000000400520 <main>:
                    400520:       eb ee                   jmp    400510 <_ZL8EraseAllv>
                    400522:       66 2e 0f 1f 84 00 00    nopw   %cs:0x0(%rax,%rax,1)
                    400529:       00 00 00
                    40052c:       0f 1f 40 00             nopl   0x0(%rax)
                  

                  with -O3:

                  0000000000400510 <main>:
                    400510:       bf a4 05 40 00          mov    $0x4005a4,%edi
                    400515:       e9 b6 fe ff ff          jmpq   4003d0 <system@plt>
                    40051a:       66 0f 1f 44 00 00       nopw   0x0(%rax,%rax,1)
                  

                  and I just grabbed the build of Clang 5.0.0-svn312333-1~exp1 and see it there too.

                1. 4

                  Lisp’s boast is that Code is Data. Ruby accidentally and regrettably allowed Data to become Code. Oops.

                  Huh? That’s not what’s happening - a deserialization method that allows DOSing isn’t allowing data to become code. It’s just an unsafe function.

                  While I agree that you don’t want complex functions that are difficult to audit facing the public interwebs, the entire reason I like using Ruby is because it “gives me too much power.” Ruby is a language designed for small teams of good programmers. If you want something that takes away power from the developer (and thus will always increase development time), use Java.

                  1. 5

                    the entire reason I like using Ruby is because it “gives me too much power.”

                    I don’t think the author is saying Ruby is too powerful. I think they’re saying the two problems observed here:

                    • writing a YAML parser that automatically recognizes !-directives and turns the contents into arbitrary Ruby classes
                    • writing an XML parser that automatically recognizes <id type="yaml"> tags and parses the contents as YAML

                    have the same underlying problem: Rubyists in 2013 had written libraries that were more powerful than they needed to be, and thus had vulnerabilities one wouldn’t expect the libraries to have.

                    Lisp’s boast is that Code is Data. Ruby accidentally and regrettably allowed Data to become Code. Oops.

                    Huh? That’s not what’s happening - a deserialization method that allows DOSing isn’t allowing data to become code. It’s just an unsafe function.

                    Both things are happening, actually. (Or, at least, were happening in 2013.) That there are lots of DOS attacks against XML parsers is generally true of XML parsers, but not the main point. The problem that prompted the article is that Ruby’s XML parser, in 2013, would parse embedded YAML; and Ruby’s YAML parser would interpret YAML ! directives as intended Ruby classes. So a payload like the one below would result in remote code execution. (CVE-2013-0156)

                    <id type="yaml">
                    ---
                    !ruby/object:Gem::Requirement
                    requirements:
                      - !ruby/object:Rack::Session::Abstract::SessionHash
                          env:
                            HTTP_COOKIE: "a=#{payload}"
                          by: !ruby/object:Rack::Session::Cookie
                            coder: !ruby/object:Rack::Session::Cookie::Base64::Marshal {}
                            key: a
                            secrets: []
                          exists: true
                    </id>
                    
                    1. 1

                      Comparison with lisp is not by accident, it’s the same “lisp vs unix” discourse, “The Right Thing vs Worse is better”, modernist design vs postmodernist design.

                      Fortunately, Ruby (and Rails too) is in the middle of this spectrum. On one extreme side we have Perl, on other side Clojure. Rails (which defines much of Ruby culture) is slowly moving towards modernist side in recent times because it’s in fashion now. I impatiently wait for times when Perl approaches will be in fashion again.

                    1. 4

                      I started working on a little 3D game/graphics engine in C with Chibi Scheme embedded inside. I ran into some issues with the automatic FFI code generator (for static arrays inside structs), so I’m working on a patch to correct that.

                      I’m interested to see where performance will actually be a problem, especially since Chibi isn’t an especially performance aggressive scheme. I’ve fallen into a little premature optimization trap since I decided to make vectors and matrices packed C structs rather than using a scheme vector/list for storage. I’m sure boxing/unboxing of matrices would be the source of a performance bottleneck and implementing all the important math in C should head it off before it becomes a problem. Probably.

                      1. 2

                        It’s fun to see gosu’s still around. It was the first lib I used for game development (back when I was 11 or 12 - though I spent most of the time just playing the demos :P).

                        We will instantly rule out 3D for several reasons: … Ruby may not be fast enough for 3D games

                        Why do people always say this? Sure, for the heavy duty, tight-loop number crunching matrix calculations it maybe isn’t fast enough, but it’s easy to write that part in C and bind to it from Ruby. Gosu’s primarily written in C++ anyway and has some minimal OpenGL bindings out of the box if I remember correctly.

                        With most of the boilerplate written in C, you can do a lot of the prototyping/glue code/business logic in Ruby, which is nicer with a dynamic language and a REPL.

                          1. 1

                            Whoops, you’re right. The mods could merge this post.

                          1. 1

                            I just send an email to my manager with a bulleted list of the big tasks I accomplished in a day. If they want to ignore it that’s fine, but it at least gives us both a log of what I’ve done and where I’m at.

                            1. 5

                              So css gzips pretty well… it,s a feature.

                              1. 1

                                That’s the first thing I thought too. The only other reason CSS would need to be small is maintainability, but since CSS is a hack to begin with, it’s not really worth maintaining when it works well enough with bits of duplicated CSS scattered about.

                              1. 2

                                I’ve converted my mail flow to use mblaze. Along with fsf and a few helper scripts, it’s perfect for my use. Used in conjunction with offlineimap + msmtp, and $EDITOR.

                                Never looking back.

                                1. 1

                                  What is fsf in this context? For that matter, what is mblaze?

                                  1. 2

                                    I think mblaze is this and I think fsf would be some sort of fuzzyfinder?

                                    1. 2

                                      Maybe fzf? I could see that being a nice workflow.

                                      1. 2

                                        Correct. I just hooked it up to my script and forgot about it. It does nicely with the –preview command. There’s probably more I could do with that, but for now it solves pretty much all of my mail consumption related issues

                                        1. 1

                                          I’d be interested in a more in-depth explanation of your setup, if you’d like to share it…

                                          1. 2

                                            Aside from a regular offlineimap setup and an also-regular msmtp setup, I have two scripts to help me with mblaze: one called “mymail” and one called “mshowwithawk” (which is a mouthful, but I never invoke it by hand so I don’t care.

                                            mshowwithawk is:

                                            #!/bin/bash
                                            
                                            mshow $(echo $1 | awk '{print $2}')
                                            

                                            and mymail is:

                                            #!/bin/bash
                                            mlist -s ~/Mail/$1/$2 | msort -d | mseq -S | mscan 2> /dev/null | fzf --preview="mshowwithawk {}"
                                            

                                            Usage is: mymail <any ~/Mail/ subdir that contains maildirs> . Reason for this script is I have two accounts, and I often switch between my work and personal email, so I often call it like “mymail otremblay INBOX” or “mymail work INBOX”. Next improvements are gonna be defaulting to INBOX and allowing for the -s flag to be passed or not from the mymail script (because sometimes, I need to see old mail too.)

                                            The output is a list of selectable items, with a preview of the currently selected item on the right. Yes, right in the terminal. The list is populated by mail prefixed with an ID I can then use with mshow if I need better output (say, in case the email provided a worthless (but still present) text/plain thing. I use elinks to dump out text/html messages (configurable in mblaze).

                                            I use mblaze’s “minc” to pass messages from the maildir’s new to cur, and mflag -S to flag everything as read once I’m done.

                                            I like the workflow because it is just a construction of a collection of small specialized programs working together. I mean, if needed, I can still just invoke mlist by itself and grep through email headers, if I so desire. Or pump the whole output elsewhere to any other unix-standard utility if I want to. Heck, it would be trivial to include spamassassin header parsing, or any other kind of header parsing. I’m also a sucker for CLI interfaces, mostly on account of it being the easiest way I know to compose software with one another out of small blocks. I feel like I should probably start a blog about my crap, but I’m afraid that said crap would be too trivial for people to enjoy.

                                  2. 1

                                    mblaze is indeed pretty nice (similar to mu. I use it to automate some tasks with n my email workflow (archiving, marking as done, digging up the full thread when a mail arrives, …) it helps me a ton. But when it comes to actually read and reply to mails, it doesn’t cut it, so I use mutt for that.

                                  1. 10

                                    If you’re sensitive to latency and run Linux, try hitting Ctrl-Alt-F1, and do a little work in console mode at the terminal. (Ctrl-Alt-F7 to get back.)

                                    For me this is a great illustration of how much latency there is in the GUI. Not sure if everyone can feel it, but to me console mode is more immediate and less “stuffy”.

                                    (copy of HN comment)

                                    1. 6

                                      I notice this as well - the linux console feels better, in the same way that playing CS:GO without the overhead of a desktop compositor feels more immediate.

                                      I’ve also noticed that tmux adds a lot of latency to vim in the terminal, so I’ve been running gvim or nvim-qt recently.

                                      1. 8

                                        Tmux adds a lot of latency? Especially after pressing ESC in Neovim? Try set -g escape-time 10 in your ~/.tmux.conf

                                        https://github.com/neovim/neovim/wiki/FAQ#esc-in-tmux-or-gnu-screen-is-delayed

                                        1. 3

                                          Oh, man, I’ve seen that but didn’t quite put it together (or didn’t think to look for a setting to adjust). The delay to get an ESC to “stick” was crazy long, with the result that I couldn’t get out of insert mode without resorting to press escape, sit on hands, count to six, resume typing.

                                      2. 5

                                        There is a whole lot more calculations to do in a graphical environment: align the character on the table, pick the font, compute font substitution (missing glyph get rendered with other fonts), render every glyph from their vectorial format, calculating antialiasing and hinting… and all of this on top of a framework, while it is either non-existant or built-in for text interfaces.

                                        A good compromise may be bitmap terminal (blit, acme, sam…).

                                        1. 8

                                          Happily using bitmap fonts with xterm.

                                          Drawing vector fonts is so darn slow that most things that do it at all will cache the rendered glyphs.

                                          1. 3

                                            I nominate st, the suckless terminal - http://st.suckless.org/ - It might not always the absolute fastest terminal (I’ve not tested it), and it might not have every feature anyone could ever (not) want like SIXEL and ReGIS Tektronix 4014 graphics, configurable logging, URL launching, user-tweakable selection behaviors and all that jazz that exists in xterm, but it is refreshingly simple, lightweight, and fast.

                                            1. 3

                                              And I like this term for this reason. The only 2 os I could not compile it so far is Windows and Android.

                                              1. 2

                                                st becomes a whole lot less simple and lightweight once you configure your shell to always spawn a new tmux session for every terminal just to get scrollback. I can appreciate simplicity, but there comes a point where the system becomes a lot more complex because one tool is a bit too simple.

                                                1. 2

                                                  Since we’re discussing efficiency, tmux scrolling is also inefficient. All the data in the back buffer needs to be resent to xterm. If I’m on a bad network link, I’ll sometimes start another connection, sans tmux, to run a command so that all the output gets saved in my local buffer and I can scroll it without latency.

                                                  1. 1

                                                    This is a valid point which 5 years of mosh use has made me forget about - for those who are not aware, with mosh, you aren’t sending data to the terminal as a stream of data, but instead synchronizing an “image” of the current terminal state and display, so there was never any “past” data to scroll back on.

                                                  2. 1

                                                    I am sort of shocked that anyone uses the terminal scroll back in 2017 - I’ve been using tmux for almost 10 years now, but I was using xterm in combination with screen since the early 1990’s X11R4 days and always had my systems configured this way for almost 30 years. I find using a terminal multiplexer actually removes complexity and massively increases productivity and I have no idea how I’d operate without one.

                                                    1. 3

                                                      If I was using some floating window manager, having tmux for tiling would make sense. I use i3, so my window manager handles tiling in a much more flexible way than tmux ever could (not through any fault of tmux, it just cannot tile graphical applications), so tmux is mostly unnecessary unless I need some of the features related to multiplexing or persistent sessions.

                                                2. 2

                                                  When I tried “alternative” OS’s in VM’s, they usually opened opened apps or responded to my typing instantly. They were that much faster in VM’s than the Linux system they ran on which was bare metal. My Windows systems were more responsive, too, back when I used them. I think it’s just the implementation in these GUI’s slowing things down that much.

                                              1. 15

                                                I never quite understood the appeal of pulling all nighters. After about 9 PM, I’m done for the day and don’t try to write code anymore, because I know I’m gonna bugger it up big time if I try. Same rule for studying for exams - if I really need to cram, I’ll sleep now, and wake up early later to study for it.

                                                1. 24

                                                  Different people have different cycles. Personally, I’m usually mostly useless before 3 PM and often at my most focused between 7 PM and midnight.

                                                  1. 6

                                                    Sometimes, you go on a roll. I never did it on a regular basis - but I find myself working in cycles - very intense for a week or so, then coast for a few days, then back. In the intense part, sometimes, it’s good to give in and keep coding until the part is done.

                                                    1. 21

                                                      I’ve found that it’s helpful for me to stop at a point where I know what the next step is. It makes ramping back up the next day easier, and helps maintain steady progress. If I stop when I finish something, it somehow makes it harder to get back into the groove the next time I start up. This is -especially- the case over weekends.

                                                      1. 5

                                                        Me too, but I’ve learned to watch for when I get simultaneously too tired to think and too far “in the zone” to stop. It’s sort of like berserker mode. The next day I look at what I was doing for the last hour and it’s like “oh, instead of trying to scratch through the door with bare hands, I could have just turned the knob”.

                                                      2. 5

                                                        I’m not a fan of working crazy hours but actually I’m often really productive if I eat dinner and start working around 7pm.

                                                        Maybe it’s the lack of external interruptions, I don’t know.

                                                        1. 3

                                                          until about 9pm i’m done for the day, then if i don’t stop myself i could code until ~3am

                                                        1. 8

                                                          Theories & Hypotheses says, “Intel and friends can be beat without a lot of money by using a better architecture designed for languages other than assembly and C”. I am extremely skeptical.

                                                          Yossi Kreinin wrote a pair of articles in 2008, High-level CPU challenge and High-level CPU follow-up. I believe it still stands.

                                                          1. 1

                                                            Yossi Kreinin wrote a pair of articles in 2008, High-level CPU challenge and High-level CPU follow-up. I believe it still stands

                                                            Woah, very interesting. Despite looking into this type of thing before, I hadn’t seen these two articles. He brings up some very interesting problems that I hadn’t thought of when it comes to modern processor design.

                                                          1. 8

                                                            Not surprised. News at 11.

                                                            So what useful things do lobsters people put in their motd?

                                                            My machines are named after Father Ted characters. So, naturally, all motds contain quotes from Father Ted characters. Rewatching an episode with a particular character to hunt for quotes while setting up and naming a new machine has become a ritual of mine :)

                                                            1. 11

                                                              Shameless plug, I made this years ago to make pretty pictures for my motd: https://max.io/bash.html

                                                              1. 2

                                                                This is amazing, you should post this

                                                              2. 7

                                                                So what useful things do lobsters people put in their motd?

                                                                We (Wikimedia Foundation) show: kernel and distro version, server role in puppet, last puppet run, machine installation date and last login. For example:

                                                                Linux cp1049 4.9.0-0.bpo.2-amd64 #1 SMP Debian 4.9.13-1~bpo8+1 (2017-02-27) x86_64
                                                                Debian GNU/Linux 8.8 (jessie)
                                                                cp1049 is a upload Varnish cache server (cache::upload)
                                                                The last Puppet run was at Fri Jun 30 07:30:49 UTC 2017 (22 minutes ago). 
                                                                Debian GNU/Linux 8 auto-installed on Fri Mar 13 17:57:50 UTC 2015.
                                                                Last login: Thu Jun 29 15:51:39 2017 from bast3002.wikimedia.org
                                                                
                                                                1. 3

                                                                  Nothing. Our servers are terminated and replaced on a frequent enough basis that spending time on MOTDs would be a waste.

                                                                  1. 3

                                                                    That’s very pragmatic, but also a bit boring. No time for easter eggs?

                                                                    If no other lobster replies to this thread, yer all a bunch of boring bishops ;)

                                                                    1. 2

                                                                      some figlet and lolcat action for me. variety is the spice of life.

                                                                      1. 2

                                                                        Our easter eggs mostly end up in some other part of the stack. SSH-ing into a machine is pretty much reserved for major outages.

                                                                        1. 1

                                                                          I miss Easter Eggs. The Word and Excel ones were fun to show kids in class. Also a lesson about the threat of subversion where management and/or customers didn’t notice an entire game hidden in their office software. “Code rah… review? I don’t think we’ve done anything like that over here…” ;)

                                                                          1. 0

                                                                            No time for easter eggs?

                                                                            No time for celebrity worshipping.

                                                                            1. 10

                                                                              Easter eggs don’t necessarily involve a personality cult. They can just be silly jokes.

                                                                        2. 3

                                                                          I only put the most import things: http://ix.io/y6E (best viewed in terminal)

                                                                          1. 3

                                                                            So what useful things do lobsters people put in their motd?

                                                                            The server hostname.

                                                                            1. 2

                                                                              I normally use a template and regenerate stats about the system using cron. Things like tailing the last few entries from auth.log etc, nothing too fancy.

                                                                              1. 2
                                                                                > cat /etc/motd
                                                                                mksh: cat: /etc/motd: No such file or directory
                                                                                

                                                                                guess I’m a boring bishop too :(

                                                                                1. 2

                                                                                  Nice to see another Father Ted fan here - I’m surprised you haven’t created a custom fortune data file just for the purpose :)

                                                                                  Although almost all of my personal systems are configuration managed, I do still log in to them regularly (they’re halfway between pets and cattle) so a customised MOTD is something I’ve been meaning to look at for ages. Something showing load, pending package updates, etc (I only automatically install security updates). One day…

                                                                                  1. 2

                                                                                    I normally use update-motd to show a summary of key services the machine handles. Helps to prevent “oops” moments because you forgot what services it runs and reboot/etc.

                                                                                  1. 5

                                                                                    I like the idea - wish there were more examples though.

                                                                                    1. 3

                                                                                      Work (GSoC): Comparing benchmarks for LLVM’s LTO vs ThinLTO. Mainly trying to determine which passes are missing in ThinLTO so I can figure out how to make it faster.

                                                                                      Side projects: Found out about RPython this last week (in this blog post), and decided that getting a JIT for free would really speed up my development (since writing a bytecode vm from scratch in C is quite a bit of work). I wrote a simple SECD bytecode interpreter in C already, so I started rewriting it in RPython. Development is way faster, so I have a much better chance of actually getting a language project out the door and bootstrapped for once :)

                                                                                      Also, toying around with implementing a text editor in Scheme. I love Vim’s bindings, minimalism and modal editing, and hate it’s configuration. I love emacs configuration, but dislike it’s general buginess (in my experience) and overall bloat, so I decided to try and see if I could have the best of both worlds. If it ever gets anywhere usable, I’ll post it on GitHub.

                                                                                      1. 2

                                                                                        Remember you can always iterate in a high-level language that you can extract to C for its benefits. The trick is is using a subset of that language that corresponds pretty closely to C. If dynamic, keep the types, expected ranges, and similar info in the comments as you write the high-level code to ease the transition to static typing.

                                                                                        The next level of it is turning that into a DSL in a language like Racket or Haskell that automates the generation of the C code. One example is Ivory DSL in Haskell that generates safe, embedded C.

                                                                                        1. 2

                                                                                          You just described rpython which is what he is using.

                                                                                          1. 0

                                                                                            I just described LISP (esp Racket or CL), Haskell, and term-rewriting with many benefits over RPython. People wanting enhanced readability for average programmer, less flexibility, less safety, and/of less performance will find RPython a compelling alternative to a mature LISP or Haskell. ;)

                                                                                          2. 1

                                                                                            I’d far prefer to use Racket or some Lisp variant to build the interpreter (as I’m building a Lisp-y language and just like Lisp way better than Python). However, RPython has one killer feature: it generates a tracing JIT from the interpreter.

                                                                                            The reason it works is because RPython traces the interpreter rather than the executed program which makes it work for any interpreter that you write. PyPy is stupid fast, so I’m willing to put up with the annoyance of developing python for the speed payoff I’ll be getting.

                                                                                            1. 1

                                                                                              That’s a great reason to use it. Also one of my favorite things about it.

                                                                                        1. 4

                                                                                          Wow, this is one of the most well written graphics posts I’ve read recently. I like how the author shows the first approach you could take, then explains why it wouldn’t work, and offers a better alternative.

                                                                                          Also, Lua and retro consoles are lots of fun :)