This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OFFICE365CLI_AADAPPID= OFFICE365CLI_TENANT= m365 login |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OFFICE365CLI_AADAPPID=31... OFFICE365CLI_TENANT=b4... m365 outlook message list --folderName inbox -o json --query '[].id' > emails.txt | |
i=0 | |
cat emails.txt | jq -c '.[]' | while read msgId; do | |
i=$((i+1)) | |
echo "Archiving $i..." | |
OFFICE365CLI_AADAPPID=31... OFFICE365CLI_TENANT=b4... m365 outlook message move --sourceFolderName inbox --messageId $msgId --targetFolderName archive | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const axios = require('axios').default; | |
// define date ranges to process commits | |
const now = new Date(); | |
const pastMonthStart = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth() - 1, 1)); | |
const currentMonthStart = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), 1)); | |
console.log('Retrieving PRs...'); | |
axios | |
.get(`https://api.github.com/repos/pnp/cli-microsoft365/pulls?state=closed&sort=updated&direction=desc&per_page=100`) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ts = require('typescript'); | |
const path = require('path'); | |
const fs = require('fs'); | |
function getAsEnumerable(file, node) { | |
const nodes = [node]; | |
node.getChildren(file).forEach(n => { | |
nodes.push(...getAsEnumerable(file, n)); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const os = require('os'); | |
const path = require('path'); | |
function readdirR(dir) { | |
return fs.statSync(dir).isDirectory() | |
? Array.prototype.concat(...fs.readdirSync(dir).map(f => readdirR(path.join(dir, f)))) | |
: dir; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$now = Get-Date | |
Get-ChildItem | ? { | |
($now - $_.LastWriteTime).totalhours -le 1 | |
} | % { | |
cwebp $_.Name -o $($_.BaseName+".webp") | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://nodejs.org/en/docs/guides/simple-profiling/ | |
NODE_ENV=production node --prof app.js | |
node --prof-process isolate-0xnnnnnnnnnnnn-v8.log > processed.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function CacheMiddleware(expirationConfig) { | |
this.nextMiddleware = undefined; | |
this.expirationConfig = expirationConfig; | |
const getHeaders = (headers) => { | |
const h = {}; | |
for (var header of headers.entries()) { | |
h[header[0]] = header[1]; | |
} | |
return h; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zx | |
const fs = require('fs'), | |
path = require('path'); | |
const nonWebPFiles = fs | |
.readdirSync(process.cwd()) | |
.filter(file => !file.endsWith('.webp')); | |
const lastHour = new Date(); | |
lastHour.setHours(lastHour.getHours() - 1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zx | |
$.verbose = false; | |
console.log('Retrieving permission requests...'); | |
const permissionRequests = JSON.parse(await $`m365 spo sp permissionrequest list -o json`); | |
for (let i = 0; i < permissionRequests.length; i++) { | |
const request = permissionRequests[i]; | |
console.log(`Removing request ${request.Resource}/${request.Scope} (${request.Id})...`); | |
try { |