View Git-RemovedMergedBranches.ps1
This file contains 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
# Can also add to PowerShell profile | |
function Git-RemovedMergedBranches { | |
git branch --merged | | |
? { $_ -NotMatch "^\*" } | | |
? { $_ -NotMatch "master" } | | |
% { $_.Trim() } | | |
% { git branch -d $_ } | |
} |
View default.ahk
This file contains 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
#n::Run "C:\Program Files (x86)\Notepad++\notepad++.exe" | |
#c::Run "C:\Program Files\ConEmu\ConEmu64.exe" | |
#v:: ; Text–only paste from ClipBoard | |
Clip0 = %ClipBoardAll% | |
ClipBoard = %ClipBoard% ; Convert to text | |
Send ^v ; For best compatibility: SendPlay | |
Sleep 50 ; Don't change clipboard while it is pasted! (Sleep > 0) | |
ClipBoard = %Clip0% ; Restore original ClipBoard | |
VarSetCapacity(Clip0, 0) ; Free memory |
View ApplicationApiWithUserCreds.cs
This file contains 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
D2LAppContextFactory appContextFactory = new D2LAppContextFactory(); | |
ID2LAppContext appContext = appContextFactory.Create(appId, appKey); | |
UserContextProperties userContextProperties = new UserContextProperties() { | |
UserId = myUserId, // put your user ID here | |
UserKey = myUserKey, // put your user key here | |
Scheme = "https", | |
HostName = bsUrl, | |
Port = port | |
}; |
View 3-legged OAuth
This file contains 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
+-----------------+ +-----------------+ +-----------------+ | |
| | | | | | | |
| Sample App | | User / Browser | | Auth Server | | |
| | | | | | | |
+--------+--------+ +--------+--------+ +--------+--------+ | |
| | | | |
| | | | |
| GET /auth | | | |
| <----------------------------- |
View brightspace-oauth2-whoami.py
This file contains 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
import requests # requests==2.7.0 | |
url = "http://localhost:44453/d2l/api/lp/1.0/users/whoami" | |
access_token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IjBiOWU5Njg2LWRiYTctNDBkNS05MmRlLTYxNmVkNmYzZmJhMSJ9.eyJzdWIiOiIxNjkiLCJ0ZW5hbnRpZCI6IjNlZGE2ZTJhLWNmZjItNGE0OS1hZjQ5LWY4MmUzZWUzZTkxMSIsInNjb3BlIjoiY29yZToqOioiLCJqdGkiOiJlNDI0YjQyZi1hZTY5LTQ4ZGItYWUzMS00ZjhlZTQ1NDBkNmEiLCJpc3MiOiJodHRwczovL2FwaS5icmlnaHRzcGFjZS5jb20vYXV0aCIsImF1ZCI6Imh0dHBzOi8vYXBpLmJyaWdodHNwYWNlLmNvbS9hdXRoL3Rva2VuIiwiZXhwIjoxNDc5OTIxMTUxLCJuYmYiOjE0Nzk5MTc1NTF9.GznF7Wl-DQxJ3Qp7OPJ4PU_nhHzCzaHYcAFlgahLXyBhAqqAQWKYcrID8UB478iwL2ntYPCtJKLCsJp-ZzZ4QMNc0rwFSJ6_jpQ9W3ALYgIBhILuabG-Xkfdnv4Bi-ME4Q1RcNUvNuuP7ygaJtONc7S4hJtYagsmI9JOW46h-64nevDLijO4CJOIq9B27k_PjPzisAET0ziUD6swIvhX7rUz_nOmCWZJDP56Mi-LIMSd7GrTYP9dTnwvw_rmU_iliO8iOqSKtPaaYUBF9gK4Zulg93nNZDybZozM9sxlfvdRrnjDq6PPUCIbyG1zFwD3GH7-bE9HlemSElhuxyMqSg" | |
response = requests.get(url, headers={'authorization': "Bearer {}".format(access_token)}) | |
print(response.json()) |
View brightspace_refreshtoken.vb
This file contains 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
Dim client As New RestSharp.RestClient("https://auth.brightspace.com/core/connect/token") | |
' Must use basic auth | |
client.Authenticator = new HttpBasicAuthenticator("(client id)", "(client secret)"); | |
Dim req As New RestSharp.RestRequest(Method.POST) | |
req.AddHeader("Content-Type", "application/x-www-form-urlencoded") | |
req.AddHeader("Accept", "application/json") | |
req.AddParameter("grant_type", "refresh_token") | |
req.AddParameter("refresh_token", "(manually obtained refresh token)") | |
req.AddParameter("scope", "Application:*:* Core:*:* Data:*:*") |
View s3-no-delete-policy.json
This file contains 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
{ | |
"Id": "a3769712-3b2a-47e8-8206-85cdaf882384", | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "NoDelete", | |
"Action": [ | |
"s3:Delete*", | |
"s3:PutBucketPolicy" | |
], |
View LICENSE
This file contains 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
MIT License | |
Copyright (c) 2017 Mark Tse | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
View git-perms-change-windows.txt
This file contains 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
# Taken from http://blog.lesc.se/2011/11/how-to-change-file-premissions-in-git.html on January 12, 2018 | |
>git ls-tree HEAD | |
100644 blob 55c0287d4ef21f15b97eb1f107451b88b479bffe script.sh | |
>git update-index --chmod=+x script.sh | |
>git status | |
# On branch master | |
# Changes to be committed: | |
# (use "git reset HEAD <file>..." to unstage) | |
# |
View example.json
This file contains 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
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "DenyObjectDeleteWithWhitelist", | |
"Effect": "Deny", | |
"NotPrincipal": { | |
"AWS": [ | |
"arn:aws:iam::123456789012:role/SuperRoleOne", | |
"arn:aws:iam::123456789012:role/SuperRoleTwo" |
OlderNewer