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 Mojo::Base -strict; | |
use Mojo::IOLoop; | |
use Mojolicious::Lite; | |
use Test::More; | |
use Test::Mojo; | |
get '/' => sub { | |
my $c = shift->render_later; | |
$c->inactivity_timeout(40); |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <sys/types.h> | |
#include <sys/socket.h> | |
#include <netdb.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
#include <sys/epoll.h> | |
#include <errno.h> |
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/bin/perl | |
use Mojo::Base -strict; | |
use Socket qw/:DEFAULT SOCK_NONBLOCK/; | |
use Data::Dumper; | |
use EV; | |
my $host="localhost"; | |
my $port="3000"; | |
socket(my $sock, PF_INET, SOCK_STREAM | SOCK_NONBLOCK, getprotobyname('tcp')); |
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/bin/perl | |
use Mojo::Base -strict; | |
use Socket qw/:DEFAULT SOCK_NONBLOCK getaddrinfo unpack_sockaddr_in inet_pton getnameinfo inet_ntop/; | |
use EV; | |
use Data::Dumper; | |
my $host = 'localhost'; | |
my $port = '3000'; | |
my ($tcp_name, $tcp_alias, $tcp_proto) = getprotobyname('tcp'); |
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/bin/perl | |
use Mojo::Base -strict; | |
use Socket qw/:DEFAULT SOCK_NONBLOCK getaddrinfo/; | |
use EV; | |
my $host = 'localhost'; | |
my $port = '27017'; | |
my ($tcp_name, $tcp_alias, $tcp_proto) = getprotobyname('tcp'); | |
my ($err, @hosts) = getaddrinfo($host, $port, {protocol => $tcp_proto}); |
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 | |
package Mojo::IOLoop::Net::DNS; | |
use Mojo::Base -base; | |
use Net::DNS; | |
use Mojo::IOLoop; | |
use Scalar::Util 'weaken'; | |
sub query { |
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 | |
use strict; | |
use warnings; | |
use v5.10; | |
use Mojolicious::Lite; | |
use Mojo::IOLoop; | |
use Mojo::IOLoop::ReadWriteFork; |
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 | |
use Mojo::Base -strict; | |
use Mojolicious::Lite; | |
use Mojo::IOLoop; | |
use Mojo::IOLoop::ReadWriteFork; | |
plugin 'Mojolicious::Plugin::ForkCall'; |
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 | |
# To run need listen two ports: 80, 443 | |
# sudo morbo 12.pl -l https://*:443?cert%3D%2Fhome%2Flogioniz%2Fcert%2Fserver.crt%26key%3D%2Fhome%2Flogioniz%2Fcert%2Fserver.key%26verify%3D0x00 -l http://*:80 | |
# go to url in browser http://your_ip/qwe/asd | |
use Mojo::Base -strict; | |
use Mojolicious::Lite; |
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 | |
use Mojo::Base -strict; | |
use Mojo::IOLoop; | |
use Mojo::UserAgent; | |
my %connections; | |
Mojo::IOLoop->server({port => 3128} => sub { | |
my ($loop, $stream_client, $client_id) = @_; |