Skip to content

Instantly share code, notes, and snippets.

def getServer(criteria):
startTime = loopEndTime = gettime()
maxTime = startTime + serverSelectionTimeoutMS/1000
if topology.lastUpdateTime - startTime > heartbeatFrequencyMS/1000:
topology.stale = true
while true:
@bjori
bjori / gist:d82fcfe8078fa113391a
Created May 19, 2015 16:55
~/.vagrant.d/Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby et sw=2 :
Vagrant.configure(2) do |config|
config.vm.provision "file", source: "/home/bjori/.gitconfig", destination: "~/.gitconfig"
config.vm.provision "file", source: "/home/bjori/.bashrc", destination: "~/.bashrc"
config.vm.provision "file", source: "/home/bjori/.profile", destination: "~/.profile"
config.vm.provision "file", source: "/home/bjori/.vimrc", destination: "~/.vimrc"
config.vm.provision "file", source: "/home/bjori/.vim", destination: "~/.vim"
@exodist
exodist / gist:ef08a3c406d98c1bb618
Last active August 29, 2015 14:20
smallest mongo+test-simple script
use strict;
use warnings;
use Test::More 'no_plan';
use MongoDB::Timestamp; # needed if db is being run as master
use MongoDB;
use lib "t/lib";
use MongoDBTest qw/build_client get_test_db/;
* build a spider
* build a megaspider
* build a registry of megaspider
$s = Spider->new({
bson_type => BSON_INT32,
perl_type => [ typetype => 'name1' ],
from_perl => [
@dagolden
dagolden / version-pm-evolution.txt
Last active June 17, 2024 22:58
version number evolution discussions from Lyon 2014
Broad decisions about rationalizing version object behavior based on
discussions at the Lyon QAH. Participants: David Golden, Ricardo Signes,
Karen Etheridge, Leon Timmermans, Peter Rabbitson and Graham Knop
- version comparision should be done irrespective of the presence of
underscores in the string used to initialize the version object
- underscore should no longer be used as a tuple separator in vstrings or
vstring-like strings; vstrings are converted to tuples by splitting into
*characters* (not bytes) and converting to codepoints; any elements after
* Collaborating with Ricardo in finishing PAUSE changes agreed to in the Lancaster Consensus
* Patching CPAN.pm to use CPAN::Common::Index for lower memory use and/or faster index response time
* Refactoring code from CPAN, CPANPLUS and cpanminus into CPAN::Common::* modules for less duplication and greater consistency across clients
* Prototyping ideas I have for improved code benchmarking tools
* Closing security holes in various toolchain modules
* Automating Metabase deployment with configuration management tools
* Implementing IPv6 support in HTTP::Tiny; also reviewing a pull request for persistent connection support
* Implementing coderef/arrayref/object in @INC support for Acme::require::case
* Improving perldoc for require
* Exploring BackPAN indexing and improved PAUSE indexes
@miyagawa
miyagawa / circular-detect.pl
Last active November 2, 2021 15:33
Circular perl/CPAN dependencies with requires/recommends/suggests for configure/runtime/build/test for all modules in 02packages
#!/usr/bin/env perl
use strict;
use Parse::CPAN::Packages;
use Module::CoreList;
use JSON::XS;
$| = 1;
my $packages_file = "$ENV{HOME}/minicpan/modules/02packages.details.txt.gz";
anonymous
anonymous / gist:1872636
Created February 21, 2012 00:53
cpanm recipes
define :local_lib_for_user, :user => nil do
filename = "/etc/profile.d/perl-lib-#{params[:user]}.sh"
cpan_module 'local::lib' do
user params[:user]
end
script "perl-lib-#{params[:user]}" do
interpreter "bash"