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://stackoverflow.com/questions/37951114/direct-download-link-to-onedrive-file | |
onelink() { echo -n "$1"|base64|sed "s/=$//;s/\//\_/g;s/\+/\-/g;s/^/https:\/\/api\.onedrive\.com\/v1\.0\/shares\/u\!/;s/$/\/root\/content/"; } |
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
let nsxServer = location.host; | |
let xsrfToken = await fetch(`https://${nsxServer}/api/v1/reverse-proxy/usersessionInfo`).then(r => r.text()).then(r => JSON.parse(r).xsrfToken); | |
let pageSize = 500; | |
// NSX groups with effective VM members | |
fetch(`https://${nsxServer}/policy/api/v1/search/aggregate?page_size=${pageSize}&cursor=0&sort_by=display_name&sort_ascending=true`, { | |
"headers": { | |
"accept": "application/json, text/plain, */*", | |
"accept-language": "en-US", | |
"content-type": "application/json;charset=UTF-8", |
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
function natualSort { | |
PARAM( | |
[System.Collections.ArrayList]$Array, | |
[switch]$Descending | |
) | |
Add-Type -TypeDefinition @' | |
using System; | |
using System.Collections; | |
using System.Collections.Generic; |
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
# Author: Ryan Ries [MSFT] | |
# Origianl date: 15 Feb. 2014 | |
#Requires -Version 3 | |
Function Test-RPC { | |
[CmdletBinding(SupportsShouldProcess = $True)] | |
Param( | |
[Parameter(ValueFromPipeline = $True)][String[]]$ComputerName = 'localhost', | |
[int[]]$Ports = $null | |
) | |
BEGIN { |
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
{ | |
"Insert new variable": { | |
"prefix": ": ", | |
"body": [ | |
": \"{{ ${2:value} }}\"$0" | |
], | |
"description": "Insert new ansible variable" | |
}, | |
"Insert conditional list": { | |
"prefix": "cond", |
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
function ipChangeHandler { | |
Write-Host "Detected an IP change..." | |
Write-Host "Collecting connections information..." | |
$connObjs = New-Object System.Collections.ArrayList | |
$ints = Get-NetIPAddress -AddressFamily IPv4 -PrefixOrigin Dhcp -AddressState Preferred | |
foreach ($int in $ints) { | |
$_alias = $int.InterfaceAlias | |
$_index = $int.InterfaceIndex | |
$_ipaddr = $int.IPAddress | |
$intCfg = $int | Get-NetIPConfiguration |
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
################################ | |
# Script created by Carl Chang # | |
################################ | |
$devcon = 'path\to\devcon_x64.exe' | |
# uninstall dameware products | |
wmic product where "name like '%%dameware%%'" call uninstall | |
# remove left-over devices |
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
param( | |
# The folder containing the images | |
[Parameter()][string]$imgPath = $env:imgPath, | |
[Parameter()][string]$bgiPath = $env:bgiPath | |
) | |
if ([string]::IsNullOrEmpty($imgPath) -or [string]::IsNullOrEmpty($bgiPath)) { | |
throw "You need to set imgPath and bgiPath environment variables or pass them in." | |
} | |
#region function definitions |
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
<templateSet group="Python"> | |
<template name="for" value="for $VAR$ in $ITERABLE$: $END$" description="Iterate (for ... in ...)" toReformat="false" toShortenFQNames="true"> | |
<variable name="ITERABLE" expression="pyIterableVariable()" defaultValue=""iterable"" alwaysStopAt="true" /> | |
<variable name="VAR" expression="collectionElementName(ITERABLE)" defaultValue=""item"" alwaysStopAt="true" /> | |
<context> | |
<option name="Python" value="true" /> | |
</context> | |
</template> | |
<template name="fori" value="for $INDEX$, $VAR$ in enumerate($ITERABLE$): $END$" description="Iterate (for ... in enumerate)" toReformat="false" toShortenFQNames="true"> | |
<variable name="ITERABLE" expression="pyIterableVariable()" defaultValue="" alwaysStopAt="true" /> |
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
using System; | |
using System.Windows; | |
using System.Windows.Controls; | |
using System.Windows.Media; | |
using System.Windows.Media.Imaging; | |
namespace ZipImageViewer | |
{ | |
public class DpiImage : Image | |
{ |