I have a Rackspace Cloud Server, where I host my site, the problem is that I need to upload the code every time using a SFTP program, but isn't any way to automate this?
PS: I use TextMate
If you also use Transmit, you can enable Docksend for a project and map this command to a key of your choice in the bundle editor:
#!/bin/sh
osascript "${TM_BUNDLE_SUPPORT}/bin/send_to_transmit.applescript" "$TM_FILEPATH" &>/dev/console &
echo "Sent ‘${TM_FILENAME}’ to Transmit"
Edit: There is actually a bundle that takes care of that here http://svn.textmate.org/trunk/Bundles/Transmit.tmbundle/
I use CTRL+Shift+F for that.
Related
I am having a Perl and a CGI file through which I want to fetch data from database. I've a UI where I am trying to use AJAX call which will hit the perl (.pl) or (.cgi) file and get the response in JSON. I've checked the perl/cgi file by running through command prompt and it works fine. This is how I am running my code in command prompt:
D:\>PerlExecutables\strawberry_32\perl\bin\perl.exe C:\Users\UserXYZ\Desktop\PerlExamples\test.cgi
The reason is I cannot do any kind of installation on my machine and also I don't want to run it through server like Apache or IIS.
How can this be achieved? Is there any way to make the script work in AJAX by passing the perl.exe path for execution or Any other alternatives?
Thanks!
One way to do this is to use Plack::App::CGIBin. It allows you to mount CGI scripts as apps with the PSGI/Plack protocol.
use Plack::App::CGIBin;
use Plack::Builder;
my $app = Plack::App::CGIBin->new(root => "/path/to/cgi-bin")->to_app;
builder {
mount "/cgi-bin" => $app;
};
Save that as myapp.psgi (or whatever your stuff is called) and run it like this:
$ plackup myapp.psgi
By default it will open up a server on port 3000 on localhost. You will need to be able to install Perl modules. Since you have Strawberry Perl that shouldn't be a problem. In the worst case, just use a local::lib.
You will also need to be able to open a port for listening. If you cannot there is no other solution than to get an admin to install you an actual full-scale web server.
The PSGI protocol and the Plack tools are a simple, easy to use replacement for CGI. They allow you to be very flexible while making it easy to have persistently running large applications.
I am currently making a CLI tool gem that downloads files from some service and saves them to a specified folder.
I was wondering, what would be the best way to store user settings for it?
For example, the folder to download the files to, the api access token and secret, that kind of thing.
I wouldn't want to ask a user for that input on every run.
I would read the API stuff from environment variables. Let the users decide if they want to enter it every time or set the variable in a .bashrc or .bash_profile file.
And I would ask for the download folder every time.
I'm used to Python Fabric in the past and I'm trying to do something similar with Ruby.
Basically I have created a Rake script which will run as a particular user which has SSH keys setup for passwordless access to the boxes in question.
I've managed to use https://github.com/seattlerb/rake-remote_task in order to run a command remotely, and expected the "put" method to "just work". However it seems to be an Rsync wrapper which does not take advantage of the keyless authentication.
It also seems to expect the file to be generated by a template which is not what I want, I want to SCP an actual .tgz binary file.
Am I missing something in the Ruby/Rake ecosystem. I expected this to be easy, but I feel like I'm going to need to go back to searching for gems?
I use two Internet connections so i want to use bash scripts to automate the task of switching between the two..
the problem is i cant able to configure firefox proxy settings via scripts, so is there a way to do that... does any configuration file exists for firefox so that i can modify over command line..
I have read this entry but this dint helped me much.. (its on windows)
firefox proxy settings via command line
you can use the "automatic proxy configuration" for this. this field takes a "pac" file which in fact is just a javascript function named FindProxyForURL that can use things like dnsResolve or isInNet to determine wether a proxy is needed or not. there is a wikipedia article which describes the files in detail and i have written a blog post a while a go that gives an example function.
I need to set up some sort of infrastructure to automatically FTP some files from one remote server to another. The FTP transaction will occur on a scheduled basis. Both these servers are Windows boxes and the location of the files that need to be FTP'ed will depend on the current date (the folder they sit in will be named the current day's date).
I would really hate to have to write something like that from scratch, so are there tools/utilities/the likes out there?
Windows command line ftp will read input from a text file. For example:
ftp -ni < ftpscript.txt
Where these options are used:
-n - Suppresses auto-login upon initial connection.
-i - Turns off interactive prompting during multiple file transfers.
The ftpscript.txt would look something like this:
open ftp.mycompany.com
user someuser password
binary
get /somedir/myfile.dat
It should be reasonably straightforward to write a script that outputs an FTP script containing the correct file name.
You would think that this would be an easy task. It isn't.
The best tool I've found is SyncBack and I think there is a free/lite version available.
If you're in a Windows environment consider using PowerShell and the System.Net.WebClient .NET Framework class like this post. This is a download example, but the WebClient object also provides an UploadFile method.