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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
| <title>HTML5 video events to App Insights</title> | |
| <meta name="description" content=""> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <script type="text/javascript"> | |
| var appInsights=window.appInsights||function(config){ |
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
| # Eat up 90% of free memory | |
| stress --vm-bytes $(awk '/MemFree/{printf "%d\n", $2 * 0.9;}' < /proc/meminfo)k --vm-keep -m 1 |
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
| FROM https://community.hortonworks.com/articles/69823/creating-shared-access-signature-sas-for-posting-d.html | |
| Short Description: | |
| Step by step instructions for creating a SAS token to authorize HTTP clients for Microsoft's Azure Event Hubs | |
| Article | |
| First ... if you need background Azure Event Hubs go here: https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-overview |
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
| UPSTART | |
| Enabling / Disabling a service | |
| To toggle a service from starting or stopping permanently you would need to: | |
| echo manual | sudo tee /etc/init/SERVICE.override | |
| ------------------------------------------------------------------------ | |
| https://askubuntu.com/questions/19320/how-to-enable-or-disable-services | |
| ------------------------------------------------------------------------ | |
| Grep uncommented lines in config file: |
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
| sudo echo "Acquire::ForceIPv4 \"true\";" > /etc/apt/apt.conf.d/99force-ipv4 |
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
| // Create a SAS token | |
| // See http://msdn.microsoft.com/library/azure/dn170477.aspx | |
| const moment = require('moment'); | |
| const crypto = require('crypto'); | |
| function create_sas_token(uri, key_name, key) | |
| { | |
| // Token expires in one hour | |
| var expiry = moment().add(7, 'days').unix(); |
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
| [System.Net.ServicePointManager]::ServerCertificateValidationCallback = { $True } | |
| $url = 'https://self-signed.badssl.com/' | |
| $apiReq = [System.Net.HttpWebRequest]::CreateHttp($url) | |
| $apiRes = $apiReq.GetResponse() | |
| Out-File -Encoding Ascii -FilePath $res -InputObject $(ConvertTo-Json $apiRes) |
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 captureVideoFrame(video, format) { | |
| if (typeof video === 'string') { | |
| video = document.getElementById(video); | |
| } | |
| format = format || 'jpeg'; | |
| if (!video || (format !== 'png' && format !== 'jpeg')) { | |
| return false; | |
| } |
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
| async function makeRequest() { | |
| // npm install async-request | |
| let request = require('async-request'), response; | |
| try { | |
| response = await request('https://istrumpstillpresident.io/version', { | |
| headers: {'Accept': 'application/json'} | |
| }); | |
| } | |
| catch(e) { |
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
| case 'about_roedu': | |
| let wikipediaUrl = 'https://en.wikipedia.org/w/api.php?format=json&action=query&prop=extracts&exlimit=max&explaintext&exintro&titles=RoEduNet&redirects='; | |
| const request = require('request'); | |
| request(wikipediaUrl, function (error, response, body) { | |
| context.log('error:', error); // Print the error if one occurred | |
| context.log('statusCode:', response && response.statusCode); | |
| context.log('body:', body); | |
| let jsonRes = JSON.parse(body); | |
| let page = Object.keys(jsonRes.query.pages)[0]; | |
| let pageText = jsonRes.query.pages[page].extract; |