Skip to content

Instantly share code, notes, and snippets.

@mpapec
mpapec / tcpdump.log
Created June 17, 2014 07:16
tcpdump -vv -x -X -s 1500 -i eth0 'port 23'
10:11:17.778693 IP (tos 0x0, ttl 64, id 63881, offset 0, flags [DF], proto TCP (6), length 60)
10.1.6.118.45371 > 10.1.6.127.telnet: Flags [S], cksum 0x2125 (incorrect -> 0x9178), seq 2950613336, win 14600, options [mss 1460,sackOK,TS val 20066513 ecr 0,nop,wscale 3], length 0
0x0000: 4500 003c f989 4000 4006 203c 0a01 0676 E..<..@.@..<...v
0x0010: 0a01 067f b13b 0017 afde c958 0000 0000 .....;.....X....
0x0020: a002 3908 2125 0000 0204 05b4 0402 080a ..9.!%..........
0x0030: 0132 30d1 0000 0000 0103 0303 .20.........
10:11:17.779132 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 60)
10.1.6.127.telnet > 10.1.6.118.45371: Flags [S.], cksum 0x5a67 (correct), seq 3752203257, ack 2950613337, win 5792, options [mss 1460,sackOK,TS val 41444178 ecr 20066513,nop,wscale 1], length 0
0x0000: 4500 003c 0000 4000 4006 19c6 0a01 067f E..<..@.@.......
0x0010: 0a01 0676 0017 b13b dfa6 13f9 afde c959 ...v...;.......Y
perl -F, -lane'
BEGIN {
$x = pop;
## Create array of arrays from start and end ranges
## $range = ( [0,0] , [1,10] ... )
(undef, @range)= map { chomp; [split /,/] } <>;
@ARGV = $x;
}
## Skip the first line
next if $. ==1;
my $edit = sub {
my ($line, $eof) = @_;
if ($. %2){ chomp($line) } else { $line =~ s/^/ = / }
print $line;
};
use strict;
use warnings;
use Benchmark qw(cmpthese);
my $String = "ATGC" x 1000;
my @Genes = qw(A T G C);
my %Count;
my %dispatch = map { $_ => eval "sub { \$_[0] =~ tr/$_// }" } @Genes;
@mpapec
mpapec / .nanorc
Last active August 29, 2015 14:13
## This is a system-wide configuration file for the nano editor.
##
## Each user can save his own configuration to ~/.nanorc
##
## See the nanorc(5) man page for details.
## Sample initialization file for GNU nano.
##
## Please note that you must have configured nano with --enable-nanorc
## for this file to be read! Also note that this file should not be in
use 5.20.0;
use Mojo::UserAgent;
use Mojo::IOLoop;
sub ws_connect {
state $ua;
my $go = sub {
say "Connecting..";
use 5.20.0;
use strict;
use warnings;
use Benchmark qw(:all);
my $i;
my $fa;
my %hash1;
my %hash2;
my %hash3;
use 5.20.0;
use Mojolicious::Lite;
use Mojo::JSON qw(decode_json encode_json);
use Mojo::Redis2;
plugin 'DefaultHelpers';
app->config( hypnotoad => {
workers => 5,
# same as morbo
# docker build -t mpapec/convos .
FROM alpine:3.4
MAINTAINER Convos@Mojo
RUN apk update && \
apk add perl perl-io-socket-ssl perl-dev g++ make openssl openssl-dev wget curl && \
curl -L https://goo.gl/kDpvKZ | tar xvz && \
ln -s /convos-stable /convos && \
cd /convos && \
perl script/convos install && \
@mpapec
mpapec / test.pl
Last active September 8, 2016 14:57 — forked from jberger/test.pl
use Mojolicious::Lite;
helper iodelay => sub {
my $cb = pop;
my ($c, @steps) = @_;
push @steps, sub {
# log err if $_[1]
shift;
$c->$cb(@_);