Skip to content

Instantly share code, notes, and snippets.

View wictorwilen's full-sized avatar
😀

Wictor Wilén wictorwilen

😀
View GitHub Profile
@wictorwilen
wictorwilen / azureiot.md
Last active October 19, 2022 19:21
Azure IoT integration for Home Assistant

layout: page title: "Azure IoT" description: "Offers support for Azure IoT integration with Homeassistant." date: 2017-10-22 14:18 sidebar: true comments: false sharing: true footer: true logo: home-assistant.png

@wictorwilen
wictorwilen / AppOnly-ACS-PowerShell-Sample.ps1
Last active November 9, 2021 18:26
SharePoint Online: App Only policy PowerShell tasks with ACS
# For more information see: http://www.wictorwilen.se/sharepoint-online-app-only-policy-powershell-tasks-with-acs
$clientId = "<INSERT YOUR CLIENT ID HERE>"
$secret = "<INSERT YOUR CLIENT SECRET HERE>";
$redirecturi = "<INSERT YOUR REDIRECT URI HERE>"
$url = "https://<TENANT>.sharepoint.com/sites/contoso/"
$domain = "<TENANT>.sharepoint.com"
$identifier = "00000003-0000-0ff1-ce00-000000000000"
@wictorwilen
wictorwilen / install-microsoft-edge-in-wsl.sh
Created November 2, 2021 20:55
Install Microsoft Edge in WSL
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -o root -g root -m 644 packages.microsoft.gpg /etc/apt/trusted.gpg.d/
sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/trusted.gpg.d/packages.microsoft.gpg] https://packages.microsoft.com/repos/edge stable main" > /etc/apt/sources.list.d/vscode.list'
rm -f packages.microsoft.gpg
sudo apt update
sudo apt install microsoft-edge-stable
@wictorwilen
wictorwilen / flow-bot-azure-function.js
Last active June 2, 2021 04:10
Microsoft Teams Outgoing Webhook Proxy for Microsoft Flow
const crypto = require('crypto');
const request = require('request');
const bufSecret = Buffer('OUTGOING-WEBHOOK-SECRET', "base64");
const flowWebhook = 'MICROSOFT-FLOW-URL';
module.exports = function (context, req) {
var auth = req.headers['authorization'];
// HMAC security validation
@wictorwilen
wictorwilen / manifest.json
Last active May 19, 2021 08:50
Homeassistant Sector Alarm integration
{
"domain": "sector_alarm",
"name": "Sector Alarm",
"documentation": "https://void.null",
"dependencies": [],
"codeowners": [],
"requirements": []
}
@wictorwilen
wictorwilen / teamsemail.ps1
Created February 11, 2020 10:06
List all Microsoft Teams members e-mail
Install-Module -Name MicrosoftTeams -Force
Connect-MicrosoftTeams
Get-Team -User <username>
Get-TeamUser -GroupId <id> | ft User
var url = "https://contoso.sharepoint.com/sites/classic/SiteAssets/test"
var context = SP.ClientContext.get_current()
var site = context.get_site()
var actions = site.get_userCustomActions();
context.load(site)
context.load(actions)
context.executeQueryAsync(
function () {
var newAction = actions.add();
newAction.set_description('abc123')
@wictorwilen
wictorwilen / get-site-info.js
Last active October 16, 2018 10:52
Client side updates of SharePoint stuff
fetch('/_api/site', {headers:{accept:'application/json'}}).then( x => x.json().then( y => console.log(y)))
@wictorwilen
wictorwilen / .env
Created October 15, 2018 15:58
Import and env files
DATA=From env file
@wictorwilen
wictorwilen / ListsService.ts
Last active March 1, 2018 09:27
Simple SPFx ListService.ts
'use strict';
import { HttpClient, HttpClientResponse } from '@microsoft/sp-http';
import { IWebPartContext } from '@microsoft/sp-webpart-base';
export interface IListsService {
getListNames(): Promise<string[]>;
getListColumns(listName: string): Promise<string[]>;
getListItems(listName: string, listColumns: string[]): Promise<string[][]>