Skip to content

Instantly share code, notes, and snippets.

@Mons
Mons / change-uuid
Last active February 10, 2020 17:59
UUID Changer for Tarantool storage files
#!/usr/bin/env perl
use 5.010;
use strict;
use File::Find;
use Getopt::Long;
sub usage {
return <<EOF
===============================================================
use 5.016;
use Encode::Base58::GMP;
use Data::UUID;
# '11115QchsAWLTKggVhJEd'
# '00000000-ffff-ffff-0000-000000000000'
# 55b1a44d-e22b-4cf1-9c89-486d20c06adc
# 4da4b155 2be2 f14c 9c89 486d20c06adc
sub listener {
push_read(line => sub {
my $line = shift; # GET / HTTP/1.1
# PUT /file HTTP/1.1
my ($method, $path, $http) = $line =~ m{^(\S+)\s+(\S+)};
# Key: value
# Conetent-Length: 10
#
# body...
#!/usr/bin/env perl
use 5.016;
use integer;
my $n = <>;
local $/ = " ";
$, = " ";
my @bottom;
while (<>) {

Keybase proof

I hereby claim:

  • I am mons on github.
  • I am mons (https://keybase.io/mons) on keybase.
  • I have a public key ASC3bELAJoi7ctVU4P64sjft5udPls8hIk5rVfrxSEUHyQo

To claim this, I am signing this object:

local ffi = require 'ffi'
ffi.cdef[[
typedef int mode_t;
char *strerror(int errnum);
int open(const char *pathname, int flags);
int open(const char *pathname, int flags, mode_t mode);
ssize_t write(int fd, const char *buf, size_t count);
]]
@Mons
Mons / anyevent-scribe-server.pl
Created July 21, 2017 14:45
Simple debugging scribe server in perl
#!/usr/bin/env perl
use 5.010;
use strict;
use DDP;
use Data::Dumper;
# use Thrift;
# use Scribe::Thrift::scribe;
use Thrift::XS::MemoryBuffer;
use Thrift::XS::BinaryProtocol;
@Mons
Mons / nginx-proxy-100-continue.patch
Created July 19, 2017 21:34
Disable local 100 continue response, proxy it from upstream
diff -r -u nginx-1.10.3.orig/src/http/ngx_http_core_module.c nginx-1.10.3/src/http/ngx_http_core_module.c
--- nginx-1.10.3.orig/src/http/ngx_http_core_module.c 2017-01-31 18:01:11.000000000 +0300
+++ nginx-1.10.3/src/http/ngx_http_core_module.c 2017-02-13 15:37:11.505036520 +0300
@@ -626,6 +626,13 @@
offsetof(ngx_http_core_loc_conf_t, etag),
NULL },
+ { ngx_string("proxy_100_continue"),
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
+ ngx_conf_set_flag_slot,
sub run {
my $url = shift;
my $cb = shift;
my @queue;
push @queue, $start_url;
my %seen;
my $cv = AE::cv; $cv->begin;
package Local::Metric;
use 5.010;
use strict;
use warnings;
# 1 2 3 4 5 6 7 8 9 10 11
our @fields = qw{foo bar foobar baz quux bat xyzzy plugh qwe asd zxc};
sub new {
return { map { $_ => "".rand(100) } @fields };