Can I use emacs on my computer to compile C code via ssh to a linux terminal? - linux

So I just started a computer science course and we are learning C. Well, we are supposed to know it already. They suggested that we use emacs to write our C code.
So what I do is use putty to ssh into one of the linux computers in the lab. I am wondering if i can download emacs onto my laptop instead of using the one in the terminal. So i have a session open on one of the computers in the lab from my laptop but i am using a program on my laptop to compile the code. Hopefully that makes sense.
I am wondering if this is possible or do i have to use the emacs within the terminal (the one that's not color coded and looks nice.)

I'm not sure I understand all your requirements, but all the following can be done:
Install Emacs on your machine; install a C compiler on your machine; and do all your work locally.
Do all the work remotely in putty (as you've been doing, apparently).
Install Emacs locally, to edit and compile remote files (i.e. the files stay on the GNU/Linux server and are compiled there, but you edit them in your local Emacs, via Tramp which internally accesses them via ssh).
You can install precompiled binaries for the above, or you can compile them yourself.
Even better, you can install GNU/Linux on your machine, so that installing Emacs or a C compiler is then a simple matter of "aptitude install gcc emacs".

Related

nvm with WSL for projects stored in Windows

I'm struggling to understand how exactly WSL works.
The training that I'm doing requires nvm so I can manage my node versions in my project, located in my hard drive that is running with Windows.
So, in order to use nvm I need WSL, but I cannot comprehend where it is located. As far as I understood (and I'm pretty sure that I'm wrong) the WSL that I installed is like a Linux VM, completely independent from my Windows, and I operate it through the Ubuntu Terminal that came with WSL. If that's the case, how can nvm in WSL be useful if my project is in my Windows directory and the WSL controls node versions from my Linux VM?
How do I make nvm useful for my project running from my C:\ drive and how does WSL work with nvm in my Windows?
Thank you!
A few options, but each has advantages and disadvantages:
If your Node/JavaScript files are on your Windows C:\ drive, then you do have the ability to access that from WSL. Windows paths are automatically mounted and accessible in WSL via /mnt/c, /mnt/d, etc.
So if you have your JS source in, for example:
C:\Users\<myusername>\Documents\Projects\JS_class\project1\
Then that would be accessible under Ubuntu in WSL via:
/mnt/Users/<myusername>/Documents/Projects/JS_class/project1/
The disadvantage here is performance, as mentioned in this question.
Alternatively, you can store your project files inside WSL. You can access the WSL path from Windows by using \\wsl$\Ubuntu\home\<yourusername>\ (or similar). You can use this to copy from your existing Windows drive to your WSL distribution.
Advantage: Faster. Disadvantage: Unknown -- You seem to want the files to be in Windows, but I'm not sure why.
Or you can use WSL1 for most Node/JS tasks. See the previously mentioned answer for details on how to convert.
Advantage: Speed
Disadvantage: WSL1 hasn't been updated in a while, and is started to run into some compatibility issues. It's still popular enough and stable enough at the moment for me to continue to recommend it, though.
There's also a Windows version of nvm as well as a replacement project that the repo there mentions. I cannot personally speak for the quality of it, but it does have 23k stars on Github. Note that it is not affiliated with the original (Linux-based) nvm project.

Compile python 3 script to standalone exe in Linux

Can a python 3 script be compiled in a linux environment in such a way as it can be run under Windows?
If so what compile tool? ie. py2exe or pyinstaller ect.
You're looking for cross-compilation, and the answer is no.
Can I package Windows binaries while running under Linux?
No, this is not supported. Please use Wine for this, PyInstaller runs fine in Wine. You may also want to have a look at this thread in the mailinglist. In version 1.4 we had build in some support for this, but it showed to work only half. It would require some Windows system on another partition and would only work for pure Python programs. As soon as you want a decent GUI (gtk, qt, wx), you would need to install Windows libraries anyhow. So it's much easier to just use Wine.
Can I package Windows binaries while running under OS X?
No, this is not supported. Please try Wine for this.
Can I package OS X binaries while running under Linux?
This is currently not possible at all. Sorry! If you want to help out, you are very welcome.
You may use Wine or the Windows Subsystem for Linux to attempt using PyInstaller to build stand-alone binaries for different operating systems, however, neither PyInstaller, nor Py2Exe, nor cx_freeze, nor any tool to my knowledge does this.
Effectively, in-order to do something like this, you would need a cross-compiler such as MinGW or VC++ for Linux, and integrate it into PyInstaller, which is very far outside of the scope of the project. It is much easier to use WINE or having a dual-boot system or multiple development computers.

at nodejs.org, is the linux tar file going to work on cygwin

I need to get node.js for a program I'm installing in Cygwin, and I'm wondering if the Linux download at nodejs.org is going to work, or does something like this for Cygwin need to be built from source? I tried downloading the linux tarball and incorporating into the installation script for Oppia (the program I'm installing) and it doesn't work, but I don't know enough about this to know what's wrong.
I suppose node.js on cygwin is not really supported. I worked with node.js under cygwin, installed with Windows installer. There are some problems, especially when there are dependencies on paths (/cygdrive/c/...). I haven't tried to build from source, but asked the guys on the node.js google group a similar question, but they just said: not supported.
So probably it's better to write those unbelievable ugly .bat/.cmd scripts and use the DOS shell commands when working with Windows (which I hate so much). I tried to use PowerShell, but it was no improvement, it's odd compared to bash.

how to run Emacs when SSH-ing from Linux to Mac OS X (with XForwarding)?

At work I get a choice of two laptops to use, Windows or Mac. Being a linux guy, I thought the MacBook Pro will be a good fit.
So I bring the MacBook Pro laptop home, and realize it doesn't have a right-ctrl key. And the bottom panel is annoying as hell. So I say, no problem, I'll sort all that out later, for now I'll use it as a server and remotely ssh into it from my crispy Xfce workstation environment. Well...
I've spent about a day trying to figure out:
How to ssh into the mac from my Fedora workstation, run emacs and have it show up (XForwarded) on my linux workstation ? You know like this:
I've installed XQuartz and changed /etc/sshd_config and /private/etc/sshd_config with:
X11Forwarding yes
XAuthLocation /opt/X11/bin/xauth
Mind you, xeyes works, and so does xclock, yay !!!
Apparently X forwarding is working okay, since other gui apps are showing up remotely. But as for Emacs, foggetaboutit.
The default Emacs from /usr/bin/emacs just runs it in -nw mode. Then I've installed the latest Emacs 24.3 (into /Applications/Emacs.app/Contents/MacOS/Emacs). This time, if I'm physically logged into the laptop (i.e. from the laptop keyboard) running Emacs from ssh shows up on the laptop's screen !!! WTF? If I logout of the laptop, then I get:
_RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.
I'm at my wits ends. Any ideas why other X apps work? Anything special about Emacs?
The Emacs.app binary is built to use Mac OS X's window system (we call it "ns" around here), which has nothing to do with X11, so you can't forward it over the network to another host. Instead, you want to install another Emacs on your Mac, which is built to use the X11 window system (so you can use it locally via Xquartz (which lets X11 clients use the native Mac OS X display), or you can use it remotely like any other X11 client).
The easiest way is probably to built it yourself: get the emacs-24.3.tar.gz source code and compile it with ./configure --with-x; make.
With Mac Ports x11 or gtk variant has to be selected, like this:
sudo port install emacs +x11
or that:
sudo port install emacs +gtk

Windows 8 + Git + Composer + SSH

So, I've been using ubuntu linux for a few months and loved it for my web dev. Everything simply works!
But I switched back to windows because linux sadly doesn't run 90% of my apps :(
So now I have a question, how do you work with git, composer and ssh on windows?
Should I setup a linux virtualbox or is it possible to be able to work comfortably without it?
"TortoiseGit" is a nice extension if you prefer some graphical support, and this needs "msysgit" to give the git commands on windows - which also brings you "git bash" if you prefer the command line. "msysgit" could be installed standalone.
SSH under Windows is always Putty. Grab the newest release 0.63, it has security fixes. To work easily with git then, you need to setup the whole public key authentication with "pageant" running in the background. Putty does a bad job configuring it to convenient levels, you have to manually add it to autostart. Or you could either use KeePass with the KeeAgent plugin to get the same (I prefer it a lot: All authentication stuff in one location).
Executing composer is a question of having installed PHP >= 5.3. If PHP is installed, you execute the alternative install command (without curl) and are nearly ready to go. Having PHP and the composer.phar in the path or add their location to the path eases things a lot.
Caveat: I have no experience with Windows 8 so far, things might be different there. My suggestions are supposed to work on Win 7 at least.
The biggest drawback of Windows is that there is no decent shell support I'd like. Having a virtual machine still is a good idea, but you need your development tools within Windows as well.

Resources