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,854 other subscribers

Archive for the ‘Development’ Category

Getting the primary IP address (plain and CIDR) on Linux and OS X, then nmap scan on the associated subnet

Posted by jpluimers on 2021/12/13

The below answer works on my Linux and OS X systems (each having multiple network adapters configured):

[WayBack] bash – How to get the primary IP address of the local machine on Linux and OS X? – Stack Overflow

ip route get 1 | awk '{print $NF;exit}'

For Linux, I have this bash function:

# note the ";exit" lists the first default route interface, as there can be multiple
function nmap-fingerprint_network_of_default_interface() {
        default_if=$(ip route list | awk '/^default/ {print $5;exit}')
        default_if_cidr=$(ip -o -f inet addr show $default_if | awk '{print $4}')
        nmap -sP $default_if_cidr
}

And for OS X this one:

# requires ipcalc
function nmap-fingerprint_network_of_default_interface() {
        default_if=$(route -q -n get default | awk '/interface:/ {print $2;exit}')
        default_if_address=$(ifconfig $default_if | awk '/inet / {print $2;exit}')
        default_if_netmask_hex=$(ifconfig $default_if | awk '/inet / {print $4;exit}')
        default_if_network_bit_count=$(ipcalc --nocolor --class $default_if_address $default_if_netmask_hex)
        default_if_cidr=$(echo "$default_if_address/$default_if_network_bit_count")
        nmap -sP $default_if_cidr
}

These are the variables used:

  • default_if: network interface of the default route
  • default_if_cidr: IPv4 CIDR of the network interface of the default route (see Classless Inter-Domain Routing: CIDR notation – Wikipedia)
  • default_if_address: IPv4 address of network interface of the default route
  • default_if_netmask_hex: hexadecimal IPv4 network mask of network interface of the default route
  • default_if_network_bit_count: number of set bits in the IPv4 network mask of the network interface of the default route

Links used to get the above functions:

I might have gotten away with a pure bash solution (see [WayBack] Bash script for calculating network and broadcast addresses from ip and netmask or CIDR Notation · GitHub or my post Getting your local IPv4 addresses, netmasks and CIDRs), but the above works and is way shorter, and easier to maintain.

In stead of ipcalc, subnetcalc can do the same calculations and also supports IPv6, so that is something for a future try:

–jeroen

Posted in *nix, *nix-tools, Apple, bash, Color (software development), Development, Mac, Mac OS X / OS X / MacOS, Power User, Scripting, Software Development | Leave a Comment »

The IDEA project – an ongoing series of nonverbal algorithm assembly instructions

Posted by jpluimers on 2021/12/10

I wonder how many new algorithms were added, as the first 6 were really impressive: [WayBackIDEA on Twitter: “Excited to announce the IDEA project – an ongoing series of nonverbal algorithm assembly instructions: https://t.co/zOAyfOAv3l… https://t.co/epQfBBdzdF”

While originally scheduling this, these were added:

Read the rest of this entry »

Posted in Algorithms, Conference Topics, Conferences, Development, Event, IKEA hacks, LifeHacker, Power User, Software Development | Leave a Comment »

Splitting the ping

Posted by jpluimers on 2021/12/09

Cool tool that shows the asymmetric timing character of networks (usually because the send and receive paths are different): [Wayback] Splitting the ping

split-ping is a tool that can tell you what direction packet latency or loss is on. This is handy for network debugging and locating congestion.

The blog above explains the reason and details in great depth. Recommended reading.

Source code: [Archive.is] benjojo/sping: Split ping, see what direction the loss or latency is on

It is supposed to work better than [Wayback] cmds/isoping.cc – vendor/google/platform – Git at Google

 * Like ping, but sends packets isochronously (equally spaced in time) in
 * each direction.  By being clever, we can use the known timing of each
 * packet to determine, on a noisy network, which direction is dropping or
 * delaying packets and by how much.
 *
 * Also unlike ping, this requires a server (ie. another copy of this
 * program) to be running on the remote end.

Via:

–jeroen

Read the rest of this entry »

Posted in Development, Go (golang), Network-and-equipment, Power User, Software Development | Leave a Comment »

Playing around with spammers is easy

Posted by jpluimers on 2021/12/09

Thread start: [Archive.is] Boris Veldhuijzen van Zanten on Twitter: “I created a fake company to play around with spammers, and it is just such a joy to use, and you can use it too. A thread: I receive an email from a scammer/spammer. Like this:… “

Archived unroll: [Wayback] Thread by @Boris on Thread Reader App – Thread Reader App.

Via: [Archive.is] Boris Veldhuijzen van Zanten on Twitter: “Or, next time you receive spam reply with this: “Please forward this email to bill@noprocurement.com, and delete my email, as I’ll be changing jobs soon, and this email address will no longer be active.””

The [Archive.is] inspiration partly came from [Wayback] The Story of Lenny, the Internet’s Favorite Telemarketing Troll:

Lenny is a decade-old chatbot designed to troll telemarketers that has developed a cult following online. It’s remarkably convincing, but is it actually effective?

Research indicated that Lenny is effective and wastes time of scammers which they cannot spend on calling real people.

Some highlights

Waste time by sending spammers in an auto-reply loop of personas.

“Please forward this email to bill@noprocurement.com, and delete my email, as I’ll be changing jobs soon, and this email address will no longer be active.”

One of the email forwards bounces:

There even is a (http-only) web-site [Wayback] Nordic Procurement Services – Providing Procurement services worldwide since 1994.

A plugin for gmail or other mail systems would be cool, just as having more domains and accounts:

Some people are already adding these to their own domains:

Be sure to spread the word.

Oh, and have some spammers contact john@noprocurement.com

–jeroen

Posted in Development, LifeHacker, Power User, Software Development, SPAM | Leave a Comment »

Jan Schaumann: “The secret language of coders, part N of many. Today: “risk acceptance”… “

Posted by jpluimers on 2021/12/08

From a while back, but more relevant than ever:

[Archive.is] Jan Schaumann on Twitter: “The secret language of coders, part N of many. Today: “risk acceptance”… “

Obligatory video below the fold.

–jeroen

Read the rest of this entry »

Posted in Development, DevOps, Infrastructure, LifeHacker, Power User, Security, Software Development | Leave a Comment »

In case I ever need rails performance troubleshooting: I feel like I should be able to ask @datadoghq “What’s the CPU load across all our Rails controllers”, but have no idea where to start with that.

Posted by jpluimers on 2021/12/08

Just in case I need to do performance troubleshooting in Rails some day: [Archive.is] hey on Twitter: “@shelbyspees @honeycombio From a browser. Thinking is we had trouble even narrowing it down to a section of the site. Thinking if we could see that most of the load was in some_controller we could maybe dig in there. I don’t want to take up too much of your time, but how would a double request show up?” / Twitter

Posted in Development, Ruby, Software Development | Leave a Comment »

Chrome Print dialogue not offering fit to page, landscape, other printing options ( I’m looking at you @OHRA )

Posted by jpluimers on 2021/12/08

Some sites manage to disable various printing options (including layout, so you cannot choose between landscape and portrait any more, or force landscape when portrait works better or vice versa).

Googling this got me into a web of things that didn’t help me (see links below), but those led me to this query [Wayback] chrome save as pdf layout missing portrait landscape – Google Search.

That returned a helpful result at [Archive.is/Wayback] Chrome Print dialogue not offering fit to page, landscape, other printing options – Google Chrome Community:

I found a solution.

1.  Install the Stylus Extension.
2.  Go into the Stylus extension and click on “Write new style”.
3.  Put the following code in:
@page {
  size: auto;
}

4.  Give it a name (I called mine “Fix Orientation”) and save it.

5.  Reload the page you’re trying to print and the print dialogue should now have the “Layout” option and you should always get it for any page you print from now on.

It’s about the extension [Archive.is] Stylus – Chrome Web Store

Redesign the web with Stylus, a user styles manager. Stylus allows you to easily install themes and skins for many popular sites.

I reconfigured the OHRA Mijn Zorg site to force re-enabling of layout by adding @page { size: auto !important; } for https://mijn.ohrazv.nl/ (click the Save button to save this change permanently):

Read the rest of this entry »

Posted in Chrome, CSS, Development, Google, HTML, Power User, Software Development, Web Development | Leave a Comment »

How to build a CD ISO image file from the windows command line? – Stack Overflow

Posted by jpluimers on 2021/12/07

As I might need this in the future, some highlights from [Wayback] How to build a CD ISO image file from the windows command line? – Stack Overflow:

–jeroen

 

Posted in Development, Power User, Software Development, Windows, Windows Development | Leave a Comment »

On TStrings (and TStringList) sorting: what the default Sort behaviour is and how to change sorting order

Posted by jpluimers on 2021/12/07

Because I need this eventually, here the full quote of my answer in [Wayback] sorting – How can I get TStringList to sort differently in Delphi – Stack Overflow (The default Sort behaviour is to accommodate i18n sorting in natural order):

Read the rest of this entry »

Posted in Conference Topics, Conferences, Delphi, Development, Event, Software Development, Undocumented Delphi | Leave a Comment »

When a cross-head screw is not Philips, and you might need a JIS screwdriver

Posted by jpluimers on 2021/12/06

A while ago, when messing with some Asian electronics, I found that the cross-head screws in it do not fit Philips screwdrivers well.

The cause is the use of JIS (Japanese Industry Standard) cross-head screws in Japan and some other Asian regions.

JIS screws can also been found in other Asian mechanical stuff like motor-cycles and cars.

Here are some links about JIS screws and screwdrivers.

Read the rest of this entry »

Posted in DIY, Electronics Development, LifeHacker, Power User | Leave a Comment »