Unix Based Development on Windows (Redux)

I wrote a post a couple of years ago on how to setup RVM in a cygwin environment on windows.

There have been quite a few people who have been able to follow this post successfully. There is an equally high number of people who were not able to get the setup working correctly. My current take is the following:

Don’t bother trying to do any unix style development under windows”

Please, do yourself a favour, install vagrant and setup a virtual machine for your project. Everyone on the team will be using the same machine setup, you won’t have to fight with annoying windows/unix based irregularities. And the tools that you are probably trying to develop with will more than likely just work the way you expect.

It’s been a number of years since I have been on a windows based project. And if I had to be on a windows based project again, it would more than likely be a C++, .Net or some other development environment that is a first class citizen under windows.

When I’m working on a unix based project, I’ll be working in a fully supported unix development environment, and based off of current history, with a vagrant backed vm that can be shared by the other team members.

My current dev setups are OSX/Unix based hosts, with Vagrant vms configured per project.

Develop With Passion®

Embrace the Time in the Valley

I’m sure lots of us have questioned the purpose for God allowing us to experience the deep valleys in our life. The knowledge that the purpose of the valley is sometimes necessary for the development/refinement/elimination of character or heart attributes, often does not make the walk through the valley any easier.

It’s also funny that often, when we are in the valley, we can reach out for God and sometimes get the “feeling” that He has abandoned us. I think, also, this period is for strengthening our resolve of “knowing” that He is there even when our emotions are trying to tell us otherwise. These periods can help transition our faith to something more than just fleeting/extended periods of emotional euphoria to something much deeper and rooted in something a lot more solid than our flimsy human emotions!

I was reading the Screwtape Letters earlier today and came across this fantastic excerpt that I wanted to share. As you read this keep in mind the fact that this is being written from the perspective of the demons!

Do not be deceived, Wormwood, Our cause is never more in danger that when a human, no longer desiring, but still indending, to do our Enemy’s will, looks round upon a universe from which every trace of Him seems to have vanished, and asks why he has been forsaken, and still obeys.

CS Lewis The Screwtape Letters

Develop With Passion®

Quickly Generate a README Under Every Direct Folder of a Folder

Quickly needed to generate a README.md under every folder of a folder that contains custom node packages

The output of the following command:

find
1
find . -type dir -depth 1

gives me this:

lang: Custom Node Modules
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
./containers
./core_utils
./defining_classes
./delegation
./expect
./extensions
./fakes
./jspecs
./key_generator
./load_path
./logging
./matching
./namespace
./node_bootstrap
./resolution_root

.

I was getting tired of seeing missing readme warning when vagrant provisioning, so I wrote the following:

Generate Readme
1
2
3
4
5
6
for module in $(find . -type dir -depth 1 | sed "s/\.\///");
do
  pushd $module
  echo \#$module > README.md
  popd
done

I used sed to get rid of the the leading ./ so I can use the output for the title in the readme file.

That quickly generates a file called readme.md under each custom node package that is being maintained in the folder that I am in.

It’s good to break out the shell scripting foo every now and then!!

Develop With Passion®

SSL - Generating an Unencrypted Key and Csr for a Cert Request

Had to generate a new ssh key and cert request the other day for a dreamhost server. Accidentally made the mistake of putting a passphrase on the key, so my first request came back no good.

Here is the script that I used to generate a new private key and csr request to submit to the certificate authority:

1
openssl req -nodes --newkey rsa:2048 --keyout new_key.key -out new_csr.csr

The -nodes argument is what ensures that the new private key will remain unencrypted, which is essential if you are installing the certificate on a web server through some sort of admin interface, vs having access to the box yourself.

Develop With Passion®

Speak Life

Our message series for this year in Church is all about “Mountains will move”.

One of the aspects that our pastor has talked about in the last couple of weeks (event though I’ve missed quite a bit this year!) is speaking to our mountains.

Our words have power, God’s word says:

The tongue has the power of life and death, and those who love it will eat its fruit.

When we choose to use our words to speak life into people as opposed to tearing them down, we can literally transform a heart.

This song is an awesome song that reminds me of the impact that “Speaking Life” can have.

Develop With Passion®

Unix Tool 1 - Nohup

This post, along with many others to come is serving as a pointer to people that I have worked/will work with about lots of useful unix utilities. Where there is an existing good reference I will just post a link, otherwise I’ll write my own post. Current time demands warrant that I’m going to be link posting a lot!!

The tools are not mentioned in any particular order, so don’t place any significance on which order I choose to mention them.

I am of the opinion that every developer owes it to themselves to get a grounding in unix and its accompanying toolchain, though that’s a discussion for a whole other blog post!

Following posts will be absent of the prior blurb and just get right to the tool.

nohup

Used to keep background jobs running when you exit from a shell session.

Develop With Passion®

Determine Which Process Is Using a Port

Quick bit of unix trivia!

Every so often I will be recreating one of my Vagrant vm’s, and even though it should have been destroyed I will get errors about forwarded ports colliding.

In this situation I want to verify that it is the vm provider that is locking the port (vmware fusion in my case).

To do that just run:

1
lsof -i :[port_number]

As an example (using port 80), this is the output I get:

1
2
3
4
COMMAND     PID USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
Dropbox     418   jp   23u  IPv4 0x3321ede7d20f87c3      0t0  TCP 192.168.1.2:49204->snt-re3-6c.sjc.dropbox.com:http (ESTABLISHED)
firefox   82810   jp   58u  IPv4 0x3321ede7e980cfab      0t0  TCP 192.168.1.2:60421->pb-in-f95.1e100.net:http (ESTABLISHED)
firefox   82810   jp   59u  IPv4 0x3321ede7eeddc7c3      0t0  TCP 192.168.1.2:60422->pb-in-f95.1e100.net:http (ESTABLISHED)

At that point I have the PID that I can then terminate expeditiously!!

Develop With Passion®

Updated TMUX, Regaining Splitting/creating New Windows Based on Current Directory

Just upgraded my copy of tmux and went to split my windows and realized that the default behaviour to split the window based on the current directory disappeared.

The quick fix to this for me (could be a better one, but I have not done any research yet) was to remap my map binding to augment the commands to maintain their old behaviour:

Updating Tmux split bindings
1
2
3
bind c new-window -c '#{pane_current_path}'
bind-key d split-window -v -c '#{pane_current_path}'
bind-key % split-window -h -c '#{pane_current_path}'

Each of these bindings maintain the exact same behaviour that was there prior to my tmux update.

Develop With Passion®