Skip to content

Instantly share code, notes, and snippets.

graph TB
    start -->|"When triggered by CI or Draft Tag"| compile[Compile]
    compile --> tests[Tests]
    compile -->|"generates"| binary[Binary Executable]
    binary -->|"is uploaded to"| s3a[Evergreen S3]
    compile -->|"when Compile is successful"| package[Package]
    compile -->|"when Compile is successful"| e2e[E2E Tests]
    package -->|"generates"| distributable[Distributable Package]
    distributable -->|"is uploaded to"| s3b[Evergreen S3]
@mcasimir
mcasimir / rename-hadron.js
Created January 9, 2024 19:04
Rename hadron to compass
const fs = require('fs');
const path = require('path');
const { execSync } = require('child_process');
const _ = require('lodash');
const fsExtra = require('fs-extra');
const fileList = execSync('git ls-files').toString().trim().split('\n')
function removeDuplicateDebugEntries(text) {
if (!text.includes("compass*")) {
return text;
@mcasimir
mcasimir / lgcolors.js
Last active September 5, 2022 15:56
Lg colors
#!/usr/bin/env node
const { Command } = require('commander');
const fs = require('fs');
const colorConvert = require('color-convert');
const colorDiff = require('color-diff');
const isBinaryFileSync = require("isbinaryfile").isBinaryFileSync;
const chalk = require('chalk');
#!/usr/bin/env node
const { promises: fs } = require("fs");
const path = require("path");
const { program } = require("commander");
const chronoNode = require("chrono-node");
const { pick } = require("lodash");
const fecha = require("fecha");
const { gunzip: gunzipCb, constants: zlibConstants } = require("zlib");
const { promisify } = require("util");
const { glob: globCb } = require("glob");
FROM ubuntu:20.04
EXPOSE 27017
ARG MONGODB_VERSION=6.0.0-rc4
RUN apt-get update -y && apt-get install -y \
curl libcurl4 libgssapi-krb5-2 libldap-2.4-2 libwrap0 \
libsasl2-2 libsasl2-modules libsasl2-modules-gssapi-mit \
snmp openssl liblzma5
@mcasimir
mcasimir / instance-detail.ts
Created October 12, 2021 14:24
instance-detail.ts
import { union, unionBy } from 'lodash';
import { AnyError, MongoClient, ReadPreference } from 'mongodb';
import {
isEnterprise,
getGenuineMongoDB,
getDataLake,
} from 'mongodb-build-info';
@mcasimir
mcasimir / README.md
Last active October 21, 2020 10:54
gssapi.js fixes

This is a POC fix for some kerberos issues in Compass.

Bug with kerberos in Compass

Compass crashes after a successful authentication to kerberos.

This is caused by the fact that the authentication with kerberos gets triggered multiple times inside the driver (to start the connection pool?), however the GSSPI code is not meant to deal with concurrent calls as that seems to break the state of the authentication completely.

Looks like the kerberos module itself could be not re-entrant.

@mcasimir
mcasimir / init-ts-package.sh
Created October 10, 2020 12:00
init-ts-package.sh
#!/usr/bin/env bash
generate_file() {
if [ ! -f "$1" ]; then
echo "$2" > "$1"
fi
}
# ---
# package.json
@mcasimir
mcasimir / index.spec.js
Last active July 20, 2020 11:02
Debug COMPASS-4319
const { MongoClient } = require('mongodb');
const assert = require('assert');
const HOST = 'centos-east.win.mongodb-field.com';
const PORT = '27017';
const PRINCIPAL = '[email protected]';
const GSSAPI_SERVICE_NAME = 'mongo-ent';
describe('MongoClient authentication with kerberos', () => {
const options = {
@mcasimir
mcasimir / index.spec.js
Created March 6, 2020 15:52
Test cursor hasNext
const { MongoClient } = require('mongodb');
const assert = require('assert');
describe('mongodb cursor issue', function() {
this.timeout(2000);
let client;
let dbName;
let db;
let collection;