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 4,262 other subscribers

Archive for January 13th, 2022

On learning vi/vim

Posted by jpluimers on 2022/01/13

I saved below thread (if you cannot read German: try Google Translate on it [Archive.is]).

The part that – translated – strikes me most is this:

A mini-challenge where I want to spent 15 minutes per day on: when I need some functionality, instead of hacking around, research how it really is supposed to be done and internalise that way.

This totally aligns with me “learn new things every day” mantra.

Also some interesting vi/vim resources and approaches are mentioned:

If you are better at reading tables or lists for commands, I can recommend [Wayback] Basic vi Commands (Computer Science Department, Colorado State University).

One of the hardest things for me to remember somehow is the search/replace syntax, though it is very similar to that of sed. Useful examples of most permutations are at [Wayback] Vi For Smarties – Lesson Eight under “Advanced Search and Replace”:

  1. Use :s/foo/bar/ to replace the first occurrence of the word foo on the current line with the word bar.
  2. Use :s/foo/bar/g to replace all occurrences of the word foo on the current line with the word bar.
  3. Use :%s/foo/bar/g to replace all occurrences of the word foo in the current file with the word bar. Leaving off the g at the end only replaces the first occurrence of foo on each line of the current file.
  4. Use :%s/foo//g to delete all occurrences of the word foo in the current file. Leaving off the percent sign (%), of course, only does this for the current line.
  5. Use :%s/foo/bar/gc to have Vi query you before each attempt to replace the word foo with the word bar.

It is part of a series of tutorials starting at [Wayback] Vi For Smarties – Lesson One, and after the last lesson directs to the in-depth – as prose written – tutorial series [Archive.is] Wayback: The Vi/Ex Editor (which, despite marked by “[ Editor’s Note: . This tutorial series is a “work in progress” and will evolve over time. We’ll announce each new addition and expand this table of contents.]” got ditched shortly after January 2006)

https://web.archive.org/web/20160108053134/http://www.networkcomputin…

.

Note that like sed, you can use a different search/replace character than /: [Wayback] vim – / in vi Search and replace? – Stack Overflow

  • Escape the / with \ like this: \/.
  • Use different search character than /, for instance ., or #.

Back to the twitter thread

[Archive.is] Das königliche Wir on Twitter: “Ich lerne jetzt vi(m). Klingt beknackt, oder? Aber ich hab überlegt: ich möchte effizienter werden, meinen Kram stressfreier bewältigen. Und ich finde, es bietet sich an da an Baustellen anzusetzen, die täglich relevant sind. Und vi(m) nutze ich in der Tat täglich. 1/”

Ich lerne jetzt vi(m).

Klingt beknackt, oder? Aber ich hab überlegt: ich möchte effizienter werden, meinen Kram stressfreier bewältigen. Und ich finde, es bietet sich an da an Baustellen anzusetzen, die täglich relevant sind. Und vi(m) nutze ich in der Tat täglich.

Aber auch wenn ich ihn nutze und über den »Hilfe, wie komm ich aus dem Editor wieder raus?!«-Witz nur sehr müde die Augen rolle gehe ich davon aus, dass ich nicht mal einen Bruchteil der Möglichkeiten ausschöpfe, die er bietet (1. Release 1976, älter als ich!). Das ist spannend.

Das ist jetzt meine Mini-Challenge, auf die ich jeden Tag eine Viertelstunde verwenden will: wenn ich eine Funktion brauche mich nicht mehr drum herum zu hacken, sondern recherchieren wie es richtig geht und das dann gefälligst auch verinnerlichen. Mal sehen, ob das so klappt

In dem Zuge will ich auch wieder verstärkt (neo)mutt in Verbindung mit vim nutzen – das wäre ein wunderbares tägliches Training 😎 Mails schreiben muss man irgendwie immer.

neomutt bietet leider auch einen Eimer voll Funktionen, die ich noch nicht ordentlich nutze. Gnah.

An euren Replies erkenne ich, dass das mit dem »sich die Kürzel merken« echt heikel zu sein scheint 🤔 Wie handhabt ihr das im Alltag? Einfach ein paar Basics wie :u und CTRL+r und gut ist? Ich bin neugierig. Oder nutzt ihr alle nano? (Ich glaub, dann muss ich entfolgen) 😂

Nur als kleinen Zwischenstand: nach dem Lesen eurer Antworten schließe ich, dass ich mich mit meinem Kenntnisstand nicht verstecken muss 😂 Da hat mir der virtuelle Schulterblick schon weiter geholfen.

vi(m), weil ich Admin bin und dieses Tool auf jedem System und ohne X-Geraffels üblicherweise vorfinde (wenn auch bei neueren Installationen dieser absurde „visual mode“ der Default ist 😳). Auch unter (Open)Solaris, IRIX, was weiß ich.

Antworten:

Patrick Ben Koetter (@patrickbkoetter)

Ich habe diverse Plugins ausprobiert und lande immer wieder bei “normal“, weil ich einfach nicht die Disziplin aufbringe das Zeug richtig zu üben.

Marcel Weinberg (@winem_)

Denke so geht es vielen, die eben teilweise auch schon viele Jahre in der IT sind. Ist dir vimtutor bekannt? Den regelmäßig durchzutanzen hilft auch etwas, auch wenn man einiges immer mal vergisst oder einfach nicht nutzt.

Kristian Köhntopp (@isotopp)

vi movement Kommandos haben System. Erkenne und lerne das System. hjkl + prefix+hjkl, Marken, prefix+jump to mark und so weiter.

Und bleibe von den verblödeten Plugins weg. Die braucht kein Mensch und machen vim nur langsam im Start und kompliziert.

Boris (@k3rvyn)

Was mich so richtig weiter gebracht hat, war dieser Talk:
https://www.youtube.com/watch?v=5r6yzFEXajQ

winfreak (@winfreak)

Ich bilde mir kleine Merkphrasen für movements…
Aus „ciw“ wird „change inner word“, z.B.
Das kann ich mir deutlich besser merken.

–jeroen

Read the rest of this entry »

Posted in *nix, *nix-tools, Development, Power User, Scripting, Software Development, vi/vim | Leave a Comment »

The Definitive T430 Modding Guide | by George Kushnir (https://n4ru.it) | Medium

Posted by jpluimers on 2022/01/13

Lots of ideas, also for the W530 model: [Wayback] The Definitive T430 Modding Guide | by George Kushnir (https://n4ru.it) | Medium.

–jeroen

Posted in Development, Hardware Development, Power User, ThinkPad | Leave a Comment »

Patching ESXi so you can boot a MacOS virtual machine from it

Posted by jpluimers on 2022/01/13

This is totally opposite to yesterday’s Secure Boot post: [Wayback/Archive.is] shanyungyang/esxi-unlocker: VMware ESXi macOS

macOS Unlocker V3.0.2 for VMware ESXi
=====================================

1. Introduction
---------------

Unlocker 3 for ESXi is designed for VMware ESXi 6.5, 6.7 and 7.0

The patch code carries out the following modifications dependent on the product
being patched:

* Fix vmware-vmx to allow macOS to boot
* Fix libvmkctl to allow vSphere to control the guest

The code is written in Python as it makes the Unlocker easier to run and
maintain on ESXi.

+-----------------------------------------------------------------------------+
| IMPORTANT:                                                                  |
| ==========                                                                  |
|                                                                             |
| Always uninstall the previous version of the Unlocker before using a new    |
| version. Failure to do this could render VMware unusable.                   |
|                                                                             |
+-----------------------------------------------------------------------------+

2. Installation
---------------
Copy the distribution file to the ESXi host datastore using scp or some other
data transfer system. If you want to use the source version (i.e. from GIT) see
"5. Building" fist.

Decompress the file from the ESXi console or via SSH:

    tar xzvf esxi-unlocker-xxx.tgz

(xxx - will be the version number, for example, 300)

Run the command from the terminal:

    ./esxi-install.sh

Finally reboot the server.

3. Uninstallation
-----------------
Open the ESXi console or login via SSH and change to the folder where the files were extracted.

Run the command from the terminal:

    ./esxi-uninstall.sh

Finally reboot the server.

4. Notes
--------
A. There is a command added called esxi-smctest.sh which can show if the patch is successful. It must be run from a
terminal or SSH session. The output should be:

/bin/vmx
smcPresent = true
custom.vgz     false   32486592 B

Note: The uncompressed size reported for custom.vgz will vary depending on the ESXi version.

B. The unlocker can be temporarily disabled during boot by editing the boot options and adding "nounlocker".

5. Building
-----------
If you want to use a version which is not availbale as a distribution (e.g. the code from "master" branch)
you need to first build the package.

Checkout the repository:

    git clone https://github.com/shanyungyang/esxi-unlocker.git

(if you don't have git installed you can download ZIP archive from GitHub instead)

Enter the directory and build:
    
    cd esxi-unlocker
    ./esxi-build.py

If everything went correctly the ouput should be:

    ESXi-Build for macOS

    Timestamping files...

    Creating unlocker.tgz...
    etc/
    etc/rc.local.d/
    etc/rc.local.d/unlocker.py

    Creating esxi-unlocker-301.tgz...
    unlocker.tgz
    esxi-install.sh
    esxi-uninstall.sh
    esxi-smctest.sh
    readme.txt

The package you need to copy in the example above is esxi-unlocker-301.tgz (NOT unlocker.tgz!).

6. Thanks
---------

Thanks to Zenith432 for originally building the C++ unlocker and Mac Son of Knife
(MSoK) for all the testing and support.

Thanks also to Sam B for finding the solution for ESXi 6 and helping me with
debugging expertise. Sam also wrote the code for patching ESXi ELF files and
modified the unlocker code to run on Python 3 in the ESXi 6.5 environment.

History
-------
26/09/18 3.0.0 - First release
01/05/20 3.0.1 - Fix for ESXi 7.0
10/18/20 3.0.1 - Fix for ESXi 7.0 U1 (7.0.1)

(c) 2011-2018 Dave Parsons

–jeroen

Posted in Apple, ESXi6, ESXi6.5, ESXi6.7, ESXi7, Mac OS X / OS X / MacOS, Power User, Virtualization, VMware, VMware ESXi | Leave a Comment »