Monthly Archives: November 2022
vim – nvim norm command
In neovim 0.4.3-3 in normal mode this command :
:put=range(1,4)
will put numbered list from 1 to 4
but when i want to put numbers only in blank lines like this:
:g/^$/norm :put=range(1,14)
it is not working as expected – only highlighting empty lines but put is not working, why ?
From :help :normal:
{commands}should be a complete command. If{commands}does not finish a command, the last one will be aborted as if<Esc>or<C-C>was typed. A:command must be completed as well.
You can fix that by adding an extra “Enter” character at the end of your command, which you can enter with:
Ctrl+V, Enter
It will display as a ^M in Vim:
:g/^$/norm :put=range(1,14)^M
(There are ways to avoid having to enter a literal “Enter” in your command. For instance, the :execute command is often used for that.)
But in this case there’s a much simpler solution, which is to drop the :normal altogether and just have :g run :put directly!
:g/^$/put=range(1,14)
The :g command will run an Ex command for each line it matches and :put is an Ex command, so you can just cut the middle man here.
Note that what this command does is append 14 new numbered lines after each blank line in your buffer. Not sure if that’s actually what you intended with it or not.
Source: vim – nvim norm command – Unix & Linux Stack Exchange
How to Use Your Bash History in the Linux or macOS Terminal
- Up Arrow or Ctrl+P: Go to the previous command in your history. Press the key multiple times to walk backwards through the commands you’ve used.
- Down Arrow or Ctrl+N: Go to the next command in your history. Press the key multiple times to walk forwards through the commands you’ve used.
- Alt+R: Revert any changes to a command you’ve pulled from your history if you’ve edited it on the current line.
Bash also has a special “recall” mode you can use to search for commands you’ve previously run, rather than scrolling through them one by one.
- Ctrl+R: Recall the last command matching the characters you provide. Press this shortcut and start typing to search your bash history for a command.
- Ctrl+O: Run the command you found with Ctrl+R.
- Ctrl+G: Leave the history searching mode without running a command.
Source: How to Use Your Bash History in the Linux or macOS Terminal
Netplan | Backend-agnostic network configuration in YAML
Create a WordPress admin user with SQL
Create a WordPress admin user with MySQL
If you’ve ever been locked out of a WordPress installation, but have access to the database, here’s a nifty snippet to grant you administrator-level access. There are a couple of things you need to do before using this MySQL code. First, set the variables to your own information. Next, if your WordPress installation is based on a non-standard wp_ table prefix, you must find/replace ‘wp_’ with your current table prefix.
SET@id = 99;SET@user='username';SET@pass ='password';SET@email ='email@ddress';SET@name='Your Name';INSERTINTOwp_users (ID, user_login, user_pass, user_nicename, user_email, user_url, user_registered, user_activation_key, user_status, display_name)VALUES(@id, @user, MD5(@pass), @name, @email,'','2013-06-20 00:00:00','','0', @name);INSERTINTOwp_usermeta (umeta_id, user_id, meta_key, meta_value)VALUES(NULL, @id,'wp_capabilities','a:1:{s:13:"administrator";s:1:"1";}');INSERTINTOwp_usermeta (umeta_id, user_id, meta_key, meta_value)VALUES(NULL, @id,'wp_user_level','10');INSERTINTOwp_usermeta (umeta_id, user_id, meta_key, meta_value)VALUES(NULL, @id,'active','1');
Source: Coderrr | Create a WordPress admin user with MySQL – Coderrr
How to resize a qcow2 disk image on Linux
How to Increase Harddisk Size In Linux VM On Proxmox?
Disable the Cloud sign-in option on Office 2019
Note: Might be easier to install the admx admin templates to Group Policy Editor. See this post for more info
Office 2019 annoyingly wants you to sign in to either a domain or the cloud. It shares the same registry space as Office 2016, so the procedure is:
Preparation:
1. Note that this must be done on a per-user basis, for anyone who logins into the machine. So 2 users on the same machine = do it twice. Or if that user signs into another machine, do it again.
2. Go into one of the Office apps, go to Account, and select “Sign out” & then click Yes when prompted.First, close all Office applications:
Word
Excel
PowerPoint
Outlook
etc.Second, open the Registry Editor: (may need to Run As Admin)
Start > Run > regedit
Third, navigate down the tree:
HKEY_CURRENT_USER
SOFTWARE
Microsoft
Office
16.0
CommonThird, add the SignIn folder:
Right-click on the Common folder
Go to New > Key
Name it “SignIn” (without the quotes)Fourth, add the registry key to disable the sign-in option:
Right-click on the SignIn folder
Go to New > DWORD (32-bit) VALUE
Name it “SignInOptions” (without the quotes)
Set the value to 3Fifth, verify that it worked:
Open up Word
It should no longer have the “Sign in” button in the top bar
Under File > Account, all of the sign-in verbage should be goneIf you ever need to add it back in, just delete the SignInOptions reg key!
Kodi 19 with estuary. Edit shutdown menu/options
On windows with the app (not from the windows store) copy the skin folder from: c:\program files (x86)\Kodi 19\addons\skin.estuary
to: %appdata%\Kodi\addonsgo to %appdata%\kodi\addons\skin.estuary\xml
(create a backup copy of home.xml)
Line 1056 on that file (on notepad click on view -> status bar) would say this:
<param name=”onclick” value=”ActivateWindow(shutdownmenu)” />
Change to:
<param name=”onclick” value=”Quit()” />
You can edit DialogButtonMenu.xml to change the options in shutdownmenu. Edit the “visible” line for options to say no. Make a copy first!