Subscribe: Jean-Paul S. Boodhoo's Blog
http://feeds.feedburner.com/JPBoodhoo
Added By: Feedage Forager Feedage Grade B rated
Language: English
Tags:
bundle  current file  current  develop passion®  end git github  external tool  file  github user  github  tool  user  vim 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: Jean-Paul S. Boodhoo's Blog

Develop With Passion®





Updated: 2016-04-14T16:53:40-06:00

 



Best Job Posting Ever!

2016-04-14T16:49:00-06:00

I’m not sure if the person who posted this job posting was being completely serious when they created it.

Serious or not, the individual definitely has an awesome sense of humour

Develop With Passion®

(image)



Annoying Chrome Extension API Bug - Introduced since Chrome Versions higher than 48.0.2564.103

2016-04-07T13:12:00-06:00

Been working for the last year with a pretty awesome startup and one of the core components is a chrome browser extension.

We thankfully wrote our code so that most of the mechanics of the extension api itself are managed by an adapter layer that defines how we want to interact with the browser.

A couple of weeks ago Chrome automatically updated and one of the adapters stopped working. We swapped out the non working piece for a custom solution, but the cause of the error is in a core chrome api that we had been using for a long time. The following code demonstrates the bug in action:

lang: javascript
1
2
3
4
5
6
7
8
//Bug Demo - Background page sending a message to itself does not trigger onMessage listeners to fire - failing on Chrome versions > 48.0.2564.103

//The handler below will run only if a message is being sent from a content script,
chrome.runtime.onMessage.addListener(function(data) {
  console.log(data);
});

chrome.runtime.sendMessage(null, 'Hi There From A Background Page Sender', null);

As you can see pretty basic, the background page will load and immediately send a message. The onMessage handler should be invoked with the message. The code above worked fine until Chrome went past 48.0.2564.103. I’ve submitted a bug report to Google with a full zip that contains a minimal extension that demonstrates this bug.

Currently this is not a blocker, as we just built another implementation of the adapter contract to negate the need to use sendMessage in the background page. It just seems to me that any other developers who are using sendMessage as a way to do asynchronous dispatch to other components in the “background component layer” should be being hit by this.

Anyone else seen this at all?

Develop With Passion®

(image)



Quick Test To Remember If I Can Still Do This!!

2016-03-26T04:55:00-06:00

One of those crazy nights when sleep completely eluded me! In my overall sleep life, I feel completely blessed that God has created me with the ability to fall asleep quickly and (usually) enjoy a great deep sleep. Nights like last night are the exception and definitely not the norm.

After praying, enumerating thoughts over the last couple of years of “houseless living”, and brainstorming ideas on what things I want to accomplish personally and professionally over the course of the next year; I decided to get up out of bed and do a quick test to remind myself if I still knew how to publish a blog post using the automation that I had put in place a long time ago!! Mostly since I have not even thought about writing anything up on this thing since last Feburary.

So here it is. My first test blog post since February 2015. Mostly a reminder to myself of how the mechanics of this whole setup work!!

As Always,

God Bless You and,

Develop With Passion®!!

(image)



Remember to clear out your zsh completion dump files!

2015-02-10T09:41:00-07:00

Everyone once in a while I’ll start up a new zsh session and I’ll start getting errors about:

lang: bash
1
__rvm_cleanse_variables: function definition file not found

Whenver that happens it is useful to remember that the simplest fix is just to delete your zsh completion dump files:

lang: bash
1
rm -f ~/.zcompdump*

Here’s the SO comment that set me straight!

Develop With Passion®

(image)



Quickly fix offlineimap ssl fingerprint error in tmux

2014-12-18T10:52:00-07:00

I’ve been using mutt and offlineimap as a killer combo for terminal based email management for almost 2 years now. Everyone once in while offlineimap will go to sync my mail and I’ll be presented with this awesome error message: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 Account sync jp_developwithpassion_gmail: *** Processing account jp_developwithpassion_gmail Establishing connection to imap.gmail.com:993 Folder INBOX [acc: jp_developwithpassion_gmail]: Skipping INBOX (not changed) Account sync jp_developwithpassion_gmail: Calling hook: notmuch new Hook stdout: No new mail. Hook stderr: Hook return code: 0 *** Finished account 'jp_developwithpassion_gmail' in 0:01 OfflineIMAP 6.5.5 Licensed under the GNU GPL v2+ (v2 or any later version) Account sync jp_developwithpassion_gmail: *** Processing account jp_developwithpassion_gmail Establishing connection to imap.gmail.com:993 ERROR: Server SSL fingerprint 'cf79537f0a504c116ee3cfb854bd58a70089edc0' for hostname 'imap.gmail.com' does not match configured fingerprint(s) ['d6b90ffd06292b1724e0644563299fffc9878780']. Please verify and set 'cert_fingerprint' accordingly if not set yet. *** Finished account 'jp_developwithpassion_gmail' in 0:00 ERROR: Exceptions occurred during the run! ERROR: Server SSL fingerprint 'cf79537f0a504c116ee3cfb854bd58a70089edc0' for hostname 'imap.gmail.com' does not match configured fingerprint(s) ['d6b90ffd06292b1724e0644563299fffc9878780']. Please verify and set 'cert_fingerprint' accordingly if not set yet. ...... Mailbox is unchanged. The most important lines in this message are the following 1 ERROR: Server SSL fingerprint 'cf79537f0a504c116ee3cfb854bd58a70089edc0' for hostname 'imap.gmail.com' does not match configured fingerprint(s) ['d6b90ffd06292b1724e0644563299fffc9878780']. Please verify and set 'cert_fingerprint' accordingly if not set yet. In your offlineimap configuration file there is a line that looks like this: 1 cert_fingerprint = cf79537f0a504c116ee3cfb854bd58a70089edc0 The simple fix is to quickly edit your offlineimap configuration file, change the cert fingerprint to match the new one that google is using, and you are off to the races. If you are using tmux, one way you can automate this task it to save the following script somewhere in your PATH, mark it executable and let it do the work for you: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 #!/usr/bin/env ruby # encoding: utf-8 pattern = /ERROR:.*fingerprint\s'(.*)'.for/ buffer_file = '/tmp/current_tmux_buffer' imap_file = '~/.offlineimaprc' `tmux capture-pane` `tmux save-buffer #{buffer_file}` contents = IO.readlines(buffer_file).join(' ') exit unless pattern =~ contents finger_print = pattern.match(contents)[1] system("sed 's/cert_fingerprint =.*/cert_fingerprint = #{finger_print}/' #{imap_file} | tee #{imap_file}") This simple ruby script just does the following: Write the current contents of the tmux pane I am in, to a file that can be worked with: 1 2 `tmux capture-pane` `tmux save-buffer #{buffer_file}` Find the new ssl fingerprint that should be used: 1 2 3 4 5 contents = IO.readlines(buffer_file).join(' ') exit unless pattern =~ contents finger_print = pattern.match(contents)[1] Update the contents of the current configuration file with the new fingerprint: 1 system("sed 's/cert_fingerprint =.*/cert_fingerprint = #{finger_print}/' #{imap_file} | tee #{imap_file}") In the last line I am just shelling out to sed to do the transform on the config file and then tee’ing the output stream back to the config file itself. Yes this can [...]



How I manage my vim plugins

2014-12-12T10:26:00-07:00

Way before tools like Vundler and the like came out for vim, as a perpetual automation junkie, I was constantly refining my workbench when it came to how to manage my vim plugins. What started off as a basic script has turned into a tiny ruby configuration tool that I can use to manage the downloading of my vim plugins. As a play on the tool it is mimics, I’ve called in VRundler, and since it evolved (very slightly) from basic script I wrote, there is no coverage (gasp!). I’ve ran my current configuration script successfully on Windows, OSX, and Linux and it works great. I’m just throwing this out there to demonstrate how I manage one of my tools. I’m not remotely suggesting people use this in place of Vundle, this is just another example of a different style of automation. Here is my current configuration script: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 def windows? RUBY_PLATFORM =~ /(ming|cyg)/ end bundles_folder = File.expand_path("~/repositories/developwithpassion/devtools/shared/dotfiles/vim/.vim_runtime/bundle") open_source_folder = File.expand_path("~/repositories/open_source") #A utility method I am using to build a qualified github user name that uses an ssh config host from my ssh configuration file def github_user(name) "github:#{name}/" end # Specify the path where you want your bundles installed bundles_dir bundles_folder # A git group allows you to specify a git user you wish to clone vim plugins from git github_user('vim-scripts') do # A bundle is a named vim plugin repo for the user, you can specify # multiple as the method accepts a splat of bundles, this is useful if you are # getting multiple plugins from a single author, you can also specify each plugin # with separate calls to: bundle '[PLUGIN]' bundle 'dbext.vim', 'vimgrep.vim' end git github_user(:altercation) do bundle 'vim-colors-solarized' end git github_user(:benmills) do bundle 'vimux' end git github_user(:developwithpassion) do bundle 'TwitVim' end # A symlink bundle is just a vim plugin that is on your local file system somewhere # and you want it symlinked into your vim bundle folder, the first argument is # the name the symlink will be given in your plugin folder symlink :dwp_vim_general, File.join(open_source_folder, 'dwp_vim_general') git github_user(:ecomba) do bundle 'vim-ruby-refactoring' end git github_user(:elzr) do bundle 'vim-json' end git github_user(:ervandew) do bundle 'supertab' end git github_user(:OrangeT) do bundle 'vim-csharp' end git github_user(:nanotech) do bundle 'jellybeans.vim' end git github_user(:kana) do bundle 'vim-fakeclip' end git github_user(:kien) do bundle 'ctrlp.vim' end git github_user(:MarcWeber) do bundle 'vim-addon-mw-utils' end git github_user(:scrooloose) do bundle 'syntastic' , 'nerdtree' end git github_user(:jistr) do bundle 'vim-nerdtree-tabs' end git github_user(:sukima) do bundle 'xmledit' end git github_user(:timcharper) do bundle 'textile.vim' end git github_user(:thoughtbot) do bundle 'vim-rspec' end git github_user(:pangloss) do bundle 'vim-javascript' end git github_u[...]



Fixing SSL_connect error with ruby on windows

2014-12-02T12:04:00-07:00

Been a while since I’ve worked on a windows project!

Just needed to update some of my gems in an automation project and ran into the following error:

1
Gem::RemoteFetcher::FetchError: SSL_connect returned=1

I did not want to do the easy thing and update the Gemfile to use the unsecured gem location, so I used the following script which I ran inside of an msys shell:

1
2
3
4
5
6
mkdir /c/transient
cd /c/transient
curl http://curl.haxx.se/ca/cacert.pem -o cert.pem
SSL_CERT_FILE="cert.pem" gem update --system
cd ..
rm -rf transient

This script just simply downloads the latest SSL cert and updates the gem program. Once that was completed I uninstalled and installed the latest version of bunder and then was able to happily bundle install.

Develop With Passion®

(image)



Unix based development on windows (redux)

2014-09-18T13:37:00-06:00

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®

(image)



Embrace the time in the valley

2014-08-16T09:59:00-06:00

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®

(image)



Quickly generate a README under every direct folder of a folder

2014-07-18T10:54:00-06:00

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

2014-07-16T11:02:00-06:00

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®

(image)



Rename large filenames with the full power of vim

2014-06-26T08:18:00-06:00

Hey Everyone,

Just found out a feature in vim by accident when I was trying to rename a long filename.

The following video demonstrates the technique!

Develop With Passion®

(image)



Speak Life

2014-06-24T08:00:00-06:00

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®

(image)



Unix Tool 1 - nohup

2014-06-22T16:12:00-06:00

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®

(image)



Determine which process is using a port

2014-06-21T08:35:00-06:00

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®

(image)



Updated TMUX, regaining splitting/creating new windows based on current directory

2014-05-28T20:16:00-06:00

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®

(image)



Developing With Passion

2014-05-21T12:35:00-06:00

These links are the links to both the slideshow for my recent presentation, as well as references to the resources that I mentioned during the talk:

Develop With Passion®

(image)



Latest song from ZayahB - Roll The Drum

2014-05-11T23:07:00-06:00

My son just published his latest song to SoundCloud, check it out.

(image)



Run the current file with an external tool - Vim

2014-05-05T11:02:00-06:00

There are lots of times when I am working with a file in vim that I want to be able to trigger an external tool against the current file. Of course, I can drop to a shell or enter ex mode, but most of the time I would like to be able to just trigger a mapping that executes the external tool against the current file. An example of this would be editing a javascript file and being able to have it executed by nodejs, or editing a ruby file and being able to have it executed by the interpreter. I set up the current script in my custom plugins folder (you can just place it in your .vimrc if you want a simple start): 1 2 3 4 5 6 7 8 9 if !exists("g:external_tool") let g:external_tool = "echo {current_file}" endif function! RunCurrentFileWithExternalCommand() let l:current_file = @% let l:command = "!clear && echo " . g:external_tool . " && " . g:external_tool execute substitute(g:external_tool, "{current_file}", l:current_file, "g") endfunction The following line: 1 let g:external_tool = "echo {current_file}" Sets up an global external_tool variable that is initialized to the echo command (not immediately useful!). Notice the use of {current_file}, this is just a placeholder that will be replaced in a later substitution. The RunCurrentFileWithExternalCommand function captures the name of the current file into the local variable current_file: 1 let l:current_file = @% The @ operator lets you address the contents of a register. The % register is the register that contains the name of the current file being edited. The next line: 1 let l:command = "!clear && echo " . g:external_tool . " && " . g:external_tool Sets up the command string that will be executed. The “.” is how you do string concatenation in vim. In this case, if the g:external tool variable is not changed, the default command that would be run is: 1 clear && echo "the_current_file_name" && echo [the_current_file_name] Finally the substitute command is run to replace the {current_file} marker with the name of the current file, and then it is run through the execute command. Here is an example of one of the mappings I have in place for a project I am currently working on: 1 nnoremap rnv :let g:external_tool = "vagrant ssh -c \"cd app && node {current_file}\"" This command will run the current file I am editing against the vagrant instance that hosts the app and all of its dependencies. This allows my base machine to just be the editor. Here are the remaining set of config I have for my vim setup to make this happen: 1 source ~/.vim_runtime/remaps.vim All of my main key remappings are defined in this file, here is the mapping that I have in my vimrc file to run the current file with the currently configured external tool is: 1 2 3 4 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Running Current File """"""""""""""""""""""""""""[...]