Skip to content

Instantly share code, notes, and snippets.

View chrisleavoy's full-sized avatar

Chris Leavoy chrisleavoy

  • Etsy
  • Waterloo, Canada
View GitHub Profile
@chrisleavoy
chrisleavoy / exists.rb
Last active December 15, 2015 19:29 — forked from j4m3s/exists.rb
Changed environment to use that of the currently executing one instead of the environment the master is. Thus puppet:/// URL's will resolve properly when --env XXX is used or when clients use an environment different than the master.
#
# exists.rb
#
# James Fellows 8/8/12: cloned from git://gist.github.com/1160472.git then
# modified to resolve puppet:/// paths
#
# Copyright 2011 Puppet Labs Inc.
# Copyright 2011 Krzysztof Wilczynski
#
# Licensed under the Apache License, Version 2.0 (the "License");
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Sms>pong</Sms>
</Response>
define misc::lexec::example () {
exec { 'notify':
command => '/bin/true',
unless => '/usr/bin/test -e /tmp/skip_notify',
}
misc::lexec { 'test_working':
command => '/usr/bin/test -e /tmp/ok',
lock => "/tmp/exec_lock",
<?php
require_once 'vendor/autoload.php';
use Icicle\Loop;
/*
composer require amphp/dns
composer require icicleio/icicle
php test.php
@chrisleavoy
chrisleavoy / example.php
Last active June 1, 2016 17:46
Amp\wait LogicException
<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
\Amp\run(function() {
$generator = resolve('google.ca', 8);
$old = \Amp\reactor();
\Amp\reactor(\Amp\driver());
$result = \Amp\wait(\Amp\resolve($generator));
\Amp\reactor($old);
@chrisleavoy
chrisleavoy / main.go
Created January 13, 2017 19:45
Rate deck compare
package main
import (
"encoding/csv"
"fmt"
"log"
"os"
"strconv"
"io"
"math"
<?xml version="1.0"?>
<document type="captagent_module/xml">
<module name="protocol_sip" description="SIP Protocol" serial="2014010402">
<profile name="proto_sip" description="PROTO SIP" enable="true" serial="2014010402">
<settings>
<param name="dialog-type" value="2"/>
<param name="extract-callid-correlation" value="true"/>
<param name="dialog-timeout" value="180"/>
</settings>
</profile>
<?xml version="1.0"?>
<document type="captagent_module/xml">
<module name="database_rtp" description="DATABASE RTP" serial="201409162150">
<profile name="rtp" description="Database RTP" enable="true" serial="2014010402">
<settings>
<param name="host" value="127.0.0.1"/>
<param name="port" value="6379"/>
<param name="db-num" value="1"/>
<param name="rtp-stats" value="true"/>
<param name="rtcp-stats" value="true"/>