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
<?php | |
# Install Curl Support with sudo apt-get install php-curl | |
# Install XML Support with: sudo apt-get install php-xml | |
#Config | |
#Plex host in url format (protocol://host:port) | |
$plex_host = "http://localhost:32400"; | |
$plex_token = "YourPlexTokenHere"; | |
#Get updates XML file from plex |
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
workflow PauseDWInstances | |
{ | |
$connectionName = "AzureRunAsConnection" | |
try { | |
# Get the connection "AzureRunAsConnection " | |
$servicePrincipalConnection=Get-AutomationConnection -Name $connectionName | |
"Logging in to Azure..." | |
Add-AzureRmAccount ` | |
-ServicePrincipal ` |
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
#r "Newtonsoft.Json" | |
#r "System.Configuration" | |
#r "System.Data" | |
using System; | |
using System.Net; | |
using RestSharp; | |
using Newtonsoft.Json; | |
using Newtonsoft.Json.Linq; | |
using System.Data; |
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
#r "Newtonsoft.Json" | |
#r "System.Configuration" | |
#r "System.Data" | |
using System.Net; | |
using System.Text; | |
using System.Data; | |
using System.Data.SqlClient; | |
using System.Configuration; | |
using Newtonsoft.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
#r "Newtonsoft.Json" | |
#r "System.Configuration" | |
#r "System.Data" | |
using System.Net; | |
using System.Text; | |
using System.Data; | |
using System.Data.SqlClient; | |
using System.Configuration; | |
using Newtonsoft.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
import time | |
import board | |
import digitalio | |
from urllib import request, parse | |
print("press the button!") | |
sneezeurl = "AzureFunctionsURL" | |
led = digitalio.DigitalInOut(board.D18) |
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
# You will need to install the newest version of SSMS https://docs.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms | |
# (easiest way to get the dependencies) and install AzCopy http://aka.ms/downloadazcopy | |
# create a file one database name per line called database_list.txt for all dbs on the server you want to export | |
#SQL Azure connection info | |
$sql_servername = '' # Without .database.windows.net | |
$sql_username = '' | |
$sql_password = '' | |
#Storage Account connection info |
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.Text; | |
using System.Net; | |
using Microsoft.IdentityModel.Clients.ActiveDirectory; | |
using Newtonsoft.Json.Linq; | |
/* Basic REST API Example for Creating database from Geo-Restore | |
* Grab Microsoft.IdentityModel.Clients.ActiveDirectory and Newtonsoft.Json from Nuget | |
* | |
* Create Service principal credentials as per https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal#create-an-azure-active-directory-application |
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
def format_bandwidth(i): | |
loop = 0 | |
current_num = i | |
last_num = 0 | |
label = ["Bps", "KBps", "MBps", "GBps"] | |
while(True): | |
last_num = current_num | |
current_num = current_num/1024.0 | |
if(current_num < 1): | |
return '{0:0.2f} {1}'.format(last_num, label[loop]) |
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
<?php | |
function write_to_influx($influx_host, $influx_port, $influx_db, $influx_query) { | |
#Convert to binary stream as per https://stackoverflow.com/a/34119930/404006 | |
$stream = fopen('php://memory','r+'); | |
fwrite($stream, $influx_query); | |
$data_length = ftell($stream); | |
rewind($stream); | |
$curl = curl_init(); | |
curl_setopt_array( $curl, |