Skip to content

Instantly share code, notes, and snippets.

View MattJeanes's full-sized avatar
🏳️‍🌈

Matt Jeanes MattJeanes

🏳️‍🌈
View GitHub Profile
@MattJeanes
MattJeanes / whatsapp-dark.user.js
Last active June 5, 2020 10:13
Enables the beta WhatsApp dark theme (userscript)
// ==UserScript==
// @name WhatsApp Web Dark
// @namespace https://mattjeanes.com
// @version 1.0
// @description Enables the beta WhatsApp dark theme
// @author Matt Jeanes
// @match https://web.whatsapp.com/
// @grant none
// ==/UserScript==
@MattJeanes
MattJeanes / PublishAzWebApp.ps1
Created May 11, 2020 00:40
Native powershell implementation of Publish-AzWebApp (currently C# based)
$publishingUsername = '$xxx'
$publishingPassword = 'xxx'
$scmUri = 'https://xxx.scm.azurewebsites.net'
$zipFile = "xxx.zip"
$deployUrl = "$scmUri/api/zipdeploy?isAsync=true"
$deployStatusUrl = "$scmUri/api/deployments/latest"
$byteArray = [System.Text.Encoding]::ASCII.GetBytes($publishingUsername + ":" + $publishingPassword)
$authHeader = "Basic $([Convert]::ToBase64String($byteArray))"
@MattJeanes
MattJeanes / TARDIS.txt
Created May 10, 2020 23:34
TARDIS Expression 2 (GMod)
@name TARDIS
@inputs
@outputs XYZ:vector
@persist Target:entity TARDIS:entity Visible SavePos:vector SaveAng:angle
runOnChat(1)
if (first()|dupefinished()){
TARDIS=entity():isConstrainedTo():tardisGet()
TARDIS:createWire(entity(),"XYZ", "XYZ")
Target=owner()
entity():setAlpha(0)
@MattJeanes
MattJeanes / deploymentslots.azuredeploy.json
Last active April 1, 2020 15:22
Example deployment slots for both app service and function apps in Azure
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
},
"variables": {
"appServicePlanName": "myapp-swaptest-asp",
"site_name": "myapp-swaptest-app",
"functionapp_name": "myapp-swaptest-func",
"stagingslot_name": "staging"
$commaNumberRegex = [regex]'([0-9][0-9\,]+[0-9])'
$decimalNumberRegex = [regex]'([0-9]+\.[0-9]+)'
$poundsRegex = [regex]'£([0-9\,]*[0-9]+)'
$dollarsRegex = [regex]'\$([0-9\.\,]*[0-9]+)'
$ordinalRegex = [regex]'([0-9]+)(st|nd|rd|th)'
$numberRegex = [regex]'[0-9]+'
if (-not (Get-Module -ListAvailable -Name "PSUnidecode")) {
Install-Module "PSUnidecode" -Force
}
@MattJeanes
MattJeanes / convert.ps1
Last active March 30, 2020 16:25
Convert a collection of files and text captions to training format
Set-Location $PSScriptRoot
if (-not (Get-Module -ListAvailable -Name "Newtonsoft.Json")) {
Install-Module "Newtonsoft.Json" -Force
}
Import-Module "Newtonsoft.Json"
. $PSScriptRoot/normalize.ps1
const fetch = require("node-fetch");
const oauthClientUrl = "https://pastebin.com/raw/pS7Z6yyP"
const baseUrl = "https://owner-api.teslamotors.com";
function wait(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
async function getHeaders() {
@MattJeanes
MattJeanes / ReleaseNoteHelper.cs
Created March 27, 2019 16:00
Release Notes Helper for Azure DevOps
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Microsoft.TeamFoundation.SourceControl.WebApi;
using Microsoft.TeamFoundation.WorkItemTracking.WebApi;
using Microsoft.TeamFoundation.WorkItemTracking.WebApi.Models;
using Microsoft.VisualStudio.Services.WebApi;
using Microsoft.VisualStudio.Services.WebApi.Patch;
using Microsoft.VisualStudio.Services.WebApi.Patch.Json;
using Newtonsoft.Json;
using System;
@MattJeanes
MattJeanes / MongoDBErrorStore.cs
Created November 21, 2018 01:35
MongoDB Error Store for StackExchange.Exceptional
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Driver;
using StackExchange.Exceptional.Internal;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace StackExchange.Exceptional.Stores
{
@MattJeanes
MattJeanes / tesla.js
Last active June 11, 2019 16:19
Checks delivery estimate and updates if it changes
const Nightmare = require('nightmare')
const request = require('request-promise')
const fs = require('fs');
const email = "xxxxx";
const encodedPassword = "xxxxx";
const expectedFile = "./expected.json";
const expected = require(expectedFile);
const pushoverToken = "xxxxx";
const pushoverUser = "xxxxx";