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
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 / 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",
@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();
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
{
"ignition": { "version": "2.2.0" },
"passwd": {
"users": [
{
"name": "core",
"passwordHash": "abc123!@#",
"sshAuthorizedKeys": [
"ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIB4sLpLe47zqP2yPXJA2RW1/LXEqOJmte19cr8LlyukIV6YSSfIAlZm9w4xpYaDb7ZJzAtQOMi8smabN/3Ib43KDIxKmUcyz9k3N76JJLDWndQ3ti59wk7QNMbPslK3+7lUacLut4l+BjYNFExu4ZyQb7ke5EIONrMDyEReONzkDQ== rsa-key-20160322"
]