This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package FixEncodings; | |
use strict; | |
use warnings; | |
require Exporter; | |
our @ISA = qw(Exporter); | |
our @EXPORT_OK = qw(explain attempt_decode); | |
# This should be in terms of longest first |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/opt/xt/xt-perl/bin/perl | |
use strict; | |
use warnings; | |
use File::Spec; | |
use Git::Wrapper; | |
use Cwd 'realpath'; | |
use Term::ANSIColor; | |
use Term::ReadKey; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function epochToAgo ( epoch ) { | |
var rightNowObj = new Date(); | |
var rightNowEpoch = Math.floor(rightNowObj.getTime() / 1000); | |
var diff = rightNowEpoch - epoch; | |
var human; | |
if ( diff < 3600 ) { | |
human = Math.floor( diff / 60 ) + ' minutes ago'; | |
} else if ( diff < 86400 ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub permutation { | |
my ( $count, $columns, $permutations ) = @_; | |
my $total_permutations = @$permutations ** $columns; | |
return if $count >= $total_permutations; | |
my $num = $count; | |
my $base = @$permutations; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub permutation { | |
my ( $desired_permutation, $column_count, $permutation_set ) = @_; | |
my $permutation_set_count = @$permutation_set; | |
# The total number of permutations | |
my $total_permutations = $permutation_set_count ** $column_count; | |
# Return if we're being asked for a permutation outside the total number | |
# possible | |
return if $desired_permutation >= $total_permutations; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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() ) ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Name : Healthy Carbonara | |
Serves: 4 x 371 calorie portions (so two meals for me) | |
Stats: | |
Calories : 371 kcal (calc: 373) | |
% Fat : 28% - 106 kcal - 12g | |
% Protein: 27% - 101 kcal - 25g | |
% Carbs : 45% - 167 kcal - 42g | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
abc => | |
[ '<!--', "I am a comment" ], # This is a magic tag | |
[ '<![CDATA[', "I am some CDATA" ], # This is also a magic tag | |
"\nHere is &, an ampersand, which will be quoted automatically", | |
\"\nHere is &ersand;, an ampersand - string refs are 'raw'", | |
[ 'bar', { 'foo' => "The first hashref is the attributes" }, "some stuff" ], | |
[ 'single_no_attr' ], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -rubw /tmp/Catalyst-Plugin-Authentication-0.10017//lib/Catalyst/Authentication/Credential/Password.pm ./lib/Catalyst/Authentication/Credential/Password.pm | |
--- /tmp/Catalyst-Plugin-Authentication-0.10017//lib/Catalyst/Authentication/Credential/Password.pm 2011-01-24 23:29:57.000000000 +0000 | |
+++ ./lib/Catalyst/Authentication/Credential/Password.pm 2011-06-27 09:01:01.000000000 +0100 | |
@@ -25,7 +25,7 @@ | |
$self->_config->{'password_hash_type'} ||= 'SHA-1'; | |
my $passwordtype = $self->_config->{'password_type'}; | |
- if (!grep /$passwordtype/, ('none', 'clear', 'hashed', 'salted_hash', 'crypted', 'self_check')) { | |
+ if (!grep /$passwordtype/, ('none', 'clear', 'hashed', 'salted_hash', 'crypted', 'self_check', 'custom')) { | |
Catalyst::Exception->throw(__PACKAGE__ . " used with unsupported password type: " . $self->_config->{'password_type'}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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. | |
// |
OlderNewer