Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View nigelhorne's full-sized avatar

Nigel Horne nigelhorne

View GitHub Profile
@cherti
cherti / alert.sh
Created December 9, 2016 13:47
send a dummy alert to prometheus-alertmanager
#!/bin/bash
name=$RANDOM
url='http://localhost:9093/api/v1/alerts'
echo "firing up alert $name"
# change url o
curl -XPOST $url -d "[{
\"status\": \"firing\",
@odyniec
odyniec / tempdir.pl
Last active February 11, 2022 13:36
An example Perl program that uses File::Temp to create a temporary directory for the time of program execution.
#!/usr/bin/env perl
use Cwd;
use File::Temp;
# Remember the current directory
my $oldcwd = getcwd;
# Create a temporary directory
my $dir = File::Temp->newdir;
# Go to the temporary directory
@miyagawa
miyagawa / buildable-git-repo.md
Last active April 17, 2019 14:48
Buildable git repo for CPAN

Buildable, Testable, Installable Git repo for Perl modules

tl;dr We might need a standard build file to build a module from Git repository, especially for the ones using Module::Install or dzil.

The problem

When an author of CPAN module uses an authoring tool that generates build files when shipping them to CPAN, the git repository usually doesn't have enough files to build, test and install the module.

For example, if dzil (Dist::Zilla) is used, the repository only conatains dist.ini and there's no Makefile.PL or Build.PL so standard CPAN installers or Continuous Integration tools don't know how to run tests on it.

@Ovid
Ovid / find_duplicate_code.pl
Created December 7, 2012 08:47
Find Duplicate Code in Perl (a hack)
#!/usr/bin/env perl
use 5.12.0;
use autodie;
use Carp;
use utf8::all;
use File::Spec::Functions qw(catfile catdir);
use File::Find::Rule;
use Getopt::Long;
use Capture::Tiny qw(capture);