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 2,732 other followers

Archive for the ‘Color (software development)’ Category

Tesseract (software): amazing command-line OCR tool

Posted by jpluimers on 2022/05/13

A twitter post blasted me away by showing the results of Tesseract (software) – Wikipedia doing perfect OCR on an image from a twitter post:

[Wayback] Harrie Baken on Twitter: “Fantastic!… “

curl -s 'https://pbs.twimg.com/media/E9T96Q9XIAcs8xJ?format=jpg&name=large …' -o - | tesseract stdin stdout | grep --color 609

It instantly solved this puzzle:

Read the rest of this entry »

Posted in C++, Color (software development), Development, OCR, Power User, Software Development, Tesseract | Leave a Comment »

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 »

Github markdown: red text

Posted by jpluimers on 2021/12/02

Github officially does not support coloured text, but with a small trick, you can get a few colours by including a diff file in the markdown.

I did it when I had to put on hold open source projects due to rectum cancer recovery, for instance [Wayback] this fritzcap diff added the [Wayback] text:

which [Wayback] rendered becomes a kind of red bulleted list:

I learned this trick via [Wayback] How to add color to Github’s README.md file – Stack Overflow (thanks to [Wayback] revisions by [Wayback] craigmichaelmartin, [Wayback] Noam Manos and [Wayback] GalaxyCat105):

You can use the diff language tag to generate some colored text:

```diff
- text in red
+ text in green
! text in orange
# text in gray
@@ text in purple (and bold)@@
```

However, it adds it as a new line starting with either - + ! # or starts and ends with @@

enter image description here

This issue was raised in [Wayback] github markup #369, but they haven’t made any change in decision since then (2014).

By now there is a new issue, again with little progress: [Wayback] Color text in markdown · Issue #1440 · github/markup

–jeroen

Posted in Color (software development), Development, Lightweight markup language, MarkDown, Software Development | Leave a Comment »

css color picker – Google Search

Posted by jpluimers on 2021/08/12

Probably old, but there is an embedded [WayBack] css color picker – Google Search that on each refresh switches colours:

–jeroen

Posted in Color (software development), CSS, Development, Google, GoogleSearch, HTML, Power User, Software Development, Web Development | Leave a Comment »

Chaz Firestone su Twitter: “All the balls are the same color — and that color is *brown*!… “

Posted by jpluimers on 2021/06/08

With User Experience, perception plays a big role. It helps to understand how colors work: a difficult topic with amazing results like: “All the balls are the same color — and that color is brown!”

All pictures below are from the [WayBack] Chaz Firestone on Twitter: “All the balls are the same color — and that color is brown!… “ thread.

Original by [WayBack] David Novick (@NovickProf) | Twitter: Professor of Engineering Education and Leadership, the University of Texas at El Paso. Tweets cover innovation & entrepreneurship, improv, and color illusions. El Paso, TX.

[Archive.is] David Novick on Twitter: “A three-color confetti illusion with spheres, which appear to be yellowish, reddish, and purpleish but in fact have exactly the same light-brown base color (RGB 255,188,144). Shrinking the image increases the effect. Original png file is at .… “

A PNG of the original is at engineering.utep.edu/novick/colors and his dropbox, and is even more stunning than the Twitter dithered versions below.

Colors from the color picker tool by [WayBack] #therightwaye (@therightwaye) | Twitter:

Grey backgrounds by [WayBack] Joffan (@Joffan7) | Twitter:

The cool thing is that this is being used in product packaging to make the fruits and vegetables look more orange.

Carrots by [WayBack] Hanon Ondricek on Twitter: “Oh right! And baby carrot bags have orange stripes… #itrustnothingnow… “:

Oranges and grapefruits by [WayBack] Alexei Kojenov (@kojenov) | Twitter:

–jeroen

Read the rest of this entry »

Posted in Color (software development), Development, Software Development, User Experience (ux) | Leave a Comment »

 
%d bloggers like this: