Skip to content

Instantly share code, notes, and snippets.

View diberry's full-sized avatar
💭
Enjoying the sun

Dina Berry (MSFT) diberry

💭
Enjoying the sun
View GitHub Profile
@JasonWHowell
JasonWHowell / RegEx for Kusto queries.md
Last active March 14, 2024 07:26
RegEx Examples for Docs

Azure Data Explorer (Kusto) query Regex

To remove locale like /en-us/ from URLs I use this function:

Most Docs locales are like en-us / ja-jp / de-de with 2 letters separated by a dash, however there are others with 3-4 letters, and some with 3 tuples with 2 dashes.

let unloc=(arg0:string) { let extract1=extract(@"^https?:\/\/docs\.microsoft\.com\/[A-Za-z]{2,3}-[A-Za-z]{2,4}-?[A-Za-z]{0,3}\/(\S*)", 1, arg0); case(isnotempty(extract1),strcat("https://docs.microsoft.com/", extract1),arg0) };
@lammichael
lammichael / Dockerfile
Last active February 1, 2022 20:48
Debugging a parcel app, running in Docker, in VS Code
FROM node:10.15.3-alpine
WORKDIR /app
# In package.json I define the serve script as
# "parcel src/index.html --hmr-port 1235"
ENTRYPOINT ["npm", "run", "serve"]
@PaulMougel
PaulMougel / client.js
Last active May 1, 2024 12:38
File upload in Node.js to an Express server, using streams
// node: v0.10.21
// request: 2.27.0
var request = require('request');
var fs = require('fs');
var r = request.post("http://server.com:3000/");
// See http://nodejs.org/api/stream.html#stream_new_stream_readable_options
// for more information about the highWaterMark
// Basically, this will make the stream emit smaller chunks of data (ie. more precise upload state)
var upload = fs.createReadStream('f.jpg', { highWaterMark: 500 });