Nemo Dragon, meets VS Code
Nemo Dragon, meets VS Code
I am not a fan of MicroSoft, I think most people would be aware of that. I have recently been required to use VSCode for some of my work and I admit it is not entirely unpleasant. I still prefer vim and no vim mode is not good enough 😉 though it does make it vastly more usable.
After an arm wrestling match, that I finally won, I have VS Code configured for my work environment. I use Fedora 43 Workstation for my daily driver and getting VS Code to co-operate with my default configuration for the terminal was a bit of a nuisance. There must be more than a million settings in this beast! 😉
Unus Nemo
Unus Nemo
Unknown parent • •@plan-A (゚ヮ゚)
I am doing a technical review on a video course on the Go programming language. The creator uses MS/VSCode in the course so it was necessary for me to use that for the review. So far I am not upset with the editor but it is unnatural for me so I had to adapt.
One of the things that bothered me was that when using the shell via VSCode's integrated terminal was that I lost all of my normal shell env that I have taken a lot of time historically setting up. This was not acceptable. So I did a deep dive and found that VSCode runs one instance of the shell for itself and then creates a subshell for it's integrated terminals. I have shields in my configuration that prevent it from being sourced multiple times which can lead to bloat and an environment with a path that has the same directories in it multiple times. So VSCode's approach stopped the integrated terminals from being able to source
... Show more...@plan-A (゚ヮ゚)
I am doing a technical review on a video course on the Go programming language. The creator uses MS/VSCode in the course so it was necessary for me to use that for the review. So far I am not upset with the editor but it is unnatural for me so I had to adapt.
One of the things that bothered me was that when using the shell via VSCode's integrated terminal was that I lost all of my normal shell env that I have taken a lot of time historically setting up. This was not acceptable. So I did a deep dive and found that VSCode runs one instance of the shell for itself and then creates a subshell for it's integrated terminals. I have shields in my configuration that prevent it from being sourced multiple times which can lead to bloat and an environment with a path that has the same directories in it multiple times. So VSCode's approach stopped the integrated terminals from being able to source my configuration so my desired env was not available in VSCode's integrated terminal. I found a toggle that allowed me to turn that feature off so that my env was sourced in the integrated terminals.
Now this may be a small detail to some. Though I do 90% of my work in the terminal and not having access to my normal env was not pleasant at all. It basically made using the integrated terminals painful and unproductive. I was pretty excited to see Nemo Dragon rear his head in the integrated terminal as it showed my env was indeed being sourced! 😉
The only negative part of using MS/VSCode is the feeling that MS is watching, lol, of course I have a copy of VSCode built from sources so I know that is not possible in my case. As I would have seen the code on inspection and I would see evidence of the telemetry on my network.
Would you install a stock version of VSCode and see if you get any telemetry? I would appreciate it if you could do that test for me. Do not use a copy distributed by a third party such as they have in the Fedora repo, get the version distributed directly from MS. I know you will do a very thorough investigation 😀. I have faith in your paranoia 😛
Unus Nemo
Unknown parent • •@plan-A (゚ヮ゚)
I do not think I will ever be done pimping up my OS after 30+ years I am still working on it 😛. I do not think we outgrow that. When we leave the confines of MS/Windows (In my case MS/DOS) or MacOS behind and we are given the freedom to make our computer truly our own. It is hard to not take advantage of that opportunity.
Unus Nemo
Unknown parent • •@plan-A (゚ヮ゚)
What do you mean by keep a tracker of own made code?
Unus Nemo
Unknown parent • •@plan-A (゚ヮ゚)
your image is not visible to me, please check the permissions as there is still an issue with that on this new version of friendica. Sometimes I post an image and it honors my default permissions and makes it public, other times it makes it visible to only me.
Unus Nemo
Unknown parent • •@plan-A (゚ヮ゚)
It is a common mistake to believe that shell script is a bash script, zsh script or sh script. Essentially the langue your shell provides. This is not reality. A shell script can be written in many languages. To explain try this:
it still executes despite not having a shebang line. As we have demonstrated. In fact if you are creating shell scripts in the
bashlanguage (versus the bash shell) and using bash then you do not need a shebang line. This is the default scripting language for the bash shell.So why do we have a shebang line in the first place? It does not make the file executable, that is what chmod +x does. The shebang line tells us what interpreter to use for this script. That language could be
... Show more...bash,python,@plan-A (゚ヮ゚)
It is a common mistake to believe that shell script is a bash script, zsh script or sh script. Essentially the langue your shell provides. This is not reality. A shell script can be written in many languages. To explain try this:
it still executes despite not having a shebang line. As we have demonstrated. In fact if you are creating shell scripts in the
bashlanguage (versus the bash shell) and using bash then you do not need a shebang line. This is the default scripting language for the bash shell.So why do we have a shebang line in the first place? It does not make the file executable, that is what chmod +x does. The shebang line tells us what interpreter to use for this script. That language could be
bash,python,perl,tcl,gambas,pascal, ... it does not matter. They are all shell scripts. If they are written in these languages as shell scripts. As many of these languages can also be used to write actual programs versus a shell script.So when exploring shell scripting understand that you are not limited to any specific language. There are many choices, more than I will list here.
Here is a fun fact for you. Notice how many languages will accept a # as a comment line? This is not an accident or coincidence. It is a design feature so that the language itself will ignore the shebang line in a script.
In fact a large number of common commands we use on the CLI are shell scripts and many are written in python or perl. They are shell scripts. This is why we do not use file extensions on our shell scripts. Though if we were writing a program that is entirely independent from the shell it would be acceptable.
Unus Nemo
in reply to Unus Nemo • •Unus Nemo
Unknown parent • •@plan-A (゚ヮ゚)
Keep this in mind. If it is part of the name a user has to type that too in order to execute it. So if your script grows to where you have to go from bash, to python or perl, then the filename changes and your script is no longer accessible to those that are unaware of the change.
For files that are consumed by other applications or services then yes, you should use an extension such as .html, .php. If you had a library of functions and shell variable or even environmental variables then you may use a .sh extension, though you would not use a shebang line and you would not make that file executable as it would only be sourced, and never executed.
Keep in mind that file extensions do not really exist in 'nix. a dot is just another character in the filename except when it is the first character and it tells the shell that this is a configuration file and should not be displayed by d
... Show more...@plan-A (゚ヮ゚)
Keep this in mind. If it is part of the name a user has to type that too in order to execute it. So if your script grows to where you have to go from bash, to python or perl, then the filename changes and your script is no longer accessible to those that are unaware of the change.
For files that are consumed by other applications or services then yes, you should use an extension such as .html, .php. If you had a library of functions and shell variable or even environmental variables then you may use a .sh extension, though you would not use a shebang line and you would not make that file executable as it would only be sourced, and never executed.
Keep in mind that file extensions do not really exist in 'nix. a dot is just another character in the filename except when it is the first character and it tells the shell that this is a configuration file and should not be displayed by default. The concept of an extension comes from DR/CPM and then was inherited by MS/DOS etc. Because the extension is used in MIME types by applications and servers we pretend there are extensions in 'nix, even though there is no such built in construct.
Say you have a python script, if it is part of an application and is not a command you use on the CLI then it is completely acceptable to use a .py extension. If it is a command to be used on the CLI then it should not have a .py extension.
There are a lot of new people in the 'nix domain that come from MS/DOS and MS/Windows and they have a hard time accepting that certain artifacts that were necessary on MS OSes are no longer needed or even advised.
The rule of thumb is easy. If it will be executed as a command on the CLI it should not get an extension. If it is an application that will not be used on the CLI then extensions are fine.
Unus Nemo
Unknown parent • •@plan-A (゚ヮ゚)
Here is a pro-tip for you. If you need to have the .py extension on a file for your editor to recognize it as a python file so you get all the perks you can keep a
<filename>.pyfile and then create a symbolic link to that file with no extension. Say the python filename was hello.py then you could useln -s hello hello.pybe sure not to forget the -s option as this is what makes the link symbolic. This will let your editor know it is a python file and your code will still execute without the user needing to know the .py extension. If I distribute code that I know will run on both MS/Windows and 'nix then I include that symbolic link in my distribution. It will not hurt Windows that it exists and it give a more natural feel on 'nix. Though I have gotten away from supporting Windows at all, sense they now are official 100% spyware. The whole OS malware at this point from my point of view.Unus Nemo
Unknown parent • •python hello.pythen you do not need to make the hello.py file executable at all and there is no need for a shebang line. Though this is how you would typically invoke an app, not a shell script.Unus Nemo
in reply to Unus Nemo • •Unus Nemo
Unknown parent • •@plan-A (゚ヮ゚)
I doubt you would need a new cmake 😉. Your build would not be the same as mine though. I build it with Cuda Support for my Nvidia Video card. I keep my Cuda Development Kit in a distrobox container that I created from an OCI container I built with podman. This is necessary because Cuda Dev Kit is not available for Fedora 43. I use a a Fedora 42 Toolbox image as a base to build my OCI image. This is my Containerfile:
... Show more...@plan-A (゚ヮ゚)
I doubt you would need a new cmake 😉. Your build would not be the same as mine though. I build it with Cuda Support for my Nvidia Video card. I keep my Cuda Development Kit in a distrobox container that I created from an OCI container I built with podman. This is necessary because Cuda Dev Kit is not available for Fedora 43. I use a a Fedora 42 Toolbox image as a base to build my OCI image. This is my Containerfile:
to build:
It takes a while for it to build because the Cuda Dev Kit is like 16gb. I then create a dropbox as it is the easiest way to integrate my ptyxis terminal with the Container, it handles all the bind mounts and Volumes for me.
to create dropbox:
of course for this to work you have to have a Nvidia GPU, Install the Nvidia drivers from RPMFussion Non-free, and create a CDI. This all has to be done before you build the OCI container image and create a dropbox.
Though when done it creates a seamless Cuda Development Environment that I can use for building llama.cpp with cuda support as well as custom version of PyTorch, etc.
I only rebuild the container when a more recent version of the Cuda Dev Kit comes out. So I use the same container for quite a while before I need to rebuild it.
I just synced my fork to llama.cpp on github yesterday and did the build this morning. I had to tweak the build to allow the binaries and libraries to work on my host machine and not just in my dev environment. I just told it to not use shared libraries, and statically link the cuda runtime.
Unus Nemo
Unknown parent • •@plan-A (゚ヮ゚)
Do you run your server directly from the build directory?
Unus Nemo
Unknown parent • •@plan-A (゚ヮ゚)
stop using llama.cpp server from the build dir instead install it via:
make sure you are in the build directory
cmake --install . --prefix /usr/localthis will install your binaries and libraries to the /usr/local/bin and /usr/local/lib64 directories of your toolbox.
You will probably have to add a config file for the libraries
create a file named
llamacpp.confin the/etc/ld.so.conf.ddirectory of your toolbox (if this does not persist then you may need to build it into your container). the contents of the file:after creating the file in /etc/ls.so.conf.d you need to run
ldconfigin order to update the linker.Unus Nemo
Unknown parent • •@plan-A (゚ヮ゚)
if your running a stock Fedora 43 toolbox and it does not allow you modify the contents of /usr/local/lib64 and /usr/local/bin (which it usually does by default) or you cannot add files to the /etc/ld.so.conf.d directory with persistence then let me know and I will help you build a toolbox with those feature built in.
Unus Nemo
Unknown parent • •@plan-A (゚ヮ゚)
Yes, because everything still runs in the container. For isolation purposes it changes nothing. It just gets it out of your build directory so when you rebuild you do not crush your existing setup. This is important in case the build fails 😉.
Unus Nemo
Unknown parent • •Unus Nemo
Unknown parent • •@plan-A (゚ヮ゚)
A pod is not a container, a pod is typically a number of containers run on a kubernete distributed system. You should not need a new one no, the changes should work in a proper toolbox, that is what toolboxes are for. Though sometimes some of the directories in the toolbox will use read only bind mounts, then your changes will only last until you stop and then restart the container. If you find that the changes do not persist we can build a custom toolbox that will allow those changes to persist. Try it in your existing toolbox, if it is a problem then we will talk about building a custom toolbox.
Unus Nemo
Unknown parent • •@plan-A (゚ヮ゚)
even if we had to rebuild the toolbox you are using llama.cpp on then it would not be a big deal. We could even create a new container just for llama.cpp and let it run in the background for your llama.cpp server. We would just export the build so that you could install it in the new container. You would only have to rebuild that container when you had a new version of llama.cpp
Unus Nemo
Unknown parent • •@plan-A (゚ヮ゚)
For your use case it might be the best plan. To move your build to its own container. Then that container is accessible everywhere even to your native MacOS.
Unus Nemo
Unknown parent • •@plan-A (゚ヮ゚)
Okay, I am up way past my bedtime 😉 I have to get some rack, take care brother!
Unus Nemo
Unknown parent • •@plan-A (゚ヮ゚)
You are going to love this 😉. I just checked my fork of llama.cpp and they had some fixes applied (I was 30 commits behind in 2 days 😉 very active project!). So I synced and you guessed it, I rebuilt my llama.cpp 😉. Just when I had everything up and running. It is cool though.
Review the changes in the repo, if you do not feel like they are pressing then you do not have to rebuild for every update, but be sure to do a git pull before your next build.
Unus Nemo
Unknown parent • •@plan-A (゚ヮ゚)
Okay, again the latest version of llama.cpp is installed to my satisfaction 😉. Though as often as they commit I will probably end up updating about once a week.