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
#!/usr/bin/env python3 | |
import os, sys, time, datetime | |
import argparse | |
_parser = argparse.ArgumentParser() | |
_parser.add_argument('-s', '--servers', nargs='+', help='List of servers to test in the format hostname:port.', required=True) | |
_parser.add_argument('-a', '--servers-alt', nargs='+', help='Specify alternative address for health check corresponding to each item in servers list. Use same format hostname:port.') | |
_parser.add_argument('-u', '--url', help='The URL to connect for testing. If this parameter is set, the hostname:port in servers list will be used as socks5 proxies. If not set, a socket connection will be attemped directly to hostname:port.') | |
_parser.add_argument('-c', '--config-name', help='The name of the shadowsocks-libev server configuration.', required=True) |
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
<# | |
.SYNOPSIS | |
Tests the connection to the supplied host or IP and reports back on changes to its status. | |
.DESCRIPTION | |
This script will check the connection to the supplied hostname or IP address every 5 second's to | |
monitor its status. If the status changes, a message is recorded, the Eventlog is update (optional), and an email is sent | |
to a supplied email address (optional). | |
If a TCPPort parameter is suppied the script will attempt to connect to this port. Otherwise a simple ICMP Ping is used. |
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
Function Get-DellWarranty { | |
Param( | |
[Parameter(Mandatory,ValueFromPipeline)] | |
[String[]] $ServiceTag, | |
[Parameter(Mandatory)] | |
[string] $APIKey, | |
[Parameter(Mandatory)] | |
[string] $APISecret, |
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
# Top 20 largest folders under /var (including /var) | |
sudo du -h /var | sort -rh | head -20 |
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
# 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 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 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 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
<# | |
.SYNOPSIS | |
Get CDP information from one or more ESX hosts. | |
.PARAMETER VMHost | |
VMHost can be a list of the below entries: | |
- FQDN name of the host | |
- VMware.Vim.HostSystem (return type of 'Get-View -ViewType HostSystem') | |
- VMware.VimAutomation.ViCore.Impl.V1.Inventory.VMHostImpl (return type of 'Get-VMHost') |
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
git checkout --orphan latest_branch # orphan omits all the history | |
git add * # if you want to include all files (respecting gitignore). Otherwise make other changes here. | |
git commit -am "commit message" | |
git branch -D master # delete master branch | |
git branch -m master # rename current branch to master | |
git push -f origin master |
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
using System; | |
using System.Windows; | |
using System.Windows.Controls; | |
using System.Windows.Media; | |
using System.Windows.Media.Imaging; | |
namespace ZipImageViewer | |
{ | |
public class DpiImage : Image | |
{ |