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
using System; | |
using System.Globalization; | |
using System.Net; | |
using System.Net.Sockets; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace Socks | |
{ | |
public static class Socks5 |
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
"""============================== | |
Branded IPython Notebook Launcher | |
================================= | |
Executing this module will create an overlay over ipython notebooks own static | |
files and templates and overrides static files and templates and copies over all | |
example notebooks into a temporary folder and launches the ipython notebook server. | |
You can use this to offer an interactive tutorial for your library/framework/... |
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
#include <Wire.h> | |
void setup() { | |
Serial.begin (115200); | |
Serial.println (); | |
Serial.println ("I2C scanner. Scanning ..."); | |
byte count = 0; | |
Wire.begin(); | |
for (byte i = 8; i < 120; i++) |
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
#region KeyFrame Animations | |
ScalarKeyFrameAnimation keyframeAnimation = _compositor.CreateScalarKeyFrameAnimation(); | |
keyframeAnimation.InsertKeyFrame(0.0f, 0.0f); // Optional | |
keyframeAnimation.InsertKeyFrame(1.0f, 360.0f, _compositor.CreateLinearEasingFunction()); | |
keyframeAnimation.Duration = TimeSpan.FromSeconds(3); | |
keyframeAnimation.IterationBehavior = AnimationIterationBehavior.Forever; |
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
// Interpolate between 2 colors in C# | |
// Taken from answer by user Jason | |
// http://stackoverflow.com/questions/1236683/color-interpolation-between-3-colors-in-net | |
class ColorInterpolator { | |
delegate byte ComponentSelector(Color color); | |
static ComponentSelector _redSelector = color => color.R; | |
static ComponentSelector _greenSelector = color => color.G; | |
static ComponentSelector _blueSelector = color => color.B; | |
public static Color InterpolateBetween( |
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
/// Converts Spherical to Cartesian coordinates | |
int earthRadius = 6367; //radius in km | |
private Cartesian convertSphericalToCartesian(double latitude, double longitude) | |
{ | |
var lat = DegreesToRadians(latitude); | |
var lon = DegreesToRadians(longitude); | |
var x = earthRadius * Math.Cos(lat) * Math.Cos(lon); | |
var y = earthRadius * Math.Cos(lat) * Math.Sin(lon); | |
var z = earthRadius * Math.Sin(lat); | |
return new Cartesian(x, y, z); |
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
public static double DegreesToRadians(double degrees) | |
{ | |
return degrees * Math.PI / 180.0; | |
} | |
public static double RadiansToDegrees(double radians) | |
{ | |
return radians * 180.0 / Math.PI; | |
} |
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
/// <summary> | |
/// Returns the distance in miles or kilometers of any two GeoCordinates | |
/// Ref: https://en.wikipedia.org/wiki/Haversine_formula | |
/// </summary> | |
/// <param name="pos1">Location 1</param> | |
/// <param name="pos2">Location 2</param> | |
/// <param name="unit">Miles or Kilometers or Meters</param> | |
/// <returns>Distance in the requested unit</returns> | |
public static double HaversineDistance(LatLng pos1, LatLng pos2, DistanceUnit unit) | |
{ |
NewerOlder