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
any '/fast-ping' => sub { | |
my $self = shift; | |
my $request = $self->req->json || return $self->render_json( { 'status' => 'Request error' } ); | |
my $remote_addr = $self->tx->remote_address; | |
app->log->info("$remote_addr requested ".Dumper($request)); | |
my $prefix = $request->{'prefix'}; | |
return $self->render_json( { 'status' => 'Have no network prefix in request, nothing to do!' } ) unless $prefix; |
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/perl | |
use strict; | |
use warnings; | |
use POE qw(Wheel::Run Filter::Reference); | |
sub MAX_CONCURRENT_TASKS () { 25 } | |
use Net::Netmask; | |
use Data::Dumper; |
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 Mojo::ByteStream 'b'; | |
use Mojo::JSON; | |
use utf8; | |
... | |
our $dbh = DBI->connect("dbi:mysql:dbname=cli;host=localhost", |
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 Mojo::ByteStream 'b'; | |
... | |
$rows = $dbh->selectall_arrayref(q{ .. }); | |
# Decode bytestream to string for each item in arrays | |
grep { grep { $_ = b($_)->decode('UTF-8') } @$_ } grep { $_ } @$rows ; |
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/perl | |
use DBI; | |
our $dbh = DBI->connect("dbi:mysql:dbname=mydb;host=localhost", | |
'user', 'pass', | |
{ PrintError => 0, RaiseError => 1, mysql_enable_utf8 => 1 }); | |
for (@{ $dbh->selectall_arrayref(q{ | |
SHOW VARIABLES LIKE 'character\_set\_%' }) } ) { |
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 -dur gateway.orig/gw/bb_boxc.c gateway/gw/bb_boxc.c | |
--- gateway.orig/gw/bb_boxc.c 2015-07-15 12:01:59.993723709 +0000 | |
+++ gateway/gw/bb_boxc.c 2015-07-23 11:38:23.449299990 +0000 | |
@@ -111,6 +111,7 @@ | |
static Dict *smsbox_by_smsc; | |
static Dict *smsbox_by_receiver; | |
static Dict *smsbox_by_smsc_receiver; | |
+static Dict *smsbox_by_sender; | |
static long smsbox_port; |
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
#!/bin/bash | |
# | |
# Init file for Pinger server daemon | |
# | |
# chkconfig: 2345 55 25 | |
# description: Pinger server daemon | |
# | |
# processname: pinger | |
# pidfile: /var/run/pinger.pid |
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 strict; | |
use warnings; | |
use FindBin; | |
use lib "$FindBin::Bin/mojo/lib"; | |
use Mojolicious::Lite; |
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
<html> | |
<head> | |
<script src="http://code.jquery.com/jquery-latest.min.js"></script> | |
</head> | |
<body> | |
<SCRIPT> | |
$(function() { | |
$('#clickme').click(function() { | |
$.getJSON('http://domain.tld/test/?foo=bar&callback=?', |
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
$ perl -MSocket -le 'print unpack("N", inet_aton(shift))' 127.0.0.1 | |
2130706433 | |
$ perl -MSocket -le 'print inet_ntoa(pack("N", shift))' 2130706433 | |
127.0.0.1 |