Batman’s utility belt
A presentation I gave at
Nordic Perl Workshop and Mojoconf
class: center, middle, inverse # Batman's utility belt Jan Henning Thorsen [email@example.com](mailto:firstname.lastname@example.org) --- class: center, middle # What's in my utility belt? .left[ * App::tt * Time tracker * App::git::ship * Ship your module with minimal effort * App::podify * Avoid documentation boilerplate * App::prowess * Hot reload `prove` * App::githook::perltidy * Stop arguing about code formatting * sshuttle * Send traffic through a remote server * App::remarkpl * This presentation ] ??? There's actually not that many applications I run frequently. Top five applications I use is git, ack, vim, less and tt. I guess you know about the four first, so I'm not going to spend time on those. --- class: center, middle # App::tt .left[ ``` $ tt start -p demo Started working on project "demo" at 10:09:33. $ tt Been working on "demo", for 8h 10m 15s $ tt stop Stopped working on "demo" after 8h 11m 38s $ tt log -p demo Aug 30 10:00 8:11 demo presentation Total for 1 events since Aug 2018: 8h 11m 38s $ tt -h ... $ tt start -h ... ``` ] Based on the idea from [App::TimeTracker](https://metacpan.org/release/App-TimeTracker). ??? "tt" is an app that is supposed to help you register hours with ease. I first got interested in command line time tracking when I heard about App::TimeTracker, but it was based on Moose, which made the startup time insanely slow, and I also wanted a different command line API then what was provided, so I created "tt". Even though it is a completely different application, the storage format is the same so you can use the other integrations provided by App::TimeTracker if you like. The demo shown here shows the most important commands I use: 1. Start tracking time for a given project 2. Show how long I have been working 3. Stop tracking time 4. Log how much time I have spent on a project 5. The two last commands will give you help about how to use the application --- class: center, middle # App::git::ship .left[ ``` $ $EDITOR ~/.pause $ git ship start Some/Module.pm $ cd my-module $ $EDITOR lib/Some/Module.pm $ $EDITOR Changes $ prove -lj4 $ git ship build $ git ship ``` ] ??? "git-ship" is a tool for creating boilerplate files for your Perl project and ship the code to CPAN. 1. To enable it to ship to CPAN, you need to create a ".pause" file with your username and password. 2. To start a new project, you run "git ship start" with the name of the main module file. 3. Step three is to add some code to your module and add a list of Changes to your changes file. 4. A test for checking documentation coverage, changes file format and that your code can compile is added for you, so it is highly suggested that you run that test before shipping. 5. After the test pass, you can build and ship your code to CPAN The nice thing is that git-ship does not enforce you to use this tool. This means that people creating pull requests or want to contribute in any way, does not need to learn your way of shipping. Also, all the steps are printed to screen, so there's no hidden magic behind the scenes. Last: If you don't want to ship your code to CPAN, you can extend git-ship to push the code to your local CPAN repository or run other steps to get the code running on an internal server. You can also make it work with other projects than Perl-projects if you just want to type "git ship" to ship your code. --- class: center, middle # App::podify .left[ ``` $ podify -i lib/Some/Module.pm ``` ] ??? Tired of writing boilerplate POD? "podify" comes to the rescue. It will look for attributes and methods in you module and add all the boilerplate POD for you. Just run "podify -i" on the file and it will be converted on the fly. Think that is scary? Run without the "-i" switch and it will print the result to the screen. --- class: center, middle # App::prowess .left[ ``` $ prowess -w ./lib t/00-basic.t ``` ] ??? Sometimes I'm stuck on a problem, and I need to fiddle around with the code to make the unit test pass. Instead of changing to a terminal to run "prove", I start "prowess" on the same file. It will watch the unit test you run and any directory or file you specify with the "-w" switch and re-run the test if either changes. --- class: center, middle # App::githook::perltidy .left[ ``` $ githook-perltidy install ``` ] ??? I wonder how many hours is spent every year arguing about code formatting... I'm betting that's a lot. Luckily my good friend Marcus Ramberg convinced me to use "perltidy" to make sure our code was in a common format, so we didn't have to argue anymore! To make sure you don't commit code that is not by the common standard, you can install a git hook which will prevent you from committing any code that is not as agreed on. Also, if you don't agree on the common standard in the repository, you could install a perltidy hook in your editor to re-format the code the way you want it when you open it. --- class: center, middle # sshuttle .left[ ``` sshuttle -r jumphost.example.com 10.0.0.0/20 sshuttle -r jumphost.example.com */* sshuttle -r jumphost.example.com */* --dns ``` ] ??? Ever in need to access a server in a internal network from your computer? You can use sshuttle to do exactly that. It will tunnel any traffic from your local computer to the jump host you specify. You can also pass on any DNS request if you want, instead of sending them to your default resolver. --- class: center, middle # App::remarkpl .left[ ``` $ remarkpl ./presentations/20180906-batmans-utility-belt.md --listen "http://*:5000" ``` ] See also [remark.js](https://remarkjs.com/) and [thorsen.pm/presentations](https://thorsen.pm/presentations). ??? I like to write my presentations using remark.js. It uses a markdown format as input, which allows me to focus on the words, instead of fiddling around with positions, colors and font faces. In fact, that is the tool I've used to write this presentation in. Go to the conference schedule or check out my home page for the presentation. --- class: center, middle # The end git-ship, githook-perltidy, podify, prowess, remarkpl, sshuttle, tt. Questions? Email me at [email@example.com](mailto:firstname.lastname@example.org) or come and talk to me! ??? Hope you enjoyed this presentation and if you have any questions or feedback, then don't hesitate to contact me. Thanks for listening! Any Questions?