Skip to content

Instantly share code, notes, and snippets.

View cynovg's full-sized avatar

Novgorodcev Cyrill cynovg

  • VKontakte
  • Russia, St. Petersburg
View GitHub Profile
@briandfoy
briandfoy / mojo_outline.txt
Last active May 19, 2020 02:25
Mojolicious Web Applications book outline
I'm not committing to the book just yet, but I'm thinking about what the outline would be.
I'm thinking about running another Kickstarter if I can find a major sponsor like I did
last time. Email me if you might be that person.
The basic idea is a tutorial book on writing that would start from scratch and build up.
This is specifically not a reference book that covers every aspect of Mojolicious. The
trick is to figure out all the topics that should be in the book and how to introduce them
gradually. Most topics should be relevant to most of the audience, while uncommon tasks
or lightly used features might not show up at all.
@dallaylaen
dallaylaen / todo.t
Last active August 25, 2017 09:01
Make Perl module developer feel bad about untested code
#!/usr/bin/env perl
# This script tests nothing (except the fact that modules load w/o warnings).
# However, it tries to load them all.
# This means that untested modules would also be included into
# code coverage summary, lowering total coverage to its actual value.
# I.e. having a well-covered module and a totally uncovered one will result
# in 50% coverage which is probably closer to truth.
#!perl
my $lol = bless { string => "test_string" };
$lol->{cycle}{reference}[0] = $lol;
my $lol1 = bless [];
$lol1->[0]{yet}{another}{cycle}{reference} = $lol1;
use strict;
require Devel::Gladiator;
@nisei
nisei / Base.pm
Last active October 3, 2017 07:18
CLI for Mojolicious
package Test::Web::CLI::Base;
use Mojo::Base qw/Mojolicious::Command/;
# public processing for CLI
sub get_data {
my $self = shift;
return 'data';
}
1;
@mariozig
mariozig / migrate_repo.sh
Last active September 16, 2024 18:48
Migrate repo from GitLab to GitHub Full blog post @ http://ruby.zigzo.com/2015/03/23/moving-from-gitlab-to-github/
# Assume we are in your home directory
cd ~/
# Clone the repo from GitLab using the `--mirror` option
$ git clone --mirror [email protected]: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.
@paskal
paskal / site.conf
Last active September 24, 2024 13:20 — forked from plentz/nginx.conf
Nginx configuration for best security and modest performance. Full info on https://terrty.net/2014/ssl-tls-in-nginx/
# read more at https://terrty.net/2014/ssl-tls-in-nginx/
# latest version on https://gist.github.com/paskal/628882bee1948ef126dd/126e4d1daeb5244aacbbd847c5247c2e293f6adf
# security test score: https://www.ssllabs.com/ssltest/analyze.html?d=terrty.net
# your nginx version might not have all directives included, test this configuration before using in production against your nginx:
# $ nginx -c /etc/nginx/nginx.conf -t
server {
# public key, contains your public key and class 1 certificate, to create:
# (example for startssl)
# $ (cat example.com.pem & wget -O - https://www.startssl.com/certs/class1/sha2/pem/sub.class1.server.sha2.ca.pem) | tee -a /etc/nginx/ssl/domain.pem > /dev/null
@revmischa
revmischa / install-plenv.sh
Last active July 12, 2022 02:25
Set up plenv, install perl, cpanm, carton, set up environment
#!/bin/bash
# installs plenv, perl, carton, cpanminus, sets up environment in .bash_profile
# from https://github.com/tokuhirom/plenv#readme
PLENV_PERL_VERSION='5.18.1'
if [[ -n "$PERL_MB_OPT" ]]; then
echo "You must unset your local::lib environment variables first"
@creaktive
creaktive / mojo-crawler.pl
Last active November 28, 2020 13:15
Simple web crawler/scraper implemented using Mojolicious
#!/usr/bin/env perl
use 5.010;
use open qw(:locale);
use strict;
use utf8;
use warnings qw(all);
use Mojo::UserAgent;
# FIFO queue
@cyx
cyx / gist:3690597
Created September 10, 2012 12:13 — forked from inkel/gist:3690584
Monit Redis
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
@alexwybraniec
alexwybraniec / gist:2972487
Created June 22, 2012 12:32
Enabling Memcached graphing in Munin, Ubuntu 10.04 LTS, with munin-node already installed
sudo apt-get update
sudo apt-get install munin-plugins-extra
cd /etc/munin/plugins
sudo ln -snf /usr/share/munin/plugins/memcached_ memcached_bytes
sudo ln -snf /usr/share/munin/plugins/memcached_ memcached_counters
sudo ln -snf /usr/share/munin/plugins/memcached_ memcached_rates
sudo aptitude install libcache-memcached-perl
sudo /etc/init.d/munin-node restart
sudo tail -f /var/log/munin/munin-node.log