Skip to content

Instantly share code, notes, and snippets.

View glachancecmaisonneuve's full-sized avatar

Guillaume Lachance glachancecmaisonneuve

  • College de Maisonneuve
  • Montreal, QC
View GitHub Profile
@glachancecmaisonneuve
glachancecmaisonneuve / Blank snippet.OUTLOOK.yaml
Created January 2, 2024 20:22
Create a new snippet from a blank template.
name: Blank snippet
description: Create a new snippet from a blank template.
host: OUTLOOK
api_set: {}
script:
content: |
$("#run").click(run);
function run() {
const userProfile = Office.context.mailbox.userProfile;
@glachancecmaisonneuve
glachancecmaisonneuve / Get selected text (Compose).OUTLOOK.yaml
Created January 2, 2024 20:19
Gets the selected text in the item body or subject in Compose mode.
name: Get selected text (Compose)
description: Gets the selected text in the item body or subject in Compose mode.
host: OUTLOOK
api_set: {}
script:
content: |
$("#get-selected-data").click(getSelectedData);
function getSelectedData() {
Office.context.mailbox.item.getSelectedDataAsync(Office.CoercionType.Text, function(asyncResult) {
@glachancecmaisonneuve
glachancecmaisonneuve / sha-1.js
Last active April 11, 2023 01:11 — forked from lusbuab/sha-1.js
Calculating SHA-1 in the Browser
async function sha1(str) {
const buffer = new TextEncoder("utf-8").encode(str);
const hash = await crypto.subtle.digest('SHA-1', buffer)
const hexCodes = [];
const view = new DataView(hash);
for (let i = 0; i < view.byteLength; i += 1) {
const byte = view.getUint8(i).toString(16).padStart(2, '0')
hexCodes.push(byte);
}
return hexCodes.join('');
;---Installation script
!define APP_NAME "MultithreadWindowsCopy"
; Include Modern UI
!include "MUI2.nsh"
; Includes KillProcess
!include "nsProcess.nsh"
start "" "smartgit://cloneRepo/https://gist.github.com/glachancecmaisonneuve/eca39ca79c022f3315eaa2e99816837b"
start "" "github-windows://openRepo/https://gist.github.com/glachancecmaisonneuve/eca39ca79c022f3315eaa2e99816837b"
start "" "x-github-client://openRepo/https://gist.github.com/glachancecmaisonneuve/eca39ca79c022f3315eaa2e99816837b"
start "" "tgit://clone/https://gist.github.com/glachancecmaisonneuve/eca39ca79c022f3315eaa2e99816837b"
start "" "git://github.com/powershell/powershell"
@glachancecmaisonneuve
glachancecmaisonneuve / undef.md
Created March 12, 2019 22:27 — forked from hmemcpy/undef.md
Disabling Visual Studio Git Provider

Here's how to disable the package that is responsible for loading the Git source control support in Visual Studio. Use at your own risk!

  • Create a file called devenv.pkgundef and place it next to devenv.exe in you Visual Studio's Common7\IDE (you'll need elevation for this)
  • Add the following entries to the file:
[$RootKey$\Packages\{7fe30a77-37f9-4cf2-83dd-96b207028e1b}]
[$RootKey$\SourceControlProviders\{11b8e6d7-c08b-4385-b321-321078cdd1f8}]
  • Close VS if open, open a Developer command prompt, and type devenv /updateconfiguration
{
"name": "Ini",
"scopeName": "source.ini",
"patterns": [
{
"begin": "(^[ \\t]+)?(?=#)",
"beginCaptures": {
"1": {
"name": "punctuation.whitespace.comment.leading.ini"
}
name: Clear Headers and Footers - 1
description: ''
host: WORD
api_set: {}
script:
content: |
document.getElementById("run").onclick = function() {
console.log("test");
run();
};
@glachancecmaisonneuve
glachancecmaisonneuve / DoNotFuckWithMyPath.psm1
Last active July 12, 2018 20:13
DoNotFuckWithMyPath overrides chocolatey's Install-ChocolateyPath function (installers may still change your paths, but package maintainers can't)
function Register-DoNotFuckWithMyPath {
param(
[parameter(Mandatory=$true, Position=0)][string] $pathToInstall,
[parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments
)
Write-Host "Chocolatey-DoNotFuckWithMyPath Extension prevented an overzealous package manager to from fucking with your path."
Write-Host "(It attempted to add $pathToInstall)"
}
@glachancecmaisonneuve
glachancecmaisonneuve / DontYouDarePinAnythingToMyTaskbar.psm1
Last active July 12, 2018 20:32
DontYouDarePinAnythingToMyTaskbar-Chocolatey-AntiExtension
function Register-DontYouDarePinAnythingToMyTaskbar {
param(
[parameter(Mandatory=$true, Position=0)][string] $pathToInstall,
[parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments
)
Write-Host "Chocolatey-DontYouDarePinSomethingToMyTaskbar Extension prevented an overzealous package manager from pinning a program to your taskbar."
}
New-Alias -Name 'Install-ChocolateyPinnedTaskBarItem' -Value 'Register-DontYouDarePinAnythingToMyTaskbar' -Scope Global