Hacker News new | past | comments | ask | show | jobs | submit | smy1es's comments login

This kind of thing was one of the reasons Visual Basic macros for Microsoft Office was so successful. You can perform actions in Word, Excel, watch the macros they produce then customise themselves to your needs afterwards in code. It is a simple and powerful concept, so good to see it in curl.


While it doesn't appear to have been updated in many years, Microsoft built a similarly useful tool[1] that lets you browse the structure of a given Office document and see C# code that generates various components of it.

[1] https://github.com/dotnet/Open-XML-SDK/releases/tag/v2.5


I was going to say, there has to be a generic pattern for things like this. Also made me think of AREXX on the Amiga.


There is, but we need to throw away our outdated current programming model. Think Lisp or Smalltalk. There should not be a separation between program written in some language, operating system and shell [1].

You'd simply run:

    CURL url: "https://example.com" method: 'post
in an interactive system, that can either represent your shell, or your application code. We need --libcurl because UNIX is not an interactive environment, so there is an enormous abyss between runtime and compile time.

(Syntax in this example from a Smalltalk-like environment I have been designing, should be understandable enough)

---

1: "An operating system is a collection of things that don't fit in a language. There shouldn't be one." — Dan Ingalls, 1981


What you're looking for exists, it's powershell.

    Invoke-WebRequest -Method 'Get' -Uri 'https://example.com'
And the response is a typed object:

That you can pipe properly by piping objects not strings, e.g. :

    Invoke-WebRequest -Method 'Get' -Uri 'https://example.com' | Select-Object -ExpandProperty Headers
Outputs:

    Key            Value
    ---            -----
    Age            438810
    Vary           Accept-Encoding
    X-Cache        HIT
    Content-Length 1256
    Cache-Control  max-age=604800
    Content-Type   text/html; charset=UTF-8
    Date           Mon, 29 Jan 2024 15:08:42 GMT
    Expires        Mon, 05 Feb 2024 15:08:42 GMT
    ETag           "3147526947+ident"
    Last-Modified  Thu, 17 Oct 2019 07:18:26 GMT
    Server         ECS (nyb/1D15)


Yes yes, power shell is powerful and really good. I wanted to hate it because it seems too verbose and I don't like the mix of capitals and hashes in names. but the APIs they make available from .Net are pretty phenomenal. Extreme verbosity aside, done day I'm have to seriously learn it


For simple interactive usage aliases go a long way, and with tab completion it gets really fast to write. For example, Invoke-WebRequest is iwr, Select-Object I think is just select. Some others are ForEach-Object which is %, and Where-Object can be ? Or where. Also, since PowerShell is case insensitive, you don't really need to use all those capitals - the worst you'll get is a warning from your editor, if it has PowerShell integration (around 99% sure about this)


It also has tab completion of parameters, so you can tab complete not just commands but things like -ExpandProperty too


I think you don't even need to type out the whole option, just the first few letters most of the time? I haven't used PowerShell in a bit, but I think if you have a command with a -Force option, but just type -f, it will go through as -Force, if and only if the command doesn't have any other options starting in f


Can't hate it, but I can't love it either. I wish some other more "normal" languages (Ruby? Python?) had a better "shell" story and dotnet integration.


For so long I have dreamed of a ruby-like shell language. At one point I even built a prototype that was a ruby DSL, but I found myself continually having to implement functions and it never seemed to get to a point where I could use it all day and not run into missing functionality that I had to add. Some day I'll return to it, but it will have to be a day when I don't have a real job :-D


For Python, https://sh.readthedocs.io/ is very nice, but unfortunately no Windows support.


Can you copy and paste that snippet as is into a C# program? This is what I meant.

Powershell has a high level object model but it doesn't make Windows itself anymore programmable and interactive, as a whole than zsh does for Linux. It is no Lisp Machine.


Given that we already have the concepts of exported entry points and extern in C, this should already be possible to a certain extent. The only other thing which needs to happen is that ELFs should have the concept of exported data structures, so while "URL" might not be a defined structure in the OS, something like curl can provide it.

Too bad we're stuck with UNIX/POSIX model - you could even take this idea of exported data structures and have the terminal represent data in the preferred users format instead of having tools like jq.


We have dlopen and we can list exported symbols, but we have no information about a function's arguments, ABI and calling convention, so it's pretty much impossible to turn UNIX into a fully late-bound and interactive REPL. Same issue with syscalls.

The only way is starting from scratch, with a novel approach and programming model.


Why can’t you add additional data about the data types of parameters in a separate ELF section? It would be only used by programs that look for it like a specially designed shell.

The calling convention can be assumed to be the same as used by the OS/arch combination.


You could, but you then have to recompile the world with this new information stored as a ELF header or something, and good luck if the library is not written in C (so it has its own conventions, ABI, memory model and binary format)

I'm talking about the status quo today, not how you can improve in a perfect world where everybody adopts a better way of doing things.

Implementing an half-baked Smalltalk layer on top of UNIX will not turn UNIX into a Smalltalk environment.


Or you could add some more sections to object files. Just make clang and/or gcc export function signatures, structs, enums, and typedefs


I wonder if one of the existing interpreted languages (python/javascript/ruby/whatever) could maintain a patch for llmv/gcc which did exactly that and in the process make the most incredible seamless integration ever between itself and C (and also C++ now with its ABI stabilizing!)


With CLR assemblies, you get rich embedded metadata including UDTs like structs and unions, and architecture-portable JIT-compiled bytecode to boot - both sufficient to map the entirety of C data and execution model.


PowerShell?


You might find this work and talks on liballocs by Stephen Kell interesting. The pitch is how to enable smalltalk like reflection for unix as it exists today. https://www.humprog.org/~stephen/#works-in-progress


I saw his talk on the topic, but his home page has a lot of good reading material. Thanks for sharing!


Or the excel side by side xaml/UI of the wpf editor in visual studio.


I'm wondering where it is getting the data for the high-resolution buildings?

For example, Big Ben at the Houses of Parliament in London has a detailed model, and so too does nearby Westminster Abbey, and several famous structures nearby.

https://demo.f4map.com/#lat=51.5006147&lon=-0.1253329&zoom=1...


It looks like there is a JSON[1] mapping OSM (id's?) to textures[2] and a .bis file which I believe is a 3D model format.

This is super impressive. I've been working on shademap.app for the past few years and they've implemented it's main functionality as an afterthought.

[1] https://models.f4map.com/cacheForever/24b0c4ec554a244c253e6a...

[2] https://models.f4map.com/cacheForever/e9e7a1217400e3fae1e56e...


I really love this analysis of a Bach prelude. It really brings home the complexity that Bach must have deliberately put into the piece.

https://youtu.be/l5XJdHfPc5o


How about similar things in other languages? Chinese, German maybe?


The problem is that the efforts tends to just instantly become a crappier version of the English-speaking original that most people are going to use instead.


This kind of platforms should punish that kind of simple translated versions, then reward original texts to motivate content creation at the non English native language


seconded! would love to see hn in other languages.


The other way this could be done is if TLS-SRP was more widely supported. This variant of TLS doesn't depend on certificates at all and instead uses mutual knowledge of a password to authenticate the connection in both directions. In the case of a router this would be written on a sticker on the device for initial configuration.


SRP would be extremely interesting for the web configuration interfaces for IoT devices. We want TLS even locally, but trusting vendor suppled certificates is bad. Implementing SRP on IoT devices would solve these problems, but would need much better support of SRP from the browser vendors.


Actually, that is the reason Apple HomeKit, that is designed mostly for IoT devices (WiFi, BT), uses SRP as part of the authentication process during pairing.


It works well for me in several platforms.

What would improve it is when you zoom, with the mouse wheel or gesture if it would zoom in on the mouse cursor point rather than at the centre of the screen.


I'm pretty impressed by this. It certainly shows a whole bunch of stuff happening near me that I had no idea about.

So, how many videos are typically geotagged on Youtube? Most of them, or just those uploaded from phones and tablets with GPS?


Same thoughts here. Nothing really impressive in my case, but since I'm used to think that where I live is pretty boring place it's somewhat relieving to see that there's actually life happening around me.

I guess I should take a walk more often.


Thank you! Usually, travel videos are geotagged, you can search with keyword "street food", "restaurant", "trip", "travel". And that is the primary purpose of the site.


Nice work. How do you determine the destination SSL library?


Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: