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
| package test; | |
| use threads; | |
| use threads::shared; | |
| use Storable; | |
| sub process_threaded { | |
| my ( $self, $array_ref ) = @_; | |
| my $result_ref = []; |
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/env perl | |
| use strict; | |
| use warnings; | |
| use utf8; | |
| my $тест = 'test'; | |
| print "$тест\n"; |
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
| check process redis-server | |
| with pidfile "/var/run/redis.pid" | |
| start program = "/etc/init.d/redis-server start" | |
| stop program = "/etc/init.d/redis-server stop" | |
| if 2 restarts within 3 cycles then timeout | |
| if totalmem > 100 Mb then alert | |
| if children > 255 for 5 cycles then stop | |
| if cpu usage > 95% for 3 cycles then restart | |
| if failed host 127.0.0.1 port 6379 then restart | |
| if 5 restarts within 5 cycles then timeout |
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/env python | |
| # -*- coding: utf-8 -*- | |
| """nginx_error_rate -- Munin plugin to report the error rate in an access log. | |
| The access log defaults to `/var/log/nginx/access.log`. This may be | |
| customized with the following stanza in your munin plugin conf: | |
| [nginx_error_rate] | |
| env.access_log /path/to/access.log | |
| """ |
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
| # Setup an appropriate nginx log_format in the `http` section of your nginx config: | |
| log_format main '$remote_addr $time_iso8601 "$request" ' | |
| '$status $body_bytes_sent "$http_referer" ' | |
| '"$http_host" ' | |
| '"$http_user_agent" "$http_x_forwarded_for" ' | |
| '$request_time '; | |
| # Then save the following as a munin plugin to monitor the last 5 minutes of your nginx access.log file |
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 strict; | |
| use warnings; | |
| my $file = $ARGV[0] || die "USAGE: $0 filename"; | |
| my $processes = $ARGV[1] || 1; | |
| my $block_size = 64 * 1024 * 1024; | |
| my $fsize = -s $file or die 'no file'; | |
| my @offsets; | |
| my @sizes; |
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/env perl | |
| use strict; | |
| use warnings; | |
| use utf8; | |
| use v5.26.0; | |
| use List::Util qw/first any/; | |
| use Benchmark qw(:all); |
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 warnings; | |
| use v5.16; | |
| use Benchmark qw(:all); | |
| timethese( | |
| 10000000, | |
| { | |
| cycle => sub { |
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
| # Assume we are in your home directory | |
| cd ~/ | |
| # Clone the repo from GitLab using the `--mirror` option | |
| $ git clone --mirror git@your-gitlab-site.com:mario/my-repo.git | |
| # Change into newly created repo directory | |
| $ cd ~/my-repo.git | |
| # Push to GitHub using the `--mirror` option. The `--no-verify` option skips any hooks. |
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
| ### Keybase proof | |
| I hereby claim: | |
| * I am cynovg on github. | |
| * I am cynovg (https://keybase.io/cynovg) on keybase. | |
| * I have a public key ASCjFPioIzcKrs21O-xh5h2wMtu9QQzp9pOv3Sv3pEmvvQo | |
| To claim this, I am signing this object: |