Skip to content

Instantly share code, notes, and snippets.

@mcvella
mcvella / viam_python_venv.md
Last active September 28, 2023 18:14
Viam Python venv

Viam + Python

This guide will help you get set up with Viam with Python. It assumes that you are starting from scratch, and will walk you through setting up a fresh environment and installing the necessary requirements.

Setup your project

The first step is to create a directory to house your project. For this guide, we will be using the directory name viam-python:

mkdir viam-python
@mcvella
mcvella / mongoFailoverTest2
Created April 25, 2013 18:16
Test case modified to wait longer after bringing primary down, now produces a different error.
/* DEPS */
var MongoClient = require('mongodb').MongoClient;
var async = require('async');
var exec = require('child_process').exec;
// GLOBALS FOR TESTING
var servers = ["127.0.0.1:27017","127.0.0.1:27027","127.0.0.1:27037"];
var username = 'USERNAME';
var password = 'PASSWORD';
@mcvella
mcvella / mongoFailoverTest.js
Last active December 16, 2015 02:50
Here is a test where a replica set is brought up with auth, a collection is queried, the primary is brought down, then back up, and the primary is queried again. After the primary is brought back up, the query fails due to non-authentication. NOTE: I actually could not replicate this without performing two queries on either side, I am not sure i…
/*
Note that you will need to do the following prior to running this script:
- Create an auth user in the admin database and update the username and password variables in the script.
- Instantiate replica set:
rs.initiate( { _id: "test", members: [ { _id: 0, host : "localhost:27017", priority : 10 }, { _id: 1, host : "localhost:27027", priority : 5 }, { _id : 2, host : "localhost:27037", priority : 2 } ] } );
- Bring mongo down.
- Create directories /data/test-0,data/test-1,data/test-2
- Create ~/keyFile for replica set auth
- Bring mongo back up on the correct ports for each member of the replica set.