Skip to content

Instantly share code, notes, and snippets.

View jeremymeng's full-sized avatar

Jeremy Meng jeremymeng

View GitHub Profile
@jeremymeng
jeremymeng / README.md
Last active April 21, 2023 20:27
@azure/storage-blob Web Worker Webpack 5
@jeremymeng
jeremymeng / batchSend.js
Created April 8, 2022 00:12
@azure/event-hubs browser parcel bundler
const { EventHubProducerClient } = require("@azure/event-hubs");
require("@azure/logger").setLogLevel("verbose");
localStorage.debug= "azure*,rhea-promise:error,rhea:events,rhea:frames,rhea:io,rhea:flow"
function generateEvents(n, size) {
result = [];
for (let i = 0; i < n; i++) {
const obj = {
dataType: "data",
From 696505db6647dd182eaa4254c035acf518b35e7d Mon Sep 17 00:00:00 2001
From: Jeremy Meng <yumeng@microsoft.com>
Date: Wed, 27 Jul 2022 14:33:04 -1000
Subject: [PATCH] override webpack config using `react-app-rewired`
---
sb/react-sb/config-overrides.js | 24 +++++++++++
sb/react-sb/package.json | 4 +-
sb/react-sb/src/App.tsx | 5 +++
sb/react-sb/src/testSB.ts | 71 +++++++++++++++++++++++++++++++++
@jeremymeng
jeremymeng / client.js
Created May 2, 2022 21:48
haproxy for testing amqp custom endpoint
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"
const sbClient = new ServiceBusClient(connectionString, {
customEndpointAddress: "sb://127.0.0.1",
// WebSocket works too
// customEndpointAddress: "https://127.0.0.1:3000",
// webSocketOptions: {
// webSocket: ws,
// },
});
@jeremymeng
jeremymeng / rush-project-folder.sh
Last active March 11, 2022 19:33
jq project folder
strip-json-comments rush.json | jq -c '.projects | map(select(.versionPolicyName | contains("management") | not)) | sort_by(.projectFolder) | .[]' > /workspaces/notes/rush-non-mgmt.log
@jeremymeng
jeremymeng / blobProperties.ts
Last active February 17, 2022 22:09
workaround for @azure/blob-storage metadata from getProperties() casing issue
import {
BlobServiceClient,
ContainerClient,
StorageSharedKeyCredential,
} from "@azure/storage-blob";
import { ExampleHttpClient } from "./exampleHttpClient.js";
import * as dotenv from "dotenv";
dotenv.config();
@jeremymeng
jeremymeng / install.sh
Last active August 27, 2021 07:36
packages to install on a new linux vm
sudo apt-get install zip unzip curl make automake libtool build-essential git screen libgtk-3-0 libsm6 libx11-xcb1 libxft2 libtiff5 libgif7 libxpm4 ispell libncurses5 libgnutls30 libxml2
# to build emacs with gtk gui
sudo apt-get install libgtk-3-dev libxpm-dev libtiff5-dev libjpeg8-dev libgif-dev libgnutls28-dev libncurses5-dev libxml2-dev
# emacs 27.1
sudo apt install -y autoconf automake autotools-dev bsd-mailx build-essential \
diffstat gnutls-dev imagemagick libasound2-dev libc6-dev libdatrie-dev \
libdbus-1-dev libgconf2-dev libgif-dev libgnutls28-dev libgpm-dev libgtk2.0-dev \
libgtk-3-dev libice-dev libjpeg-dev liblockfile-dev liblqr-1-0 libm17n-dev \
const client = new BlobServiceClient(url);
async function testUploadProgress() {
const containerClient = client.getContainerClient("jeremy-test");
const blockBlobClient = containerClient.getBlockBlobClient(
"test-upload-progress"
);
const selectedFile = document.getElementById("input").files[0];
const status = document.getElementById("status");
await blockBlobClient.stageBlock(btoa("1"), selectedFile, selectedFile.size, {

Metrics Advisor champion scenarios

Creating Metrics Advisor clients

const {
  MetricsAdvisorKeyCredential,
  MetricsAdvisorClient,
  MetricsAdvisorAdministrationClient
} = require("@azure/ai-metrics-advisor");
@jeremymeng
jeremymeng / Dockerfile
Created March 1, 2019 21:39
Dockerfile for application and sidecar
FROM microsoft/dotnet:2.2-sdk AS builder
WORKDIR /build
COPY *.csproj .
# Restore with `-r linux-x64` to download the runtime package containing crossgen.
RUN dotnet restore -r linux-x64
RUN cp `find ~/.nuget/packages -name crossgen` .
# Restore without `-r` option so that the shared runtime will be used to run the app.
RUN dotnet restore