Renaming a Yakuake session from commandline - ssh

Yakuake provides a hotkey and a GUI way to rename commandline tabs/sessions.
I'd like to do the same via the command line, so I can script it and use it in an alias. (My goal is that if I use an alias which does an SSH to some server, then the tab is renamed according to this servers name...)
I tried the suggestions shown here Renaming a Konsole session from commandline after ssh so far no luck.

Since KDE4, one should use qdbus to control KDE apps (instead of deprecated and deleted DCOP).
For example, to change a title of the first session one may use:
qdbus org.kde.yakuake /Sessions/1 org.kde.konsole.Session.setTitle 1 "New title"
To explore available interfaces, methods and properties one may use qdbusviewer.
As a homework try to get a list of active sessions (before you going to change smth).

Like #fgysin pointed out, his command also works for me. BUT it needs the ` character and not " for the subcommand :
qdbus org.kde.yakuake /yakuake/sessions org.kde.yakuake.activeSessionId
It gives :
qdbus org.kde.yakuake /yakuake/tabs org.kde.yakuake.setTabTitle `qdbus org.kde.yakuake /yakuake/sessions org.kde.yakuake.activeSessionId` "NEW TAB TITLE";

Related

zsh completion: Disable ssh username completion

I am using the completion scripts that ship with ZSH (5.7.1) and I would like to turn off the autocompletion for usernames, but keep the completion for hostnames.
How can I do this?
Currently, there's an erroneous user that I can't figure out why it's being included (not in ~/.ssh/config, any identities, /etc/ssh, or any other location) and I figure it's probably easier to just disable username completion.
Example output is below; I want to remove the entire "login name" section rather than try and hunt down where unwanted-username is coming from.
$ ssh <tab>
-- login name --
unwanted-username
-- host --
example-host-1 example-host-1
I expect there is a zstyle command which can disable it, but I'm not sure the correct incantation. I expect this is the relevant configuration that needs to be changed:
$ zstyle | grep completion | grep ssh
:completion:*:ssh:* users hosts-domain hosts-host users hosts-ipaddr
However, I can't seem to get the correct incantation to remove the login name section.
To disable completion of login names, in that context, try:
zstyle ':completion:*:ssh:argument-1:*' tag-order hosts
or to merely hide them, try:
zstyle ':completion:*:ssh:*:users' hidden true
Pressing Ctrl-X h instead of tab is a good way to determine the relevant tags and context strings.
Seems odd that you have an erroneous user being completed. Check for a users-hosts style being set, possibly without mention of ssh in the context. The ignored-patterns style could be another way to deal with an erroneous match in the general case, for example:
zstyle ':completion:*:ssh:*:users' ignored-patterns erroneous-username
As you might discern from the name of the style, the last argument here can be a shell pattern with *, ? etc.

Set Kettle DB Connection password from Environment Variable

How do I set a database connection's password to use an environment variable. I cannot add these to the kettle.properties file (security policy). When I click control-space on OSX, nothing happens. If I try and paste the string ${PASSWORD} directly into the password field, it does not allow it, due to the presumably non-alphanumeric '$' char.
The other fields as shown below work fine.
The EDIT Connection dialog below shows the field in red, which is what I want to achieve logically.
Using PDI Community 8.2, on Mac OSX Mojave.
I found one solution. Instead of creating the DB connection in Table Input Step with Edit or New, I used the Wizard option, which allowed me to paste ${SOURCE_DB_PASSWORD} variable into the password field.
The characters were obfuscated, so it's impossible to tell if you have the correct value, but it worked.
CTRL+V doesn’t work, you need to right-click and choose paste.
You can encrypt the password and save it on kettle.properties, in spoon directory execute:
Encr.bat -kettle yourpassword
Paste the full result with "Encrypted" in the properties file, restart spoon and test the connection.
In OSX, I believe you need to use the shortcut shift + cmd + space to access the environment variables.
You might need to use the 'get variables'-step to define the variables from kettle.properties.
Just type ${Variable_Name} as you are defining for other environment variable. If open your .ktr file in Notepad++ you can see the value is your Variable_Name instead of Encrypted password. It worked for me :)
enter image description here

Change Integrated Terminal title in vscode

We can open command prompt in vscode by using the Integrated Terminal feature in View menu.
We can even open multiple terminals as shown below:
Is there any way I can change the title of the terminal ?
1: cmd.exe will be build terminal
2: cmd.exe will be watch terminal
I have gone through the integrated terminal documentation but I didn't find a way to do that.
Press in windows Ctrl + Shift + P and after type: Terminal: Rename, there you can change the terminal name/title
In v1.61 there is the ability to set the terminal names using variables. See terminal custom titles in release notes.
Terminal names are traditonally the name of the process they're
associated with. Thus, it can be difficult to distinguish between
them.
We now support configuring both title and description to help with
this using variables described in terminal.integrated.tabs.title and
terminal.integrated.tabs.description settings.
The current default values are:
{
"terminal.integrated.tabs.title": "${process}",
"terminal.integrated.tabs.description": "${task}${separator}${local}${separator}${cwdFolder}"
}
Variables available are:
${cwd} - The terminal's current working directory
${cwdFolder} - The terminal's current working directory.
${workspaceFolder} - The workspace in which the terminal was launched.
${local} - Indicates a local terminal in a remote workspace.
${process} - The name of the terminal process.
${separator} - A conditional separator (" - ") that only shows when surrounded by variables with values or static text.
${sequence} - The name provided to xterm.js by the process.
${task} - Indicates this terminal is associated with a task.
It looks like the ${task} variable is what you are looking for.
Sometimes, plugins will remove default keyboard shortcut bindings.
Look for "terminal.rename" in keyboard shortcuts then edit the keyboard shortcut to your preferred shortcut.
To apply your shortcut, make sure your cursor is focus in edit part of the window before you key in. Not at the terminal part.
In v1.41 there is a new command which can be used like so:
{
"key": "ctrl+t",
"command": "workbench.action.terminal.renameWithArg",
"args": {
"name": "remote"
}
}
if you have some frequently used name, like "remote" or "build" that you use often.
With VSCode 1.63 (Nov. 2021), entering "<blank>" (ie., empty string) as name will restore the default name for that terminal.
See issue 134020
For instance:
If my setting is ${cwd}${separator}${process} and I name a terminal "foo".
How do I reset "foo" back to the value of ${cwd}${separator}${process}?
My suggestion was that if you attempted to submit a blank name that would automatically reset to the value of your setting.

How can I get information about type of a Go variable

Suppose I have the following code in Go:
foo, bar := someFunc(baz)
I would like to create a Vim function to check type of foo or bar when editing a file.
Is there any tool or reliable source of information for functions from Go's packages I could use or? As for the functions declared in the file I'm editing I was thinking about simply parsing all the functions declared in that file.
You are looking for something like godef
If the -t flag is given, the type of the expression will also be
printed. The -a flag causes all the public members (fields and
methods) of the expression, and their location, to be printed also;
the -A flag prints private members too.
I know it is being used by various vim and emacs scripts.
The Go Oracle does this and much more.
vim-go is a complete vim setup for Go.
It includes integration with the previously mentioned godef (as :GoDef) and Go oracle (as :GoImplements, :GoCallees, :GoReferrers, etc) as well as other tools.

Zsh trouble when using echo with color/formatting characters

I'm just switch to zsh and now adapting the alias in which was printing some text (in color) along with a command.
I have been trying to use the $fg array var, but there is a side effect, all the command is printed before being executed.
The same occur if i'm just testing a echo with a color code in the terminal:
echo $fg_bold[blue] "test"
]2;echo "test" test #the test is in the right color
Why the command print itself before to do what it's supposed to do ? (I precise this doesn't happen when just printing whithout any wariable command)
Have I to set a specific option to zsh, use echo with a special parameter to get ride of that?
Execute the command first (keep its output somewhere), and then issue echo. The easiest way I can think of doing that would be:
echo $fg[red] `ls`
Edit: Ok, so your trouble is some trash before the actual output of echo. You have some funny configuration that is causing you trouble.
What to do (other than inspecting your configuration):
start a shell with zsh -f (it will skip any configuration), and then re-try the echo command: autoload colors; colors; echo $fg_bold[red] foo (this should show you that the problem is in your configuration).
Most likely your configuration defines a precmd function that gets executed before every command (which is failing in some way). Try which precmd. If that is not defined, try echo $precmd_functions (precmd_functions is an array of functions that get executed before every command). Knowing which is the code being executed would help you search for it in your configuration (which I assume you just took from someone else).
If I had to guess, I'd say you are using oh-my-zsh without knowing exactly what you turned on (which is an endless source of troubles like this).
I don't replicate your issue, which I think indicates that it's either an option (that I've set), or it's a zsh version issue:
$ echo $fg_bold[red] test
test
Because I can't replicate it, I'm sure there's an option to stop it happening for you. I do not know what that option is (I'm using heavily modified oh-my-zsh, and still haven't finished learning what all the zsh options do or are).
My suggestions:
You could try using print:
$ print $fg_bold[red] test
test
The print builtin has many more options than echo (see man zshbuiltins).
You should also:
Check what version zsh you're using.
Check what options (setopt) are enabled.
Check your ~/.zshrc (and other loaded files) to see what, if any, options and functions are being run.
This question may suggest checking what TERM you're using, but reading your question it sounds like you're only seeing this behaviour (echoing of the command after entry) when you're using aliases...?