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
# create user with a disabled password | |
adduser myusername --disabled-password | |
# optionally login as them and create authorized_keys | |
# su - myusername | |
# mkdir --mode=0700 .ssh | |
# echo 'key' > .ssh/authorized_keys | |
# chmod 0600 .ssh/authorized_keys | |
# ^d |
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
#!/usr/bin/env perl | |
use Mojo::Base -strict; | |
use Getopt::Long qw(:config gnu_getopt no_auto_abbrev no_ignore_case); | |
use Mojo::Date; | |
use Mojo::URL; | |
use Mojo::UserAgent; | |
use Mojo::Util 'tablify'; |
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 MyApp::Controller::Auth; | |
use Mojo::Base 'Mojolicious::Controller'; | |
sub check { | |
my $self = shift; | |
my $role = $self->stash('role'); | |
my $user = $self->current_user; | |
# User needs to log in or a different role |
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(w) { | |
/* | |
* Allow multiple clients share the same connection, but send/receive data on a topic they want | |
* | |
* var ws = WebSocketChannel("wss://example.com/mux", "testTopic"); | |
* var ws = WebSocketChannel("wss://example.com/mux", {topic: "..", protocols: ...}); | |
* var ws = WebSocketChannel({url: "wss://example.com/mux", topic: "..", protocols: ...}); | |
* ws.onopen = function(e) { this.send({some: data}) }; | |
*/ | |
w.WebSocketChannel = function(url, params) { |
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 Ovids::Debugger; | |
# vim: syntax=perl | |
=head1 NAME | |
.perldb - Customize your Perl debugger | |
=head1 USAGE |
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
{ | |
"_source" : "module", | |
"aggregations" : { | |
"count" : { | |
"terms" : { | |
"field" : "distribution", | |
"size" : 999 | |
} | |
} | |
}, |
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 ok($;$) {$_[0] || $T::FAIL++; print( ($_[0] ? "ok " : "not ok ") . ++$T::NUM . ($_[1] ? " - $_[1]\n" : "\n"))} | |
sub done_testing { print "1..$T::NUM\n" } | |
END { $? ||= $T::FAIL; $? = 255 if $? > 255 } |
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
use strict; | |
use warnings; | |
use 5.010; | |
use Convert::Binary::C; | |
my $c = Convert::Binary::C->new; | |
$c->Include(qw( | |
/usr/include | |
/usr/include/x86_64-linux-gnu/ | |
/usr/include/linux |
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 Mojolicious::Plugin::Coro; | |
use Mojo::Base 'Mojolicious::Plugin'; | |
use Coro; | |
use Mojo::IOLoop; | |
# Wrap application in coroutine and reschedule main coroutine in event loop | |
sub register { | |
my ($self, $app) = @_; | |
my $subscribers = $app->plugins->subscribers('around_dispatch'); |
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
#!/usr/bin/env perl | |
use Mojolicious::Lite; | |
use Coro; | |
use Mojo::IOLoop; | |
# Magical class for calling a method non-blocking (with a closure) and | |
# rescheduling the current coroutine until it is done | |
package with::coro { | |
use Coro; |
NewerOlder