Skip to content

Instantly share code, notes, and snippets.

@mlampret
mlampret / git_prompt.pl
Last active April 11, 2022 09:55
Perl prompt for git directories
#!/usr/bin/env perl
# Copied and simplified from https://github.com/scottchiefbaker/perl-git-prompt/blob/master/git-prompt.pl
use strict;
use warnings;
use Cwd;
my $COLOR_PROMPT = color(7);
my $COLOR_DIRTY = color(1);
// golang jwt jwe
func jwt2jwe(jwtStr string) string {
rec := jose.Recipient{
Algorithm: jose.PBES2_HS256_A128KW,
Key: "mypassphrase",
PBES2Count: 4096,
PBES2Salt: []byte("salt"),
}
enc, _ := jose.NewEncrypter(jose.A128CBC_HS256, rec, nil)
use strict;
use warnings;
use Data::Dumper;
use Term::ANSIColor;
{
# args
my $action = '';
my @args = map { $_ =~ s!::!/!g; $_ } @ARGV;
#!/usr/bin/env perl
use strict;
use Getopt::Std;
sub main {
my $rh_args={};
getopts('o:i:',$rh_args);
@mlampret
mlampret / Mojolicious::Plugin::VersionDir
Last active August 29, 2015 14:13
Mojolicious Plugin for virtual version directory.
package Mojolicious::Plugin::VersionDir;
use Mojo::Base 'Mojolicious::Plugin';
use strict;
use warnings;
my $c = undef;
my $app = undef;
my $conf = undef;
#!/bin/sh
# set the configuration variables below, before running the script
# get the solr nightly build download link from https://builds.apache.org/job/Solr-Artifacts-4.x/lastSuccessfulBuild/artifact/solr/package/
JETTY_URL="http://eclipse.org/downloads/download.php?file=/jetty/stable-9/dist/jetty-distribution-9.0.5.v20130815.tar.gz&r=1"
JETTY_HOME="/opt/jetty"
JAVA='/usr/local/jdk1.7.0_09/bin/java'
JETTY_PORT=8085
JETTY_HOST=127.0.0.1
@mlampret
mlampret / gist:5747755
Last active December 18, 2015 07:38
Mojolicious::Plugin::GoogleCalc - currency converter with cache
package Mojolicious::Plugin::GoogleCalc;
use Mojo::Base 'Mojolicious::Plugin';
use Mojo::ByteStream;
use Mojo::Loader;
use Mojo::JSON 'j';
use Mojo::ByteStream 'b';
use Mojo::UserAgent;