Skip to content

Instantly share code, notes, and snippets.

@bizob2828
bizob2828 / instrumentation.ts
Last active March 12, 2024 15:48
Next.js otel
export async function register() {
if (process.env.NEXT_RUNTIME === 'nodejs') {
require('./new-relic-instrumentation.js)
}
}
const newrelic = require('newrelic')
newrelic.instrumentMessages('bull', instrumentBull)
function instrumentBull (shim, messageBrokerModule, moduleName) {
// logger.info(shim)
const Queue = messageBrokerModule
console.log(Object.keys(Object.getPrototypeOf(shim)))
console.log(Object.keys(shim))
if (shim.isWrapped(Queue.prototype.process)) {
shim.logger.trace('Bull is already instrumented.')
@bizob2828
bizob2828 / Dockerfile
Created June 30, 2022 20:33
Next.js with-docker Dockerfile update to get Node.js Next.js plugin to work
# Install dependencies only when needed
FROM node:16-alpine AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app
#COPY package.json yarn.lock ./
#RUN yarn install --frozen-lockfile
# If using npm with a `package-lock.json` comment out above and use below instead
COPY package.json package-lock.json ./
@bizob2828
bizob2828 / mongo-example.js
Last active June 28, 2021 19:15
mongo-cb-vs-promises
'use strict';
const MongoClient = require('mongodb').MongoClient;
const assert = require('assert');
// Connection URL
const url = 'mongodb://localhost:27017';
// Database Name
const dbName = 'myproject';
const client = new MongoClient(url);
'use strict';
const onHeaders = require('on-headers');
const memwatch = require('memwatch-next');
const _ = require('lodash');
module.exports = deets;
function deets() {
return (req, res, next) => {
@bizob2828
bizob2828 / test-recip.json
Created November 14, 2014 18:27
test-recip.json
[
{
"return_path": "wilmaflin@tstone.com",
"address": {
"email": "wilmaflin@yahoo.com",
"name": "Wilma"
},
"metadata": {
"place": "Bedrock"
},
{
"foo": "bar"
}

Keybase proof

I hereby claim:

  • I am bizob2828 on github.
  • I am bizob2828 (https://keybase.io/bizob2828) on keybase.
  • I have a public key whose fingerprint is 47E1 AEF4 62FA 851A D193 E6F7 B744 E5B5 C5FF 40B3

To claim this, I am signing this object:

var conn = vertica.connect(dbOptions, function(err) {
});
var lastDay, d;
var batch = 1;
var totalGen = 0;
var fs = require('fs');
var Sync = require('sync');
//Loop for duration, defaults to a day, loading 1 min at a time
for (var l = 1; l <= duration; l++) {
d = new Date((start - l * 60) * 1000);
@bizob2828
bizob2828 / gist:6785811
Created October 1, 2013 21:59
page object example
var protractor = require('protractor');
ptor = protractor.getInstance();
/*
These would emulate the page elements
*/
function TextField(locator) {
var field = {