This file contains hidden or 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
| use String::Truncate qw(elide); | |
| my $_md5sum = ''; | |
| my $_file; | |
| my $c = 0; | |
| # TODO: what Linux command generates the "md5\tpath" file | |
| open MD5, 'md5sum-sort.txt'; | |
| while ( local $_ = <MD5> ) { | |
| chomp; |
This file contains hidden or 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 Backend; | |
| use Mojo::Base -base; | |
| has 'pg'; | |
| has 'db'; | |
| sub bulk_insert { | |
| my ($self, $table, $data, $options) = @_; | |
| $options ||= {}; | |
| my $tx = $self->db->begin; |
This file contains hidden or 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
| #!/usr/bin/perl -w | |
| # This script calls the SOAP method " DeviceAssetInfoExport" on an N-central server. | |
| # The data structure returned is printed to stdout using Data::Dumper. | |
| use strict; | |
| use SOAP::Lite; | |
| use Data::Dumper; | |
| my $NableServer = SOAP::Lite ->uri("http://server.nable.com/") | |
| ->proxy("https://.../dms/services/ServerEI?wsdl"); |
This file contains hidden or 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
| # Setup perlbrew + carton | |
| # https://gist.github.com/s1037989/03b9fcf4e4ee0bfe890b7e529965c315 | |
| # Configure nginx for SSL with LE | |
| # http://blog.mojolicious.org/post/157710119941/configuring-nginx-for-ssl-with-lets-encrypt | |
| # cat /usr/sbin/mojo-acme | |
| # use Mojolicious::Lite; | |
| # app->log->path('/var/log/mojo-acme.log'); | |
| # plugin 'ACME'; | |
| # app->start; | |
| # Start mojo-acme |
This file contains hidden or 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
| #!/bin/bash | |
| PERL_STABLE="5.26.0" | |
| echo '%< --- installing perlbrew ---' | |
| echo | |
| echo 'If this fails, apt install build-essential' | |
| curl -kL http://install.perlbrew.pl | bash | |
| source ~/perl5/perlbrew/etc/bashrc |
This file contains hidden or 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 Model; | |
| use Mojo::Base -base; | |
| use Mojo::UserAgent; | |
| has ua => sub { Mojo::UserAgent->new }; | |
| sub cb { | |
| my ($self, $cb) = @_; | |
| $cb ? sub { $cb->($self, @_) } : (); |
This file contains hidden or 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
| This will allow you to run a php app behind an nginx reverse proxy on another server and serve the non-php static files with Mojolicious |
This file contains hidden or 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
| #!/bin/bash | |
| # | |
| # This script configures WordPress file permissions based on recommendations | |
| # from http://codex.wordpress.org/Hardening_WordPress#File_permissions | |
| # | |
| # Original Author: Michael Conigliaro (https://gist.github.com/macbleser/9136424) | |
| # Modified by: Stefan Adams (https://gist.github.com/s1037989/7d2f0989b5a3cb1ed9e8e4452ded9ca6) | |
| # | |
| WP_ROOT=${1:-.} # <-- wordpress root directory | |
| [ -e "$WP_ROOT/wp-config.php" ] || { echo "Usage: $0 /path/to/wordpress"; exit; } |
This file contains hidden or 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
| #!/usr/bin/env perl | |
| package Mojo::URLQueue; | |
| use Mojo::Base 'Mojo::EventEmitter'; | |
| use Mojo::UserAgent; | |
| has queue => sub { [] }; | |
| has ua => sub { Mojo::UserAgent->new(max_redirects => 5) }; | |
| has concurrency => 4; |
This file contains hidden or 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 ACME; | |
| use Mojo::Base 'Mojolicious'; | |
| use 5.20.0; | |
| use feature qw(signatures); | |
| no warnings qw(experimental::signatures); | |
| sub startup { | |
| my $self = shift; | |
| $self->plugin('ACME'); | |
| $self->secrets(['new_passw0rd', 'old_passw0rd', 'very_old_passw0rd']); |