This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
| # Given a string, print out the codepoints that it currently compromises of. If | |
| # you pass it a bytestring, you will get the bytes. If you pass it a character | |
| # string, you will get the characters. This can be helpful when you're not sure | |
| # if your terminal is playing around with the output. | |
| sub explain { | |
| # We will build up the output in $explain | |
| my $explain; | |
| # Split the first argument in to characters | |
| for my $char ( split(//, shift() ) ) { |
| // How to upgrade your users passwords in the DB without their intervention | |
| // | |
| // SHA-1 isn't strong enough to hash passwords with, but lots of people have a | |
| // whole bunch of SHA-1'd passwords because they thought it was. You could use | |
| // bcrypt or scrypt, but maybe in two years' time someone will tell you that's | |
| // also not strong enough, and you'll want to upgrade. | |
| // | |
| // This sample demonstrates how you can remove weak password hashes from your | |
| // user database, without needing the user to enter their password. | |
| // |
| use strict; use warnings; | |
| use List::Util qw(reduce); | |
| use File::Slurp qw(read_file); | |
| # Given a list of filenames, return a hash of each word and the number of times | |
| # it occurs. | |
| sub word_count { | |
| reduce { $a->{$b}++; $a } {}, |
| #!perl | |
| # Display a bubble chart of DB tables, with rows and relationships to other tables | |
| # Either run directly: perl bubble.pl | |
| # Or with Plack: plackup bubble.pl | |
| use strict; use warnings; | |
| # cpanm Dancer Template DBIx::Class::Schema::Loader Data::Google::Visualization::DataTable | |
| use Dancer; |
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer