2014-05-27

Gem reverse dependencies

I have been looking for a way to see what gem uses a gem, so I can see examples of integration in other projects. The rubygems API guide don’t tell anything about such reverse dependency query. But it is actually there, it got merged some time ago, and optimized, but it is not documented yet (it runs really fast, kudos Rubygems guys).

ruby -ropen-uri -rpp -ryaml \
     -e 'pp YAML.load(open("https://rubygems.org/api/v1/gems/rails_best_practices/reverse_dependencies.yaml"))'

["metric_fu",
 "flyerhzm-metric_fu",
 "edouard-metric_fu",
 "devver-metric_fu",
 "goldstar-metric_fu",
 "socializer",
 "trollface",
 "guard-rails_best_practices",
 "rferraz-metric_fu",
 "git-hooks-helper",
 "odor",
 "rake_check",
 "koality",
 "danmayer-metric_fu",
 "bf4-metric_fu",
 "metrics_satellite",
 "code_hunter",
 "kinit",
 "rails-audit",
 "pronto-rails_best_practices",
 "free_disk_space",
 "warder",
 "ruby_osx_app",
 "sanelint"]

Out of curiosity I counted some wellknown gems usages by adding a .count at the end:

rake:    23766
rails:   6283
thor:    2786
pry:     2870
sinatra: 1964
devise:  422 

2014-05-22

Hackpad cli

In Faria we use hackpad a lot, it’s pretty useful. Mose made a command line interface so he can download all the pads locally and grep them all in one go. It also transforms the markdown much better than the original hackpad markdown export, which totally sucks (as for now). So pads can be recycled easily in github wiki pages.

2014-05-15

Eddie Vim and rcfiles

Mose sometimes uses vim on the side of ST3, and can’t do it without the pretty good eddie kao set of config files.

Check it out at https://github.com/kaochenlong/eddie-vim it’s tailored for rails dev. I gathered it (plus my oh-my-zsh setup) in my github rcfiles repo https://github.com/mose/rcfiles with an installer that I runs when I install a new server.

2014-05-08

Dictionnary in sublimetext

I recently have been annoyed by his own typoes and has been looking for a way to fix it. This is actually pretty simple to cmd-shift-p and install a package called Dictionnaries. Then by hitting F6 you switch on and off the spellcheck highlighting. When you write a lot of documentation that is very helpful (and you want to write a lot of documentation, don’t you ?).

The spellcheck auto-highlight can be enabled for specific file extensions (like .md files) by adding

"spell_check": true

in preferences > Settings - more > Syntax specific - user (while having a markdown page open)

2014-05-01

SSH to socket

I use a special trick because he’s often ssh’ing all over the place. Add in your .ssh/config

Host *
  ControlMaster auto
  ControlPath /tmp/%r@%h:%p

It will save your first connection to a host as a socket in /tmp and then all subsequent ssh connections to the same host are open instantly because there is no key renegotiation on the way. The side effect is that the child-connections cannot be closed until the first one closes, but I find it convenient because it tells me that I still have a console open on the server that I should close.

2013-04-07

About Green Ruby

Green Ruby is a weekly newsletter that I’m publishing about ruby, rails, javascript and web development in general. I am preparing a website to make it more collective and here is the ‘about’ page, not yet published, but I was thinking it could be interesting to share it before the website is all ready.

Genesis

The Newsletter began in june 2012 from the habit I had to send weekly newsletter in Codegreen for our team to know what is happening in our company,. That was purely a teamwork tool for general transparency. But with time passing I also included there some links to what I was finding around that would be of interest for my geek colleagues.

That CodeGreen Internal newsletter began to be cluttered with various links at the bottom of it. So I decided to separate that links gathering bunch in another newsletter. But then it could also be useful for my friends, out of the scope of our team.

Green Birth

At that time I had to test Mailchimp service for one of our projects, so because they offer a free package when volume is not too big, I thought I should just create that newsletter as a public freely available publication.

So in february 2013 I sent the first Green Ruby Newsletter to 3 subscribers. Well, mostly our team :) Then it became a weekly habit, so I got a domain name for it, and organically it’s growing slowly.

The redactor gear

Codegreen paid for my Newsblur account so I can follow a bunch of feeds. Google reader was my first tool but well, they are closing, and actually Newsblur is much better. It’s open source and the guy that makes it does a great job (too bad it’s in python and not in ruby).

I’m also loading a bunch of podcasts on my phone and after having tried a lot of podcast softwares I’m really happy with Podkicker, it’s just very convenient and it has all I need with the free version. So in my 40 minutes commuting to go to work, I just get the ears busy. I tried to use Gpodder but it’s not totally perfect and the support in podcast clients is not as good as it should be. So I don’t stick on it, maybe it will evolve and I will get back to it.

But I also get a lot of news by just wandering around on Geekli.st, on Coderbits, hacker news, and I subscribed to a bunch of various newsletters. I also watch teh new gems feeds from @rubygems-alt and I retweet stuff of interest on @cogtw account (those 2 are my alternate twitter identities).

Each week William (aka xenor) also sends me a list of links. But I definitely don’t use any facebook feeds. For some reason, this is a place I avoid the most I can.

What next ?

My ambition there is to keep it non-commercial, and change it to be more community driven. The preparation of the letter is eating a big part of my saturdays for the last 13 weeks and I don’t think I can keep up the same pace for long time.

The idea I have about the community driven thing is by engineering some automation on the news gathering (to replace newsblur), have a place where the news can be triaged by various people, a little bit like it is on Hacker News with a vote system. But the gathering won’t limit to blog posts and rss feeds, there would also be podcasts and video feeds. There is now a lot of possibilities in automation on feeds aggregation. I worked on a project that already does that feeds aggregation, named “the Blux”. And I expect to replicate parts of it for my Green Ruby Engine.

But also, as usual, this project is also an occasion to play with recent technologies or stuff I want to know more about, otherwise where is the fun ? So here comes Ember.js, on the top of Sinatra with mongoDB, and there will be much more on the road (thinking about trying Sponges too).

2013-03-22

Install BigBlueButton in a VM on Ubuntu 1204

BigBlueButton is an amazing piece of free software, designed for virtual classrooms but can also be used for webinars, conferences, technical support and other uses. It gathers in the same place a video-conference system, with a shared PDF on which the presenter can doodle, an SIP bridge that make people can join using a phone, and a deskshare java applet for showing others pieces of your screen. Pretty neat. It’s around since 2007 and I had occasion to play with it with the Tikiwiki community.

And now I need to install one at Codegreen for our customer support and maybe some other uses. Great. I go for the last version 0.80 and it only works on ubuntu 10.04 (there are 25 different free software projects embedded in the beast, quite hard to maintain all on many versions, so they stick to the old one for now it seems).

So I get a new server just for that, and I try the install of the old 10.04 image. But it fails miserably for some new SATA drivers reasons, despite the more recent 12.04 works fine, the 10.04 just can’t see the hard drive. Bummer. After some fight then I need to use the alternative install method, using the VM image that BBB provides for VMWare.

Install the BBB VM

I don’t really like VMWare but I go get the free player and install it. The VMWare server that I wanted is discontinued they now only offer the VMWare player which requires a GUI install. Very lame, but ok. I get the VMWare Player image from their site and I install it without problem (the .bundle that I download needs to be executed after a chmod +x). Then I get the BBB VM 0.80 and launch it in the VMWare Player and tadaaa, it just works out of the box, magic.

Note that I installed it under my own account, no need for root with that thing.

Setup the startup launch

Because the Player is a GUI application, I looked around and found the way to launch it from commandline using the VIX (that is downloadable on the same page as the player and installable the same way). Then I can use vmrun to control the player, feels much better. I add in the /etc/rc.local of the host:

sudo -u mose /usr/bin/vmrun -T player start /home/mose/vmware/bigbluebutton-vm/bigbluebutton-vm.vmx nogui

Handling the routing

Here is the tricky part. The Player has 3 ways to handle th routing of the VM (which is very poor compared to the options provided by VirtualBox). and the bridge method was not working for me, because I have a static IP for the server on one card, a dhcp address on internal network on a second card, and the bridge option in VMWare don’t let you specify which interface is going to be bridged.

BBB says that you should use bridge, so the VM has its own IP and is like a first class member of your network, but it seemed that the NAT option was possible as far as you redirect some ports. So I’m going that way.

So I setup the NAT option for the VM, in the VM I fix the ip to 192.168.96.6 (that on the host I aliased to vm-bbb in /etc/hosts), and I add the subdomain I plan to use in the /etc/hosts of the VM (that way the VM bypass the DNS search and assumes that his own natted IP is matching the subdomain reachable from outside). Note that this etc-hosts trick will spit some errors at next step that needs to be run on the VM:

bbb-conf --setip bbb.mydomain.com

Then I need to redirect some ports, like the 22 for ssh access, the 80 for access to the main application, and some others that I have no clue what they are useful for (but I got it from some blog posts). So I install rinetd and add to /etc/rinetd.conf:

0.0.0.0 2222 vm-bbb 22
0.0.0.0 80   vm-bbb 80
0.0.0.0 1935 vm-bbb 1935
0.0.0.0 9123 vm-bbb 9123

and all is good. It seems to work fine, and I probably will have to test it more, but besides the sysadmin setup, the install of BBB was pretty straightforward. Great job !

2013-02-10

Geeky podcasts

Sometimes when doing some mechanical operation on my home workstation, involving repetitive action or something requiring low level of attention (like sorting mails, lurking on irc, updating a distro, …), I like to put the headset and listen to stuff. But I never had any taste for music, I prefer listening to people that talk about some interesting topic.

I began this when starting working with rails, because that was a great flow of information, that had various sources:

All was good and then I checked out podcast clients for my environment (linux with ubuntu) and I found out http://gpodder.net which is exactly the kind of software I like. I does not much but what it does is well done. The website is a nice optional addition, only focused on podcasts and has a nice simple design and is free.

apt-get install gpodder

Then I discovered a few other podcasts for hackers, or oriented towards science and knowledge. And I removed the rss feed I had in my thunderbird for listening to some French-speaking radio shows (like la-bas si j’y suis).

The website makes possible to publish your subscription list, here is my list of very geeky selection:

2012-12-10

RubyConf 2012

Ruby Conf Taiwan 2012. Quite a great event.

http://rubyconf.tw/2012/

2012-10-28

Sublimetext2, plugins, sshfs

For 15 years I have been using vim and I don’t like IDEs. Of course I had to use eclipse and netbeans sometimes when coding in java. Java probably can’t be really well handled without a full-blown IDE anyways.But I didn’t like it, you get distance from your code, stuff happens behind the scene and I like to keep visibility on everything that happens.

But since I went into rails, I tried what was out there and there is a popular editor for the few rails coder that use Linux and not mac, called sublimetext2. And I have to say it just works fine for me (even if I will always keep my Vim not far). And I don’t feel any loss in control !

Here are a few tuning that I made or got from friends that I want to keep in memory, so I figured I should post about it.

Enable plugins manager

It’s not on by default and can be enable by copy-pasting this line into the console (view / console in the menu)

import urllib2,os; pf='Package Control.sublime-package'; ipp=sublime.installed_packages_path(); os.makedirs(ipp) if not  os.path.exists(ipp) else None;  urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler())); open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()); print   'Please restart Sublime Text to finish installation'

Then just relaunch sublimetext and you can access the plugin manager using shift-ctrl-P and type ‘install’.

There is a damn long list of plugins you can add there (a list is on http://wbond.net/sublime_packages/community) and a few of them were advised to me that I should use: brackethighliter, docblockr, sublimecodeintel, sublimelinter, vintageex, git

sublimecodeintel seems to be the one that really does a lot of magic in there. The rest is for convenience and display of blocks in a more visual way,

Use sshfs for remote editing

Well this is not related to sublimetext but makes it easy to remote edit a dir when you have an ssh access. On Ubuntu you can just

apt-get install sshfs

and then

mkdir workdir && sshfs you@server:/path/to/dir workdir

so the remote dir pretends to be local now and can be opened by sublimetext easily. It’s of course adding some response time as the editor refreshes the file you browse each time you focus on it, but it works pretty fine for me.

Special thanks to beve that provided me those nice tricks.