The Wiert Corner – irregular stream of stuff

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

  • My work

  • My badges

  • Twitter Updates

  • My Flickr Stream

    20140508-Delphi-2007--Project-Options--Cannot-Edit-Application-Title-HelpFile-Icon-Theming

    20140430-Fiddler-Filter-Actions-Button-Run-Filterset-now

    20140424-Windows-7-free-disk-space

    More Photos
  • Pages

  • All categories

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

    Join 1,756 other followers

Archive for the ‘Scripting’ Category

use vmrun – via How do I find the IP address of a virtual machine using VMware Fusion? – Super User

Posted by jpluimers on 2017/04/20

Note this works only when the VMs have VMware Tools installed (more on that below):

VMWare provides, not surprisingly, a built in tool for this, vmrun. It’s under /Applications/VMware Fusion.app/Contents/Library/vmrun although it has moved around in other Fusion releases a bit.

ūüćļ vmrun list Total running VMs: 1 .docker/machine/machines/myvm.vmx
ūüćļ vmrun getGuestIPAddress ~/.docker/machine/machines/myvm.vmx 172.16.213.128

via: How do I find the IP address of a virtual machine using VMware Fusion? РSuper User [WayBack]

vmrun [WayBack] is barely documented and most of is in PDF of which this is the most recent I could find: www.vmware.com/pdf/vix180_vmrun_command.pdf [WayBack]

Based on the above path, I added this to my ~/.bash_profile file:

alias vmrun='/Applications/VMware\ Fusion.app/Contents/Library/vmrun'
alias vmrun-list-running-VMs='vmrun list | grep vmx'
vmrun-list-ipv4-of-running-VMs()
{
  vmrun-list-running-VMs | while read line ; do echo $line && vmrun getGuestIPAddress $line; done
}

Now I can do this:

$ vmrun-list-ipv4-of-running-VMs
/Users/jeroenp/VM/W81Entx64DelphiRegression.vmwarevm/W81Entx64.vmx
172.16.172.135
/Users/jeroenp/VM/diaspore-opensuse-Tumbleweed-x64.vmwarevm/diaspore-opensuse-Tumbleweed-x64.vmx
Error: The VMware Tools are not running in the virtual machine: /Users/jeroenp/VM/diaspore-opensuse-Tumbleweed-x64.vmwarevm/diaspore-opensuse-Tumbleweed-x64.vmx
$ vmrun-list-ipv4-of-running-VMs
/Users/jeroenp/VM/diaspore.opensuse-Tumbleweed-x64/diaspore.opensuse-Tumbleweed-x64.vmx
Error: Unable to get the IP address
/Users/jeroenp/VM/W81Entx64DelphiRegression.vmwarevm/W81Entx64.vmx
172.16.172.135
$ vmrun-list-ipv4-of-running-VMs
/Users/jeroenp/VM/diaspore.opensuse-Tumbleweed-x64/diaspore.opensuse-Tumbleweed-x64.vmx
Error: Unable to get the IP address
/Users/jeroenp/VM/W81Entx64DelphiRegression.vmwarevm/W81Entx64.vmx
172.16.172.135
$ vmrun-list-ipv4-of-running-VMs
/Users/jeroenp/VM/diaspore.opensuse-Tumbleweed-x64/diaspore.opensuse-Tumbleweed-x64.vmx
172.16.172.134
/Users/jeroenp/VM/W81Entx64DelphiRegression.vmwarevm/W81Entx64.vmx
172.16.172.135
$ vmrun-list-ipv4-of-running-VMs
/Users/jeroenp/VM/diaspore.opensuse-Tumbleweed-x64/diaspore.opensuse-Tumbleweed-x64.vmx
172.16.172.134
/Users/jeroenp/VM/W81Entx64DelphiRegression.vmwarevm/W81Entx64.vmx
172.16.172.142

These are the messages I observed:

Error: The VMware Tools are not running in the virtual machine: /Users/jeroenp/VM/diaspore-opensuse-Tumbleweed-x64.vmwarevm/diaspore-opensuse-Tumbleweed-x64.vmx
Error: Unable to get the IP address
172.16.172.135

The first one means a machine is running but has no VMware Tools installed. For an OpenSuSE machine you can install it with zypper install open-vm-tools, for other Linux systems read VMware Tools auf Ubuntu, Mint, CentOS oder openSUSE installieren | ITrig [WayBack]

Some more examples of vmrun for VMware Fusion are at Control VMware Fusion from the Command Line | James Reuben Knowles [WayBack]

–jeroen

Posted in *nix, bash, Development, Fusion, openSuSE, Power User, Scripting, Software Development, SuSE Linux, Tumbleweed, Virtualization, VMware | Leave a Comment »

Bash that JSON (with jq) ‚ÄĒ Librato Blog

Posted by jpluimers on 2017/04/18

 Glueing together APIs requires working with JSON: parsing it, extracting it, transforming it. JQ is a fast, lightweight, flexible, CLI JSON processor, that does the job well. Learn how to use it by getting your hands dirty with a JSON blob that represents the open issues in the public Docker GitHub repository.

Source:¬†Bash that JSON (with jq) ‚ÄĒ Librato Blog¬†[WayBack]¬†http://blog.librato.com/posts/jq-json

via: http://blog.librato.com/posts/jq-json – Joe C. Hecht – Google+

–jeroen

Source: http://blog.librato.com/posts/jq-json

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

.bashrc generator: create your .bashrc PS1 with a drag and drop interface

Posted by jpluimers on 2017/04/13

Cool: .bashrc generator: create your .bashrc PS1 with a drag and drop interface

http://bashrcgenerator.com/

–jeroen

http://bashrcgenerator.com/ – Joe C. Hecht – Google+

Posted in bash, Development, Scripting, Software Development | Leave a Comment »

How bad is the Windows command line really?

Posted by jpluimers on 2017/04/13

How bad is the Windows command line really?

The Windows command line is bad. Very bad.

But it took until recently for old Windows versions Рthat out of the box had either no or poor PowerShell versions Рto have slowly died.

So only now PowerShell finally has become an option that really works across all Windows versions I use. Go PowerShell!

–jeroen

Posted in Batch-Files, Development, PowerShell, Scripting, Software Development | Leave a Comment »

Hosting Grumpydev Imageflair locally – part 2 – trying to get the text and images to display

Posted by jpluimers on 2017/04/12

Blank imageFlair

Blank imageFlair

Hosting Grumpydev Imageflair locally ended with two issues left: an empty image and my wish to include more complete StackExchange bits like the current StackExchange flair does.

I thought fixing the empty image would take a rainy day. It actually took a few rainy hours.

No text

The culprit is that I didn’t have the Microsoft Core Fonts for the Web¬†installed. Which was no coincidence as¬†the free download of those from Microsoft terminated in 2002. The upside is that because of their licenses, they are available as open source and most linux distributions have a¬†script package that will download these fonts. OpenSuSE has¬†fetchmsttfonts¬†for this.

Alternatively, you can use the web.archive.org to download manually, but that’s a tad tedious. But if you love tedious: Free downloads – TrueType core fonts for the Web.

zypper install fetchmsttfonts

That installs the fonts in:

/usr/share/fonts/truetype

The drawback of having¬†fetchmsttfonts is that the original Microsoft versions of these fonts are downloaded from corefonts.sourceforge.net each time the fetchmsttfonts package is updated, potentially overwriting newer versions of the fonts in that directory. If you don’t want that, use the trick at¬† (not yet archived at the WayBack machine) font handling – install fetchmsttfonts, copy fonts, rpm -e fethmsttfonts, copy fonts back.

Having the fonts installed, I thought the only thing I needed to fix were the multiple references in config.php from that pointed to Arial.TTF. I took the poor man’s approach and just did this being in the directory of config.php:

cp /usr/share/fonts/truetype/arial.ttf Arial.TTF

Filled Imageflair

That didn’t work either: still no text showed.

So I decided to run imageFlair.php from the command line after setting $imageflair_debug = true; in config.php which then resulted in all sorts of warnings like

PHP Warning: imagettftext(): Could not find/open font

After reading I decided to build a small php-gd.tester.php script containing phpinfo(); and gd_info showing these portions for PHP GD (non-relevant bits stripped):

Additional .ini files parsed /etc/php5/conf.d/ctype.ini,
/etc/php5/conf.d/dom.ini,
/etc/php5/conf.d/gd.ini,
/etc/php5/conf.d/iconv.ini,
/etc/php5/conf.d/json.ini,
/etc/php5/conf.d/mysql.ini,
/etc/php5/conf.d/mysqli.ini,
/etc/php5/conf.d/pdo.ini,
/etc/php5/conf.d/pdo_mysql.ini,
/etc/php5/conf.d/pdo_sqlite.ini,
/etc/php5/conf.d/sqlite3.ini,
/etc/php5/conf.d/tokenizer.ini,
/etc/php5/conf.d/xmlreader.ini,
/etc/php5/conf.d/xmlwriter.ini

gd

GD Support enabled
GD headers Version 2.1.1
GD library Version 2.1.1
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.6.3
GIF Read Support enabled
GIF Create Support enabled
JPEG Support enabled
libJPEG Version 8
PNG Support enabled
libPNG Version 1.6.21
WBMP Support enabled
XPM Support enabled
libXpm Version 30411
XBM Support enabled
WebP Support enabled

And the gd_info dump:

GD Version 2.1.1
FreeType Support 1
FreeType Linkage with freetype
T1Lib Support
GIF Read Support 1
GIF Create Support 1
JPEG Support 1
PNG Support 1
WBMP Support 1
XPM Support 1
XBM Support 1
WebP Support 1
JIS-mapped Japanese Font Support

Too bad though: no information on where it sources the fonts from.

No image

Having no solution for the font rendering yet, I focussed at the lack of profile picture.

In the past, the images were generated with gravatar information in the JSON, but now that is empty. See for instance the output of http://superuser.com/users/flair/1.json versus his image http://superuser.com/users/flair/1.png

That reveals quite a change in the JSON that imageFlair expects. Actually there is a lot of HTML in there.

So decided to try http://superuser.com/users/flair/1 in addition to http://superuser.com/users/flair/1.json with this result:

Two downsides here:

  1. This doesn’t work for the combined stackexchange flair:¬†http://stackexchange.com/users/flair/1.png works, but¬†http://stackexchange.com/users/flair/1 gives a 404.
  2. Rendering HTML servers side to PNG requires a lot of work.

Time for another rainy day (:

–jeroen

Read the rest of this entry »

Posted in *nix, *nix-tools, bash, Development, PHP, Pingback, Power User, Scripting, Software Development, Stackoverflow | Leave a Comment »

 
%d bloggers like this: