Can I use key bindings in Sublime Text to open remote files? - sftp

Every time I start a new programming session I have to open many “remote” files.
I was hoping to find a way to use key bindings to open those files. However, if this is possible I can't seem to find the proper way to do so.
Current I have a keybinding to popup the SFTP server, but then I still have to scroll to the correct server, and scroll through files, select one, hit edit, and repeat for another 3 - 4 files. It's a bit tedious. Currently I have:
[ { "keys": ["f11"], "command": "sftp_browse_server" }]
But would love to expand it to something like this, if possible :
[{
"keys": ["shift+f11"],
"command": "open",
"args": {"file":"http://x.x.x.x/cgi-bin/helloWorld.pl"}
}
]

Related

Qt Duplicate/Clone screens in RPI4

Im trying to duplicate my output screen from 'HDMI1' to 'HDMI2' on RPI4 device.
According to https://doc.qt.io/qt-5/embedded-linux.html since Qt 5.11 it is possible using a kms configuration file.
So i build two Qt version for this purpose, 5.12.11 and 5.15.2.
here is the kms configuration i used:
{
"device": "/dev/dri/card1",
"outputs": [
{ "name": "HDMI1", "mode":"1024x600" },
{ "name": "HDMI2", "clones": "HDMI1" }
]
}
The output is two screen showing the same window but the performance is very poor and the screen keep showing white frames while showing the application window.
And also the output keep saying:
QEGLPlatformContext: eglSwapBuffers failed: 3003
Could not lock GBM surface front buffer!
Also worth mentioning that when i use the application without the cloning feature it works just fine.
I Wonder if im doing something wrong.

How to recover accidentally deleted cells in Jupyter Notebook

I'm working in a .ipynb file in VSCode and I tried to undo some lines by using ESC + Z, but for some reason either I undid too much or I pressed something else, but around 30 of my cells all got deleted. I don't know how to redo and I'm scared I lost all my work!
How can I recover these cells???
Thanks
edit: I found the code that I've run using %history but I was hoping to get my Markdown cells as well because I wrote a lot of information there
edit 2: I noticed that my cells weren't just deleted, but my files actually just changed to a different spot in history, as my first few cells contained something different than it did before the cells disappeared. Does that change the answer to this question at all?
I did post a workaround to recover some stuff, but I'd still appreciate if someone let me know what happened in my 2nd edit, thanks!
If you hit the 'Z' key it will undo moves and deletes. Note, not CTRL+Z, but 'Z' by itself. link to the GitHub issue.
This happens constantly for me. So incredibly annoying! It happens when I hit or mishit CMD+Z. No amount of ESC-Z will recreate the deleted cell. Nothing in any menu have so far recreated the lost. I have deleted all shortcuts for 'delete cell' but it makes no difference at all. Just about to give up on VSCode for this reason alone.
I had a similar issue where I was hitting CTRL+Z outside of the cell when I thought I was inside the cell (usually because running current cell makes you lose cell focus).
Sometime it just "undid" the last created cell somewhere else in my notebook, and I actually lost some cells because I didn't realized right away what happened and just continued working.
I thought I would share my solution to this problem (because Google sent me on this post, and more people might be interested).
Redefining the Keyboard Shortcuts worked for me.
I removed the CTRL+Z shortcut when I'm not inside a cell (you can still access it with the menu Edit > Undo). I did the same for CTRL+SHIFT+Z, and so on.
To do this, I added theses rules to my keybindings.json:
{ "key": "ctrl+z", "command": "-undo" },
{ "key": "ctrl+z", "command": "undo", "when": "!notebookEditorFocused || inputFocus" },
{ "key": "ctrl+shift+z", "command": "-redo" },
{ "key": "ctrl+shift+z", "command": "redo", "when": "!notebookEditorFocused || inputFocus" },
{ "key": "ctrl+y", "command": "-redo" },
{ "key": "ctrl+y", "command": "redo", "when": "!notebookEditorFocused || inputFocus" },
I also removed the Z shortcut from Jupyter extension because I don't like it.
{ "key": "z", "command": "-undo", "when": "notebookEditorFocused && !inputFocus" },
This solution worked for me:
Open the command pallet (ctrl+shift+p on windows)
Select the "Undo" command
Not sure why it works. Does vscode disable the ctrl-z shortcut when outside a cell?
Ok, this is crazy but since I'm in Visual Studio Code, I tried right clicking on my .ipynb file and clicking "Convert to Python Script".
This recovered every single line including Markdown Code that I had before I did something to delete my cells.
Might be worth a try if you deleted your Jupyter Cells in Visual Studio Code
I found a way to get the lost cells back, which saved me an enormous amount of time as I did not have to recreate those cells. If you open the timeline (bottom left corner of the screen), you can go back in time when you still had those cells, copy the content and paste it in a new cell.
Update: you might have to upgrade to the latest version if Timeline is not available for you.
%history is a life saver but i will also note: When you run %history not all the code will show, given the amount of lines - you must navigate to the output file where you will see all the history, it is displayed there. The option to open the output file is usually given at the top of the page in VS code anyway.
I came to this thread after facing a similar situation as I lost a day's work as well but, I wasn't going to give up!
So, if you have setup Auto Save on VS Code and have wsl2 enabled and are using VS code from wsl, you have to navigate to this path
> \\wsl.localhost\Ubuntu\home\<user-name>\.vscode-server\data\User\History\.
or simply do
cd (to go to root path)
type explorer.exe . (this will open file explorer)
Navigate to .vscode-server\data\User\History\.
There will be multiple folders, pick one for the file you want to restore and Voila!
just click Z in windows. This saves my a lot of pain. it happens sometimes

How to define the default grammar for new file extensions

I'm opening files in Atom with a new file extension, a file extension that is not recognized by any of the existing grammars (i.e. Plain Test, C, C#, etc.). How can I associate my new file extension with one of the already-available grammars?
Success is being able to open a file with my new file extension and have Atom default to my chosen grammar automatically.
I tried the suggestion but Atom bounced it back at me:
customFileTypes:
"source.fs": [
"*.seedsource"
]
For personal use, you can register a custom file type in the Atom config file (config.cson by default).
Here's a minimal example of what config.cson might look like. Make sure to insert the customFileTypes part at the correct indentation, since CSON files are indentation-sensitive.
"*":
core:
customFileTypes:
"source.c": [
"*.custom-extension"
]
If you want to share this configuration with other users, it's probably better to create a package that contains a grammar file (e.g. grammars/custom.cson):
fileTypes: [
"custom-extension"
]
patterns: [
{
include: "source.c"
}
]
scopeName: "source.c.custom"
In both cases, example.custom-extension would be opened with C syntax highlighting.

What is the best way to get the .cs file from a given .proto file with protobuf.net

After several trial with the protobuf.net online generator, I doubt of the way y use to get the more relevant .cs file from an .proto file.
The Input proto file is the sparkplub_b file from link below:
https://github.com/Cirrus-Link/Sparkplug/blob/master/sparkplug_b/sparkplug_b.proto
In Sparkplug documentation the Datatype enums have the string form 'Uint64', and in the result .cs file we have ‘LongValue’.
(I have also to do some changes in the .cs file to be able to use enums with the 'DataType' in the JSON serialization of the object instance)
Thank you.
"Timestamp": 1538568112852,
"Metrics": [
{
"Name": "bdSeq",
"Timestamp": 1538568112852,
"Datatype": 4,
"IsNull": false,
"Metadata": null,
"Properties": null,
"LongValue": 0,
"ValueCase": 11
}
],
"Seq": 18446744073709551615
}
Sorry for delay, I was taking some time off. I'm the protobuf-net author.
What is the best way to get the .cs file from a given .proto file with protobuf.net
Ultimately, for protobuf-net specifically: protogen - which is what https://protogen.marcgravell.com/ uses (I assume that's what you were talking about when you say "with the protobuf.net online generator")
In Sparkplug documentation the Datatype enums have the string form 'Uint64', and in the result .cs file we have ‘LongValue’.
I assume that is coming from:
uint64 long_value = 4;
If the concern is the naming (LongValue vs long_value), then note that protobuf-net has options to allow more control over this; LongValue is just the default convention.
However: this isn't an enum - there is no enum in sparkplug_b.proto. If you can be more specific about what you want to get as the generated code (and ideally, why), I can almost certainly help more.
(edit: there is an enum optionally generated from the oneof)

Can an assemble target be silenced if there are no matching files? (Without using --force)

I have this assemble grunt target:
docs: {
files: {'<%= site.tmp %>/': ['<%= site.pages %>/**/*.html'] }
},
If there is no matching content, it complains, saying "Warning: Source files not found. Use --force to continue". The task then aborts. I don't mind the warning but I would like the option to configure the task to continue rather than having to use "--force" on the command line. Is this possible?
ps. The reason why this task is now failing is that I have converted the content to markdown. I am trying to build a scaffold that allows users to use markdown, hbs or html in any combination.
Based on what you are saying, you can use a little unix trick here.
docs: {
files: {'<%= site.tmp %>/': ['<%= site.pages %>/**/*.{html,hbs,md}'] }
},
That code basically looks for anything ending in .html, .hbs, or .md.
Since this is really a Grunt error, you would need to simply write your file object to allow for more possibilities.
For example, the above would only work if the location actually has files. If Grunt looks in that location and doesn't see any of the acceptable files, it will display the error you are getting now.

Resources