Skip to content

Instantly share code, notes, and snippets.

View 1RedOne's full-sized avatar

Stephen Owen 1RedOne

View GitHub Profile
@bryanbarnard
bryanbarnard / SimpleHttpClient.cs
Created December 23, 2013 19:15
Simple C# .NET 4.5 HTTPClient Request Using Basic Auth and Proxy
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net.Http;
using System.Net;
namespace HTTP_Test
@jeffa00
jeffa00 / Get-Temperature
Last active July 28, 2024 20:10
Get CPU Temperature With PowerShell
# Please note that this is quite old at this point and may or may not work for you. I leave it here for historical purposes
# and just in case it can help someone. I think I may have been using Windows 7 when I wrote this.
function Get-Temperature {
$t = Get-WmiObject MSAcpi_ThermalZoneTemperature -Namespace "root/wmi"
$currentTempKelvin = $t.CurrentTemperature / 10
$currentTempCelsius = $currentTempKelvin - 273.15
$currentTempFahrenheit = (9/5) * $currentTempCelsius + 32
@healeyio
healeyio / Update-LyncLocation.ps1
Last active July 28, 2020 14:06
Update Lync Client (2013) Location Field with GeoIP Location Data
#requires –Version 3.0
<#
.SYNOPSIS
Updates Lync 2013 Client's location information with geolocation data based on internet ip address.
.DESCRIPTION
The Update-LyncLocation.ps1 script updates the Lync 2013 Client's location information. It uses the
Telize web service to determine your external ip address and then queries Telize to collect publicly
available geolocation information to determine your location. That data is then parsed into usable
information and published to the Lync client.
@altrive
altrive / ToastNotification_Windows10.ps1
Last active May 12, 2024 09:34
Windows 10 toast notification sample
$ErrorActionPreference = "Stop"
$notificationTitle = "Notification: " + [DateTime]::Now.ToShortTimeString()
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] > $null
$template = [Windows.UI.Notifications.ToastNotificationManager]::GetTemplateContent([Windows.UI.Notifications.ToastTemplateType]::ToastText01)
#Convert to .NET type for XML manipuration
$toastXml = [xml] $template.GetXml()
$toastXml.GetElementsByTagName("text").AppendChild($toastXml.CreateTextNode($notificationTitle)) > $null
@joar
joar / README.md
Created May 10, 2015 22:16
Accessing MSI Afterburner remote server manually

Where $ip and $port are your MSI Afterburner Remote Server's IP address and port:

  • Go to $ip:$port/mahm, you will be presented with a HTTP Basic Auth dialog.
  • Enter MSIAfterburner as the username.
  • Enter your security key as the password.

Profit! You'll get an XML file that looks something like the attached xml-example.xml.

@bryanbarnard
bryanbarnard / sample_restmessagev2.js
Created July 2, 2015 14:57
Sample RESTMessageV2 Parse JSON Response
// NOTE: this sample was run in a ServiceNow instance running release version Fuji Patch 4
(function sampleRequest() {
try {
var request = new sn_ws.RESTMessageV2();
request.setHttpMethod('get');
request.setEndpoint('https://rawgit.com/anonymous/f1c4664cafd6caf855fd/raw/f7ca3b022045e2c9f49dd2b453dea0cecc09888c/sample_json.json');
var response = request.execute();
var httpResponseStatus = response.getStatusCode();
@ingramchen
ingramchen / gist:e2af352bf8b40bb88890fba4f47eccd0
Created April 5, 2016 12:58
ffmpeg convert gif to mp4, for best cross browser compatibility
### Full command line options
```
ffmpeg -f gif -i FOO.gif -pix_fmt yuv420p -c:v libx264 -movflags +faststart -filter:v crop='floor(in_w/2)*2:floor(in_h/2)*2' BAR.mp4
```
### Notie
* output mp4 is encoded with h264, support Firefox/Chrome/Safari in Windows, Mac OSX, Android, and iOS.
$keys = $PSCmdlet.MyInvocation.BoundParameters.Keys
foreach ($key in $keys)
{
$keyValue = @{
$true = ",$key"
$false = "?patchFields=$key"
}
$queryParams += $keyValue.($PSCmdlet.MyInvocation.BoundParameters.ContainsKey($key))
}
@bryanbarnard
bryanbarnard / ccw3970_background_script_publish_message
Created April 14, 2017 13:44
CCW3970 Background Script - Publish Message
/*
Make HTTP Request using RESTMessageV2
*/
try {
var req = new sn_ws.RESTMessageV2('PubNub', 'Publish Message');
req.setStringParameterNoEscape('pub_key', 'pub-c-11b9ede6-f9ee-4da8-a829-944a45f29eb8');
req.setStringParameterNoEscape('client', gs.getProperty('instance_name') + '-' + gs.getProperty('instance_id'));
req.setStringParameterNoEscape('sub_key', 'sub-c-dafe9b8c-1ae1-11e7-bc52-02ee2ddab7fe');
req.setStringParameterNoEscape('channel', 'CCW3970');