The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,861 other subscribers

Archive for the ‘Scripting’ Category

Jan-Piet Mens :: A shell command to create JSON: jo

Posted by jpluimers on 2023/08/30

Stumbled across something that goes well with jq (the sed for JSON of which I wrote about before), [Wayback/Archive] Jan-Piet Mens :: A shell command to create JSON: jo:

Read the rest of this entry »

Posted in Development, JavaScript/ECMAScript, jo, jq, JSON, Scripting, Software Development | Leave a Comment »

.NET/C#: Small command-line tool to query REST JSON results from a batch file.

Posted by jpluimers on 2023/08/29

Often the power is in the combinations of tools.

Read until the epilogue…

Prologue

In this case, I needed to be able to query the JSON results of calls to REST services from the command-line so I could process them in Batch files.

Since I could not find anything readily available, I originally Originally I opted for theΒ PowerShell command-line scripting tool, as that ships with recent Windows versions and can re-use anything that .NET brings. But though [Wayback/Archive] .NET has built in JSON serialization support, there is [Wayback/Archive] no querying support in it.

Then I thought about Delphi, as it [Wayback/Archive] too has a built-in JSON parser, but even the well known [Wayback/Archive] JSON SuperObject library has no query support.

Back to .NET, which – like Delphi – has a well known and respected third party JSON library as well: [Wayback/Archive] NewtonSoft JSON aka JSON.netΒ and that one [Wayback/Archive] does have support for querying JSON with the SelectToken function.

That’s the fundament of the rest of this article, with the potential to be used in a cross-platform as well.

So no need for a plan B.

Read the rest of this entry »

Posted in *nix, *nix-tools, .NET, Batch-Files, Conference Topics, Conferences, Development, Event, JavaScript/ECMAScript, jq, JSON, Power User, Scripting, Software Development, Windows, Windows Development | Leave a Comment »

Bruce Tate on Twitter: “What’s the most unique feature of your favorite programming language?”

Posted by jpluimers on 2023/08/24

For my link archive: [Wayback/Archive] Bruce Tate on Twitter: “What’s the most unique feature of your favorite programming language?” / Twitter

From the languages that I have been using most:

It was a kind of follow-up on his earlier tweet that also sparked nice responses at [Archive] Bruce Tate on Twitter: “What is a #programming technique or construct that other people like but you think is overused?” / Twitter.

In my respons I phrased my decades long pet peeve [Archive] Jeroen Wiert Pluimers on Twitter: “@redrapids OOP: inheritance over composition. This leads to deep hierarchies that eventually nobody understands.” / Twitter.

Whereas with OOP (object-oriented programming) one should use composition over inheritance, often the reverse is true.

Actually my take can be generalised into two directions as these hierarchies:

  1. often crowd a single namespace, so: crowding namespaces is bad.
    One does see this outside the Object Oriented realm a well.
  2. often have many levels of indirection, so: overdoing indirection is bad
    One does see this outside the Object Oriented realm a well, just not as pronounced.

–jeroen

Posted in .NET, C#, Conference Topics, Conferences, Delphi, Development, Event, JavaScript/ECMAScript, Pascal, Scripting, Software Development | Leave a Comment »

Some notes on the WordPress Press-This bookmarklet

Posted by jpluimers on 2023/08/23

I want to improve my WordPress blogging experience especially since most of the pages I link also have two extra links of the archived pages in the Wayback Machine and Archive.is.

The WordPress Press-This bookmarklet does not always cut it. It is slow too as it does a POST request to the WordPress site which then renders a new page.

It is also highly minified, so below are some links that will hopefully allow me to research it further to see if I either could improve it for my own workflow, or need to start from scratch.

I want to figure out:

  • what the values of the v= version parameter were (I know about v=8 and v=4, there are likely more)
  • which commits were involved
  • can I get more information (like summary, first heading or first paragraph of a page too)
  • what techniques are used for opening new windows/tabs

TODO: make diffs of the various versions

–jeroen

Posted in Bookmarklet, Development, JavaScript/ECMAScript, Power User, Scripting, SocialMedia, Software Development, Web Browsers, Web Development, WordPress, WordPress | Leave a Comment »

Bookmarklet to save a page both in the WayBack machine and Archive.is (ending on the latter to solve a reCAPTCHA)

Posted by jpluimers on 2023/08/22

TL;DR:

javascript:{h=location.href;open('https://archive.is/?run=1&url='+encodeURIComponent(h));location.href='https://web.archive.org/save/'+(h)}

Read the rest of this entry »

Posted in Bookmarklet, Development, JavaScript/ECMAScript, Power User, Scripting, Software Development, Web Browsers, Web Development | Leave a Comment »

Burninator Sec: Twitter Removed the Blocked Account Export – Let’s Put it Back!

Posted by jpluimers on 2023/08/18

Hoping I can still use the Twitter API to perform thousands of requests: [Wayback/Archive] Burninator Sec: Twitter Removed the Blocked Account Export – Let’s Put it Back!

I dug around in the Data Archive and eventually found block.js, which is a JSON object of all the blocked accounts in their ideas. From there you can write a quick Python script to use the Twitter API to resolve all of those IDs to usernames.

Related: [Wayback/Archive] How to download your Twitter archive and Tweets | Twitter Help.

Via [Wayback/Archive] twitter export blocklist – Google Search and

Read the rest of this entry »

Posted in Development, Python, Scripting, SocialMedia, Software Development, Twitter | Leave a Comment »

Figuring out the threads for processes ran by python

Posted by jpluimers on 2023/08/17

A while ago I wrote about Figuring out the open network connections for processes ran by python, which explained the TL;DR:

pidof python | tr " " "\n" | xargs -r -n 1 lsof -i -a -e /run/user/1001/gvfs -p 

Now I needed thread information as well, so below two examples using ps and pstree. I won’t explain the pidof and xargs stuff here as that was already covered in the above blog-post and I found out that ps already has a built-in way to filter on process name.

The ps solution uses the H, -L or -T argument to show the threads:

Read the rest of this entry »

Posted in *nix, *nix-tools, bash, Development, lsof, Power User, ps, Scripting, Software Development | Leave a Comment »

Youtube – Extract Meta Data – Amnesty International

Posted by jpluimers on 2023/08/16

Cool that Amnesty International can do a YouTube [Wayback/Archive] Extract Meta Data (Amnesty International).

Via:

I wonder if I can write a Bookmarklet for this (it will likely require an HTTP POST request).

–jeroen

Posted in Development, HTML, JavaScript/ECMAScript, LifeHacker, Power User, Privacy, Scripting, SocialMedia, Software Development, Web Development, YouTube | Leave a Comment »

Bookmarklet for Archive.is to navigate to the canonical link

Posted by jpluimers on 2023/08/15

This is a follow-up to Bookmarklets for Archive.is and the WayBack Machine to go to the original page.

Archive.is has two kinds of URLs:

  1. The encoded version is the short form without any meta-information,
  2. The canonical version is a long form and has metadata about Archive date and time, and the Archived URL,

You get the first URL both after archiving and when browsing from an archived page to another archived page (if it is not archived you will go the unarchived full page URL).

Read the rest of this entry »

Posted in archive.is / archive.today, Development, Internet, InternetArchive, JavaScript/ECMAScript, Power User, Scripting, Software Development, WayBack machine | Leave a Comment »

Gradual Hedy programming language supports many numerals: easier for people not using English or not using Latin based alphabets

Posted by jpluimers on 2023/08/10

Yesterday, I wrote about Learn to program the gradual way: Welcome to Hedy! and today is the next installment: about numerals.

[Archive] /Fay-lee-nuh/ (@Felienne) | TwitterΒ kind of by surprise discovered that the ten numerical digits of the decimal numeral system used in virtually all programming languages are not the original Arabic forms.

Supporting other forms of decimal numerals will help learning to program when your background is non-English or even using ten systems outside the Arabic numeral realm so common in Latin alphabets. And they are a fun learning exercise for every body too!

Some of the related Tweets on this:

Some more related Wikipedia links:

In the Unicode pages, look for “numeral”, “number”, and “numeric” (or just for “num”).

–jeroen

Posted in Development, Hedy, Learning/Teaching, LifeHacker, Power User, Scripting, Software Development | Leave a Comment »