Sandeep Chayapathi <something or the other>

A Wordpress shell

At The Mighty my work involves dealing with wordpress extensively. Having a php shell with access to the full wordpress libraries was something I was looking for. I tried couple of php cli hacks before I stumbled on WP CLI. Now getting a php cli with wordpress is as simple as

$ wp shell

As a side note – I created a simple docker container to run wordpress with few extras, here.

A REPL for your Mojolicious app

Read-Eval-Print loop (repl) is a lifesaver, you can quickly hack a script with one. However a repl with full access to your application is vastly more powerful.

Mojolicious is a next generation web framework for the perl programming language. There are many things to love about Mojolicious , ease of use is one of them.

Perl always came with a simple repl but Devel::REPL took it to the next level. Devel::REPL allows you to tailor the environemt and the following code snippet shows you how to add a interactive shell to your Mojolicious app quickly and simply.

Note: You will have to install Devel::REPL and Term::ReadLine packages from cpan

I used the Ado project as the base to show off how you can a interactive shell to a mojo app.

package Ado::Command::repl;
use Devel::REPL;
use Mojo::Base 'Mojolicious::Command';
use feature qw(say);

has description => 'REPL for your Mojo app';
has usage       => "Usage: APPLICATION repl\n";


sub run {
    my ($self) = @_;


    my $repl = Devel::REPL->new;
    $repl->load_plugin($_) for qw(History LexEnv Colors DDS Completion);

    my $app = $self->app;

    $repl->lexical_environment->set_context('_' => {'$app' => $app});

    $repl->run;
}

1;

This adds a new command to your mojolicious app. When you invoke the repl you are dropped into a interactive shell with full access to your mojolicious app.

Here’s a screen recording of few simple commands I ran in the repl

Chromebook as a developer machine

(rebuilding lost blog posts the hard way)

You can use crouton to install a chroot jail and then you are free to apt-get install any library that’s compiles to armv7.

I have a Samsung Chromebook and I have installed the GAE python sdk , emacs and clozure common lisp for development.

Its super easy to set this up:

  • Enter developer mode, for Samsung Chromebook follow this procedure.
  • Download Crouton
  • Ctrl-Alt-T to open terminal , type shell to open a bash shell and run:

    $ sudo sh -e ~/Downloads/crouton

  • after crouton finishes, to enter your new chroot $ /usr/local/bin/enter-chroot