Cloud9 local workspace location - cloud9-ide

How can I set the cloud9 workspace directory, right now it defaults to the directory of cloud9 itself, which is ~/local/cloud9.
I tried editing config.js in the root like:
exports.Config = {
workspace: "/var/www",
ip: "127.0.0.1",
port: 3000,
gaeLocalPath: "/var/www",
};
Both those vars were "." before, i set them to the "/var/www", which I want as the default location.
But as you've guessed, it won't work. Tried restarting etc.
I'v searched for other settings files, but nothing.
I kindof like this editor, but I don't want my FTP setting in the 'c9 cloud', and it's local data for my own website, so why bother with FTP?
Or does anyone recommend a better alternative, a webeditor, with code syntax highlighting? And local file support?

Related

Add custom lines to Nginx config with Vagrant / Homestead

I'm running an Nginx server on a Vagrant Homestead box and I would like to add this piece of code to the server part of the Nginx config file for my site (in '/etc/ngnix/sites-available'):
location /storage/ {
add_header "Access-Control-Allow-Origin" "*";
}
I can type it in manually, but then it's gone every time I run vagrant provision.
What would be the best way to add this code during or after the provisioning?
Update 1
I found this article: https://medium.com/#maxxscho/laravel-homestead-with-custom-nginx-configurations-2e0fda4ba7dc
which brings me a step closer but now I have to figure out a way to place the custom serve-###.sh file outside the vendor folder. If anyone has thoughts on this, they are welcome as well!
Update 2
After fiddling some more I came up with a fairly decent solution:
Copy the vendor/laravel/homestead/scripts/serve-laravel.sh to a folder outside the vendor folder (e.g. ./scripts).
Edit the file to your needs.
Place some additional code in the Vagrant file to copy the script to the vendor folder before provisioning.
Add this to the Vegrantfile:
....
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.trigger.before :provision do |trigger|
trigger.info = "Copy custom scripts to vendor folder"
trigger.run = {
inline: "cp -r /scripts/* vendor/laravel/homestead/scripts/"
}
end
....
Any other solutions are still welcome!

Not able to change default download directory for chrome with selenium hub docker and ruby watir

After a few days of searching and experimenting with any of the solutions I could find online, I give up and want to get some help from the community.
Ruby gems (ruby 2.5.1):
watir 6.11.0
selenium-webdriver 3.4.1
Docker:
selenium/node-chrome-debug:3.14
selenium/hub:3.14
My ruby code:
prefs = {
download: {
prompt_for_download: false,
default_directory: download_directory
}
}
browser = Watir::Browser.new(:chrome, url: selenium_hub_url, options: {prefs: prefs})
Our set-up is:
Run a selenium/hub and a selenium/node-chrome-debug. Something that might be different is that we are mounting the /tmp of the base OS as /hosttmp/tmp in the node container
Make the selenium/node-chrome-debug talk to selenium/hub
Make the browser automation talk to the selenium/hub using the code provided above
The problem is that I was never able to set the default download directory. However, all other parts are working correctly. The VNC window shows the browser is working correctly despite the default download directory settings. It is always /home/seluser/Downloads
Things I have tried:
Other people's ideas such as different ways to specify the options and preferences. (e.g. using the Capabilities)
Docker security-related settings such as: --privileged --security-opt apparmor:unconfined --cap-add SYS_ADMIN
On the base OS, chmod 777 for the download_directory. The download_directory, for example, /tmp/tmp.123 on the base OS, which is mounted as /hosttmp/tmp/tmp.123 in the chrome node container, I could see it and make a few read/write operations in this folder inside the container or on the base OS
Tweaks about the interesting ruby symbol/string stuff when creating a Hash object.
Does anyone have more ideas about what could lead to this situation? What else I could try? And is there any log that I could refer to. There is no error or warning when running the code. Thanks in advance.
I'm using Java+Docker+Selenium+Chrome for automation test and also met similar issue with you. Please find my solutions below and try if it works for your case.
Don't set default download directory in the options, just leave "/home/seluser/Downloads" as it is.
When you start up the chrome node on docker, please add the parameter of volume that could transfer the downloaded files to the directory you want.
e.g. docker run -d -p 5900:5900 --link myhub:hub -v :/home/seluser/Downloads selenium/node-chrome-debug:3.14.0
In my case, the JDK environment and my test script is on Linux machine while the selenium webdriver & browser are all on docker, so once the file downloaded by browser it cannot saved directly on Linux machine, you have to mount the local directory with default directory on docker. Then you could find the file saved in the directory you want.
Thanks & Regards!
Jing
Did you define options = Selenium::WebDriver::Chrome::Options.new?
We use
options = Selenium::WebDriver::Chrome::Options.new
prefs = {
prompt_for_download: false,
default_directory: download_directory
}
options.add_preference(download: prefs)
and then you would want something like
browser = Watir::Browser.new(:chrome, url: selenium_hub_url, options: options)
But maybe the main problem is just that you are using
options: {prefs: prefs}
instead of
options: {download: prefs}
Okay, by digging into the source code of the Watir and Selenium-Webdriver, I think I know the 'root cause'.
I have created an issue since I am not sure if this is a bug or a 'feature' The issue
Also, I have a workaround for my case, in watir/capabilities.rb:
Change
#selenium_browser = browser == :remote || options[:url] ? :remote : browser
to
#selenium_browser = browser == :remote ? :remote : browser
This shouldn't be the final solution as it might not be a good idea. Will wait for what the Watir people say about this.

Issue with SaltStack

Recently I started taking an interest in Salt and begun doing a tutorial on it.I am currently working on a Mac and I having a hard time trying to start the vm[the minion] from my laptop[I am using Vagrant as an application to start the process]
The vagrant file for the vm contains these lines:
# salt-vagrant config
config.vm.provision :salt do |salt|
salt.run_highstate = true
salt.minion_config = "/etc/salt/minion"
salt.minion_key = "./minion1.pem"
salt.minion_pub = "./minion1.pub"
end
even though I wrote this it gets stuck at:
Calling state.highstate... (this may take a while)
Any ideas why?
One more thing.I seem to need to modify the top.sls file at the next step which is located in /srv/salt.Unfortunately I can not find the /srv file anywhere,why is that?is there a way to tell the master that the top file is somewhere else?
If you don't have a top.sls created, then you won't be able to run a hightstate like you have configured with the salt.run_highstate = true line.
If you don't have a /srv/salt/ directory created, then you can just create it yourself. Just make sure the user the salt-master is running as can read it.
The /srv/salt/ directory is the default location of what is known as the file_root. You can modify its location in the master config file /etc/salt/master and modify the file_roots config option.

Creating a custom Vagrantfile from Packer

I've been trying to figure out how to create a custom vagrant file from packer, I understand that in the post-processor section you will define a directory from which to scrap from, what I do not understand is if there needs to be a specifically named file inside as to which to gather data from.
"post-processors": [{
"vagrantfile_template": "configs/vagrantfile_template",
"type": "vagrant"
}],
The above code to my knowledge would look under configs/vagrantfile_template, but what would need to be in here? Would I create a Vagrantfile and place it there, or would it need to be a specifically named Ruby file?
The vagrantfile_template option in a vagrant post-processor points directly to a file and not a directory [0]. The contents of this file should be structured like a normal Vagrantfile and contain any customizations for the box artifact that you are creating.
For example, if you wanted users of your custom Vagrant box to not have the /vagrant shared folder mounted by default, your Vagrantfile template might look like this...
Vagrant.configure("2") do |config|
config.vm.synced_folder \
".",
"/vagrant",
:disabled => true
end
Resources
[0]: https://github.com/mitchellh/packer/blob/53b1db16692c7bf2e654ac125b8676c02154d07a/post-processor/vagrant/post-processor.go#L113-L138

ST2: SublimeLinter ignoring JSHint settings

I've been trying to configure SublimeLinter to use different JSHint settings, but my settings are being totally ignored. Mostly I just want to be able to use double quotes without getting a linting error. Here's what I have in my 'User' SublimeLinter.sublime-settings
{
"jshint_options":
{
"evil": true,
"regexdash": true,
"browser": true,
"wsh": true,
"sub": true,
"quotmark" : true
}
}
The file is definitely being parsed, as it throws an error whenever it's not properly formatted (amusingly this includes whenever the strings are wrapped in single quotes). It's also ignoring more than just the quote preference- I can set "evil" to false and it'll still give me eval warnings.
Any ideas? This is on OSX.
Thanks in advance.
FYI just in case: jshint_options is no longer available on SublimeLinter-jshint and settings are now set with .jshintrc files. See this and this.
I had the exact same problem. The default .jshintrc in "sublime/preferences/package settings/js hint/set linting preferences" did absolutely nothing for me either.
In order to fix it, I created a .jshintrc file in the root folder of the web project I was working on. I then opened the folder through sublime text and sublinter/jshint picked up my settings.
Maybe your Jshint options are overridden by a .jshinrc file. According to SublimeLinter README file :
SublimeLinter supports .jshintrc files. If using JSHint, SublimeLinter will recursively search the directory tree (from the file location to the file-system root directory). This functionality is specified in the JSHint README.
and
The jshint follows convention set by node-jshint (though node is not required) and will attempt to locate the configuration file for you starting in pwd. (or "present working directory") If this does not yield a .jshintrc file, it will move one level up (..) the directory tree all the way up to the filesystem root. If a file is found, it stops immediately and uses that set of configuration instead of "jshint_options".

Resources