Platform dependant Rakefile - cygwin

I'm writing a Rakefile that, at some point, starts Jetty. The Rakefile should be platform independant so I can use it in my windows and my mac. To start jetty there are two scripts provided: jetty.sh and jetty-cygwin.sh depending on the system you are on.
In a bash script I know that there is a OSTYPE that I can use to determine if i'm under win or under mac but it is unavailable under ENV in ruby. Is there any way of doing something similar in a Rakefile?
Thanks a lot in advance

Did you try ENV['OS']? With Windows I get "Windows_NT" - sorry I can't test it for Mac.
There is also the constant RUBY_PLATFORM ( I get "i386-mingw32") - perhaps you can use
that.
Another idea, if the constants don't work:
The command ver is defined in windows and returns the windows version. What happens when you call it on the Mac? You could try something like:
case %x{ver}
when /Microsoft Windows/
puts "I'm running Windows"
when /Mac/
puts "I'm running on a Mac"
else
puts "Unknown?"
end
Replace the /Mac/ with the result you have (even if it is an error message - if you get the error, it's not Windows ;) ).

Related

Move Emacs from Linux to Windows

I've had a break from programming the last two years and want to start up again. Right now I'm using a Windows computer, but my work and compiler is on my Linux computer.
My question is:
Is it possible to move my entire emacs work environment from Ubuntu to Windows 10? I did some changes in emacs back in the days that I got used to and would love to continue like that on my Windows computer.
Briefly...
The most important things to copy are your ~/.emacs.d directory and your init file (see C-hig (emacs)Init File for the different filenames this might have, or check with C-hv user-init-file).
See C-hig (emacs)Windows HOME regarding where the .emacs.d directory should live on your Windows system.
Note the comments in that Info node on the site-lisp directory as well, in case you've been using elisp libraries in there (possibly without realising), as they can form part of your Emacs configuration as well.
Any byte-compiled elisp (.elc files) should remain compatible so long as you're moving to an equal-or-newer version of Emacs (which sounds likely in this case). Natuarally things do change between releases, though, and it's possible to encounter incompatibilities when upgrading, but I wouldn't worry about that in advance -- try the latest version first, and if you run into problems that you can't solve (which shouldn't be very likely), you can always install the version of Emacs you were originally using.

Bash Console commands (Codeship console): how to exit from current "inputs"

Excuse me for the imprecisions in the question but I don't know how it is called what I'm trying.
In the CodeShip documentation is stated that I can pass to the SSH CodeShip debug build some commands using their command line application.
So, I should do something like cs setup-commands and I'm prompted with this:
rof#railsonfire_unique_string_sfivbe8bwucb9:~$ cs setup-commands
Your setup commands:
phpenv local 5.6
phpenv local 5.6
In Your setup commands: I put my commands but then, how can I "execute" them?
The second phpenv local 5.6 line is wrote by the command-line application. I think is something to signal the command were taken, but the behavior is ever the same: I remain "blocked" in the command setup-commands. After setting setup-commands I have to set also test-commands but all the things I write are taken by Your setup commands:.
How can I "submit and exit" the command setup-commands to then launch test-commands and set those other commands?
I think this is something related to Bash, but I don't know what it is...
And I don't know which is the correct terminology.
Can someone help me with this? So I will can also update my question to be more precise. Thank you.
Not sure about your case, but usually the input is considered finished, when th input file (in your case stdin) is closed.
Try to press Ctrl+D, it should end your input (and so signal the program hat you stopped typing for this session)

x64 Portable executable not working

I created an exact replica of this file in a hex editor: https://i.imgur.com/LIImg.jpg
The problem is, the .exe file I made from it doesn't work, it says it's an invalid Win32 application when trying to run it. Is there something flawed in it? I've checked and double checked my file...
I'm not sure where I can host an exe file but I can email it if someone else wants to check it.
I should also mention I'm running Windows 7 64-bit.
The PE binary file from that illustration is already available here from the author, Ange Albertini. I have tested it both on Windows 7 and Windows 8/8.1, and it runs just fine, so you can use it for comparison with your binary.
In case anyone was wondering, the difference between the image and the executable is that there has to be 0's at the end of the file to match the section size. It doesn't work without that.

How to change windows exe file's icon in linux without wine?

I know I can use ResHacker to change a resource from windows and I know I can use ResourceUpdate function to do the same problematically (again in windows). My problem is that I have to update the icon of a windows exe file in linux, without using wine.
(the reason for not using wine is that this process should run on an automation server that change the files and sign them).
I don't know even where to start from.
You can change a files metadata like this:
gvfs-set-attribute '/path/to/file' -t stringv metadata::custom-icon "/path/to/image.png"
There's a program called windres that should suit your needs
Whoops, that's just a resource compiler, sorry.
However there is pefile a python module for working with PE executables, perhaps you could write a script with it that does what you want

Narrator for Cygwin

Does anyone know if there is a reader (text-to-speech) tool for cygwin or linux? I know of Microsoft's narrator, which partially works by sounding out what I type in the cygwin window (bash command line) but it doesn't report anything written to stdout.
Is there a native Cygwin tool anyone knows of?
BRLTTY, which is available through Cygwin's setup.exe, apparently does have some speech support in addition to being able to drive Braille displays. I've got no experience with it though.
BRLTTY seems to be just an interface for Braile displays - I couldn't make it "talk".
Instead get festival binary from bottom of here, put it in C:/festival, and in cygwin
echo "hello world" | /cygdrive/c/festival/bin/festival.exe --tts
should say hello world. Then I put it into a script say.sh and calling
~/say.sh hi
actually does what you'd expect :)

Resources