Change the hostname on Mac OS X
To set the hostname of your Mac, run the following command in Terminal:
sudo scutil --set HostName my-new-hostname.local
Check it by typing:
hostname
Related cards:
Use non-ASCII characters on IRB and Rails consoles with RVM and Mac OS X
If you are using RVM on a Mac and cannot enter 8+ bit characters on an IRB or Rails console, you are missing the readline
package. You will need to re-install your Ruby to fix this:
rvm remove ree
rvm package install readline
rvm in...
How to change the hostname in Cucumber features
Capybara uses www.example.com
as the default hostname when making requests.
If your application does something specific on certain hostnames and you want to test this in a feature, you need to tell Capybara to assume a different host.
Given...
Mac OS X Lion (10.7.2) screws host resolution
As Justin Carmony points out, Mac OS Lion changed its behavior towards DNS and the usage of /etc/hosts (it quite disregards this file).
This has several ugly effects, including:
- no matter how many Apache Virtual Hosts you've set up, you will o...
Change the name of your Ubuntu machine
In order to rename your Ubuntu box, replace all occurences of the the old name in the following two files:
/etc/hostname
/etc/hosts
After a reboot your hostname is changed. If you don't want to reboot your Ubuntu box you have to execute ...
Open a new tab with the current directory on a mac
I found a nice script on crazylittlehacks and modified it slightly. Put the attachment to /usr/local/bin
, chmod +x
and run it like this:
tab
You m...
How to move a window to the next monitor on Xfce, Mate and other X Window Managers
Since I use this a lot in my daily work and there were no scripts working properly for me, I made one myself.
It's actually not bound to Xfce but should work on any window manager (haven't tried it, though).
Installation
- If you don't yet ...
Change the MySQL default character set on Amazon Relational Database Service (RDS)
Look here for informations how you can show the MySQL default character set.
At first you need the [Amazon RDS Command Line Toolkit](http://docs.amazonwebservi...
Fix for mysql2 error "Incorrect MySQL client library version! This gem was compiled for x.x.x but the client library is y.y.y."
This should be fixed in the latest LTS-branches of our mysql2 fork, 0.2.x-lts and 0.3.x-lts.
Use
gem 'mysql2', git: 'https://github.com/makandra/mysql2', branch: '0.2.x-lts' # for Rails 2.x
gem 'mys...
How to get the hostname of the current machine in Rails or a Ruby script
Use Socket.gethostname
. So for a machine whose hostname is "happycat", it will look like this:
>> Socket.gethostname
=> "happycat"
That should work right away for your Rails application. For plain Ruby, you first need to do:
requi...
RSpec: Change the type of a spec regardless of the folder it lives in
In a Rails application, *_spec.rb
files get special treatment depending on the file's directory. E.g. when you put a spec in spec/controllers
your examples will have some magic context like controller
, post
or get
that appears out of now...