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
require 'win32ole' | |
wmi = WIN32OLE.connect('winmgmts://') | |
result = wmi.ExecQuery('select SecondLevelAddressTranslationExtensions from Win32_Processor').to_enum.first | |
if result && result.SecondLevelAddressTranslationExtensions | |
puts 'SLAT Available' | |
else | |
puts 'SLAT Not Available' | |
end |
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
require 'net/ssh' | |
# Start Pageant and load your github & server identity keys | |
# :verbose => Logger::DEBUG | |
Net::SSH.start("your ssh server.com", "your username", { :forward_agent => true }) do |ssh| | |
result = ssh.exec!("ls -la ~") | |
puts result | |
# puts 'waiting on open channel...' |
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
var WA_API_KEY = @""; | |
var VoiceOut = new System.Speech.Synthesis.SpeechSynthesizer(); | |
VoiceOut.SelectVoiceByHints(VoiceGender.Female, VoiceAge.Adult, 0, CultureInfo.CurrentCulture); | |
VoiceOut.SetOutputToDefaultAudioDevice(); | |
var WA = new WAClient(WA_API_KEY); | |
WA.OnResultReceived += (WAResult, input) => | |
{ | |
try |
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
Observable.FromEvent<SensorReadingEventArgs<CompassReading>>(compass, "CurrentValueChanged") | |
.BufferWithTime(TimeSpan.FromSeconds(2)) | |
.Select(headings => headings.Select(e => e.EventArgs.SensorReading.TrueHeading).Sum() / headings.Count()) | |
.ObserveOnDispatcher() | |
.Subscribe(heading => this.ArrowRotation.Angle = 360 - heading); |
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
<Image Stretch="None" Source="compass.arrow.dark.png" RenderTransformOrigin="0.5,0.5"> | |
<Image.RenderTransform> | |
<RotateTransform x:Name="ArrowRotation" CenterX="0.5" CenterY="0.5" /> | |
</Image.RenderTransform> | |
</Image> |
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.Diagnostics; | |
using System.Linq; | |
using Microsoft.Devices.Sensors; | |
using Microsoft.Phone.Controls; | |
using Microsoft.Phone.Reactive; | |
namespace Rx_Compass_Smoothing | |
{ | |
public partial class MainPage : PhoneApplicationPage |
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
Observable.FromEvent<SensorReadingEventArgs<CompassReading>>(compass, "CurrentValueChanged") | |
.BufferWithTime(TimeSpan.FromSeconds(2)) | |
.Select(headings => headings.Select(e => e.EventArgs.SensorReading.TrueHeading).Sum() / headings.Count()) | |
.Subscribe(heading => Debug.WriteLine(string.Format("Averaged: {0}", heading))); |
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
Observable.FromEvent<SensorReadingEventArgs<CompassReading>>(compass, "CurrentValueChanged") | |
.BufferWithTime(TimeSpan.FromSeconds(2)) | |
.SelectMany(events => events.Select(e => e.EventArgs.SensorReading.TrueHeading)) |
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.Diagnostics; | |
using System.Linq; | |
using Microsoft.Devices.Sensors; | |
using Microsoft.Phone.Controls; | |
using Microsoft.Phone.Reactive; | |
namespace Rx_Compass_Smoothing | |
{ | |
public partial class MainPage : PhoneApplicationPage |
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.Diagnostics; | |
using Microsoft.Devices.Sensors; | |
using Microsoft.Phone.Controls; | |
using Microsoft.Phone.Reactive; | |
namespace Rx_Compass_Smoothing | |
{ | |
public partial class MainPage : PhoneApplicationPage | |
{ | |
Compass compass = new Compass(); |