Skip to content

Instantly share code, notes, and snippets.

View waldekmastykarz's full-sized avatar
🥑
Microsoft 365

Waldek Mastykarz waldekmastykarz

🥑
Microsoft 365
View GitHub Profile
@waldekmastykarz
waldekmastykarz / setup.ps1
Created December 15, 2023 15:47
Proxy setup
New-Item -ItemType Directory -Force -Path .\devproxy -ErrorAction Stop | Out-Null
Set-Location .\devproxy | Out-Null
# Get the full path of the current directory
$full_path = Resolve-Path .
# Get the latest Dev Proxy version
Write-Host "Getting latest Dev Proxy version..."
$response = Invoke-RestMethod -Uri "https://api.github.com/repos/microsoft/dev-proxy/releases/latest" -ErrorAction Stop
$version = $response.tag_name
@waldekmastykarz
waldekmastykarz / toggle-proxy.sh
Created December 11, 2023 19:00
Toggle macOS proxy settings
#!/bin/bash
arg1=$1
# Get the list of network services
network_services=$(networksetup -listallnetworkservices | tail -n +2)
if [[ "$arg1" == "on" ]]; then
while IFS= read -r service; do
networksetup -setwebproxy "$service" 127.0.0.1 8000
@waldekmastykarz
waldekmastykarz / build.sh
Created October 31, 2023 08:27
Build m365proxy locally
# stop on the first error
set -e
architecture="osx-x64"
release="m365-developer-proxy-$architecture-local"
# Clean
rm -rf ./$release
# Publish
@waldekmastykarz
waldekmastykarz / ContentService.cs
Created October 12, 2023 09:07
Build Microsoft Graph connector article - ContentService.cs
using Markdig;
using Microsoft.Graph.Models.ExternalConnectors;
using YamlDotNet.Serialization;
// [...] trimmed for brevity
static class ContentService
{
static IEnumerable<BlogPost> Extract()
{
@waldekmastykarz
waldekmastykarz / ConnectionService.cs
Created October 12, 2023 09:00
Build Microsoft Graph connector article - ConnectionService.cs
static class ConnectionService
{
async static Task CreateConnection()
{
await GraphService.Client.External.Connections
.PostAsync(ConnectionConfiguration.ExternalConnection);
}
async static Task CreateSchema()
{
@waldekmastykarz
waldekmastykarz / ConnectionConfiguration.cs
Last active October 12, 2023 09:01
Build Microsoft Graph connector article - ConnectionConfiguration.cs
using System.Text.Json;
using Microsoft.Graph.Models;
using Microsoft.Graph.Models.ExternalConnectors;
static class ConnectionConfiguration
{
public static ExternalConnection ExternalConnection
{
get
{
@waldekmastykarz
waldekmastykarz / m365proxy-latency.json
Created September 25, 2023 13:11
Sample simulation of latency on Microsoft Graph API requests using Microsoft 365 Developer Proxy
{
"plugins": [
{
"name": "LatencyPlugin",
"enabled": true,
"pluginPath": "~appFolder\\plugins\\m365-developer-proxy-plugins.dll",
"configSection": "latencyPlugin"
}
],
"urlsToWatch": [
@waldekmastykarz
waldekmastykarz / github-config.json
Last active September 3, 2023 10:21
GitHub m365proxy preset
{
"plugins": [
{
"name": "RateLimitingPlugin",
"enabled": true,
"pluginPath": "plugins\\m365-developer-proxy-plugins.dll",
"configSection": "rateLimiting"
}
],
"urlsToWatch": [
<html>
<head>
<title>v0.29.0</title>
</head>
<body>
<h1>v0.29.0</h1>
<h2>Update trust-cert.sh prompt to use y|n + ENTER</h2>
<p>
@waldekmastykarz
waldekmastykarz / appsettings.json
Created April 25, 2023 11:58
Excluding URLs in Microsoft Graph Developer Proxy
{
"plugins": [
{
"name": "GraphRandomErrorPlugin",
"enabled": true,
"pluginPath": "GraphProxyPlugins\\msgraph-developer-proxy-plugins.dll",
"configSection": "graphRandomErrorsPlugin"
}
],
"urlsToWatch": [