Skip to content

Instantly share code, notes, and snippets.

View polettix's full-sized avatar
🐫

Flavio Poletti polettix

🐫
View GitHub Profile
@polettix
polettix / gist:4811572938ecd4103fe6
Last active August 29, 2015 14:20
Bug in $req->to_string()?
# This is the sample program I'm using. $res->to_string() is called
# only if the URI is something like /<true-value>, and is not
# called when the URI is /
use Mojolicious::Lite;
hook after_dispatch => sub {
my ($c) = @_;
my $res = $c->res();
$res->to_string() if $c->stash('what');
$res->headers->header(Server => 'AnotherServer');
use strict;
use warnings;
use ExtUtils::MakeMaker;
WriteMakefile(
NAME => 'dario',
AUTHOR => q{YOUR NAME <youremail@example.com>},
VERSION_FROM => 'lib/dario.pm',
ABSTRACT => 'YOUR APPLICATION ABSTRACT',
($ExtUtils::MakeMaker::VERSION >= 6.3002
#!/usr/bin/perl
use strict;
use warnings;
use Text::CSV;
my @columns = '';
my $region = '';
my $valore = '';
my @lac1 = '';
my @lac2 = '';
@polettix
polettix / viewbug.t
Created July 25, 2011 22:34
bug in Dancer's view w/ Template::Toolkit
use strict;
use warnings;
use Test::More import => ['!pass'], 'no_plan';
use Dancer ':syntax';
use Dancer::Test;
setting template => 'template_toolkit';
ok(get('/' => sub { template root => {who => 'root'} }), 'root route');
route_exists [GET => $_] for qw( / );
@polettix
polettix / silv-crontab.sh
Created November 21, 2011 11:31
simple crontab shell driver
#!/bin/bash
function die () {
echo "$*" >&2
exit 1
}
basedir=$(dirname "$0")
basedir=$(readlink -f "$basedir")
cd "$basedir" || die "cannot hop into $basedir"
@polettix
polettix / cfp-en.html
Created May 14, 2012 11:49
Call For Papers IPW 2012
<p>To suggest a talk, please use <a class="reference" href="/ipw2012/newtalk">the web interface</a>. All proposals must be
submitted by <strike>June 20th, 2011</strike> <strong>August 1st, 2011</strong>.</p>
<p>This year's theme for the workshop is <strong>Two Perls</strong>,
which wants to put relevance both on Perl 5 and Perl 6.
The topic is, however, just a loose guideline:
any Perl-related topic will be fine. Some interesting topics
could be:</p>
<ul>
#!/usr/bin/env perl
use strict;
use warnings;
use Mojolicious::Lite;
use Data::Dumper;
$Data::Dumper::Indent = 1;
my $uri = 'http://mojolicious.org';
plugin Minion => {SQLite => 'sqlite:test4bug.db'};
@polettix
polettix / README.md
Created September 12, 2016 16:38 — forked from cjrd/README.md
Interactive tool for creating directed graphs using d3.js.

directed-graph-creator

Interactive tool for creating directed graphs, created using d3.js.

Demo: http://bl.ocks.org/cjrd/6863459

Operation:

  • drag/scroll to translate/zoom the graph
@polettix
polettix / ansible-output
Last active May 19, 2017 15:17
ansible output
This file has been truncated, but you can view the full file.
2017-05-19 14:13:27,549 p=781 u=root | Using /kargo/ansible.cfg as config file
2017-05-19 14:13:31,010 p=781 u=root | PLAY [localhost] ************************************************************************************************************************************************
2017-05-19 14:13:31,027 p=781 u=root | TASK [kargo-defaults : Configure defaults] **********************************************************************************************************************
2017-05-19 14:13:31,027 p=781 u=root | Friday 19 May 2017 14:13:31 +0000 (0:00:00.021) 0:00:00.021 ************
2017-05-19 14:13:31,047 p=781 u=root | ok: [localhost] => {
"changed": false,
"msg": "Check roles/kargo-defaults/defaults/main.yml"
}
2017-05-19 14:13:31,049 p=781 u=root | TASK [bastion-ssh-config : set_fact] ****************************************************************************************************************************
2017-05-19 14:13:31,049 p=781 u=root | Friday 19 May 2017 14:13:31 +000
#!/bin/sh
microk8s.kubectl config view --raw > ~/kube-config
printf %s\\n "alias k9s='k9s --kubeconfig ~/kube-config'" >> ~/.bash_aliases
mkdir -p ~/bin
curl -L https://github.com/derailed/k9s/releases/download/v0.24.1/k9s_Linux_x86_64.tar.gz \
| tar xzO k9s > ~/bin/k9s
chmod +x ~/bin/k9s
printf %s\\n 'now exit your shell and enter again'