HNHacker News
TopNewBestAskShowJobs

lzybkr

78 karma · joined April 4, 2014

submissionscomments
lzybkr··on Writing a debugger from scratch: Breakpoints
Not 5 levels, but I once wrote debug visualizers for a compiler using funceval (the visualizer uses the debugger to run code in the target process).

I think I once had to debug the debugger debugging the compiler compiling itself which felt like another really weird kind of recursion.

lzybkr··on Windows Subsystem for Android
It's about trademarks - see https://twitter.com/richturn_ms/status/1245742145119510529
lzybkr··on Ask HN: Best way to host a website for 500 years?
Microsoft Research has been working on DNA storage: https://www.microsoft.com/en-us/research/project/dna-storage...
lzybkr··on How does apt render its fancy progress bar?
Saqib Shaikh, a blind developer at Microsoft, gave this short talk on using Visual Studio: https://www.youtube.com/watch?v=94swlF55tVc

I realize this isn't a console, but I think it is a good demonstration of an expert doing typical developer activities.

lzybkr··on Curl Wttr.in
PowerShell can be shorter by 1 character for this use case:

  irm wttr.in
irm is an alias for Invoke-RestMethod which is similar to Invoke-WebRequest but better for non-html responses like json or plain text.
lzybkr··on Show HN: A syntax highlighter for Git and diff output, written in Rust
If you to use this on Windows, you'll need to update `less.exe` with my patched version - https://github.com/lzybkr/less/releases/tag/fix_windows_vt
lzybkr··on Show HN: A syntax highlighter for Git and diff output, written in Rust
It does not, but it seems like a popular request: https://github.com/dandavison/delta/issues/40
lzybkr··on Freeman Dyson Has Died
I guess it's time to reread Starship and the Canoe - a great book about Freeman's nuclear weapon powered spaceship and his son George's interest in building boats. I thoroughly enjoyed it 25+ years ago.
lzybkr··on MS TextWorld: open-source engine that both generates and simulates text games
AFL might eventually get lucky, but I'm guessing you'd want a hybrid approach that combines symbolic execution with a fuzzer like AFL, e.g. QSYM [1].

[1] https://www.usenix.org/system/files/conference/usenixsecurit...

lzybkr··on Rust 1.32 released
Visual C++ has the __debugbreak() intrinsic function.

If you have JIT debug enabled, you will be prompted to attach your debugger to the process when hitting such a breakpoint.

lzybkr··on 12 Factor CLI Apps
With PSReadLine, you can change that:

  Set-PSReadLineOption -EditMode Emacs
Or

  Set-PSReadLineKeyHandler -Key Tab -Function Complete
lzybkr··on Creating a bash completion script
I'm optimistic about binaries providing completions, I think we'll see more of that as tools adopt frameworks like https://github.com/clap-rs/clap or https://pypi.org/project/argcomplete/ which can provide completions for your favorite shell.

But I do think many important/useful binaries will never provide completions, or provide sub-par completion that people will want to improve, so we can't ever count on completions from binaries.

Recently I've been thinking some about how the LSP (https://microsoft.github.io/language-server-protocol/) might be useful for a CLI. A readline implementation could use something like a LSP for syntax coloring and completion.

Imagine having a consistent editing in your favorite shell, repl, and editor.

lzybkr··on "Pwned Passwords" V2 With Half a Billion Passwords
Here is a quick PowerShell script - it supports the pipeline so you can automate, e.g. if you use a command line password manager.

https://gist.github.com/lzybkr/85b4dbd6536ea5351e8d8e492a432...

lzybkr··on Microsoft Has Manually Patched Their Equation Editor Executable
I have no specific insight to this patch, but I do have personal experience binary patching a popular Microsoft product.

My patch was to the VC++ compiler nearly 20 years ago. We had source, and my fix was also applied to the source (which I'd imagine is still there today), but a binary patch also made sense in the short term.

The binary that I patched was used to build another important Microsoft product, and this bug was found late in the product cycle where any compiler change was risky.

We weren't 100% confident we had the exact sources used to build that version of the compiler (git would have been handy then), we only knew, plus or minus one day, what the sources where.

After carefully evaluating the binary patch versus the risk of building from uncertain source, the binary patch was taken to reduce risk.

I'm no reverse engineer, but this was a pretty interesting exercise in RE even though I had sources. I had no symbols, and the binary was optimized so that functions were not contiguous, cold paths were moved to the end of the binary. Just finding the code I needed to patch was not easy.

The code review was fun - a dozen or so compiler engineers reviewed the change on paper printouts - the most thorough review I've had in my career, and the only one that used paper.

To the best of my knowledge, this binary was never used to build anything other than that specific version of the product which I won't name - not that it matters really, the product is still in use, but that version is unlikely to be in use anywhere anymore.

lzybkr··on Some Excel users pop F1 off their keyboards (2012)
I wrote PSReadline (readline for PowerShell) and never bothered implementing overwrite mode.

It took about 3 years before anyone complained, and I think there is still just the one complaint.

lzybkr··on Getting started with the F# and .Net ecosystem
It's used in production for Microsoft Security Risk Detection - here is a good blog post describing how F# is used: https://blogs.msdn.microsoft.com/dotnet/2016/12/13/project-s...
lzybkr··on Looking Forward: Support for Secure Shell
At least a few people want vi-mode in the shell, see https://github.com/lzybkr/PSReadLine/pull/101
lzybkr··on Looking Forward: Support for Secure Shell
To be clear - the ISE (powershell_ise.exe) doesn't support interactive console apps. powershell.exe supports them just fine.
lzybkr··on Introducing PackageManagement in Windows 10
It hasn't been announced anywhere unless you count random tweets. I should post something on the PowerShell team blog one of these days.
lzybkr··on Introducing PackageManagement in Windows 10
Try https://github.com/lzybkr/PSReadLine - included in Windows 10 now.
lzybkr··on The Lost Art of C Structure Packing
I take it back, the VC++ options are C++ only (faulty memory, it's been too long.)

There is a warning I added which does work in C (https://msdn.microsoft.com/en-us/library/t7khkyth.aspx). As I recall, this warning is sometimes useless (unless it's been improved upon), so it's best to turn it on only when you're investigating packing.

You make a good point about C code not compiling as C++ as much as it used to, but that's probably less true for VC code.

And I should point out - often, for the purposes of tuning, you can extract just what you need from some code, get that small chunk of code compiling as C++, and leverage your compiler's dumps.

Last thing - debuggers also know the layout of your objects. windbg's 'dt' command can show you the object layout - I'm sure other debuggers have a similar command.

lzybkr··on The Lost Art of C Structure Packing
I implemented the VC++ options - they work in C.

I have no experience with the others, I've just briefly read about them and assume they are similar. If they don't work in C and you would find the dumps useful, try compiling as C++.

lzybkr··on The Lost Art of C Structure Packing
Most commonly used compilers have options to help find padding that is possibly not needed.

VC++ has a couple of undocumented (but well known and discussed) options /d1reportAllClassLayout and /d1reportSingleClassLayout.

GCC has -fdump-class-hierarchy

CLANG has -cc1 -fdump-record-layouts

lzybkr··on Microsoft Announces Windows 10
Not out of the box, but ctrl+v works with https://github.com/lzybkr/PSReadLine
lzybkr··on AirWheel electric unicycle review
I tried a Solowheel a couple years ago with a group of other unicyclists. I thought we'd all have no troubles the first try, but it did take a couple minutes to get the hang of it. I thought the training wheels actually slowed down our learning.

After a bit, most of us had no troubles going up and down a very steep hill or going full speed on the flats.

It was fun to try, but I couldn't see buying one - too expensive. I also found my shin bones hurt after an hour of messing around.

lzybkr··on Microsoft Open Sources C# Compiler
You can get bash style completion in PowerShell with https://github.com/lzybkr/PSReadLine.