Skip to content

Instantly share code, notes, and snippets.

View Snegovikufa's full-sized avatar
📍
Push the red button

Rustam Safin Snegovikufa

📍
Push the red button
View GitHub Profile
@Snegovikufa
Snegovikufa / ReadHistoryDlg.cs
Created August 26, 2013 02:31
OPC UA how to read raw history values
private void ReadRaw(bool isReadModified)
{
ReadRawModifiedDetails details = new ReadRawModifiedDetails();
details.StartTime = DateTime.MinValue;
details.EndTime = DateTime.MinValue;
details.IsReadModified = isReadModified;
details.NumValuesPerNode = 0;
details.ReturnBounds = ReturnBoundsCK.Checked;
if (StartTimeCK.Checked)
@Snegovikufa
Snegovikufa / gist:6349066
Created August 27, 2013 02:37
OPC Ua write attribute value
WriteValueCollection nodesToWrite = new WriteValueCollection(1)
{
new WriteValue
{
NodeId = new NodeId("REQUIREDNODEID"),
AttributeId = Attributes.Description,
Value = new DataValue(new LocalizedText("ASDASDAD")),
}
};
using System.Collections.Generic;
namespace KSoft.Asodu.TrendAnalyzer
{
public class Simplify
{
public static double[][] simplify(double[][] points, double tolerance)
{
double sqTolerance = tolerance * tolerance;
@Snegovikufa
Snegovikufa / Simplify.cs
Created September 9, 2013 02:06
Douglas-Peucker point simplification
using System.Collections.Generic;
namespace KSoft.Asodu.TrendAnalyzer
{
public class Simplify
{
public static double[][] simplify(double[][] points, double tolerance)
{
double sqTolerance = tolerance * tolerance;
@Snegovikufa
Snegovikufa / ChartAnnotation.cs
Last active September 4, 2024 00:49
How to move winforms chart annotation to values under mouse position
using System.Windows.Forms.DataVisualization.Charting;
public void Chart_Load() {
// Create new ChartArea
CalloutAnnotation calloutAnnotation1 = new CalloutAnnotation();
calloutAnnotation1.AxisX = chart.ChartAreas[0].AxisX;
calloutAnnotation1.AxisY = chart.ChartAreas[0].AxisY;
calloutAnnotation1.CalloutAnchorCap = LineAnchorCapStyle.None;
calloutAnnotation1.Name = "SnowAnnotation";
private float? ParseFloat(string floatLike)
{
float f;
if (float.TryParse(floatLike, NumberStyles.Float, CultureInfo.InvariantCulture, out f)) {
return f;
}
return null;
}
/*
Some simple Github-like styles, with syntax highlighting CSS via Pygments.
*/
body{
font-family: helvetica, arial, freesans, clean, sans-serif;
color: #333;
background-color: #fff;
border: none;
line-height: 1.5;
margin: 2em 3em;
@Snegovikufa
Snegovikufa / sublime.txt
Last active October 24, 2017 09:34
Visual Studio Sublime Text external tool
Command: C:\Program Files\Sublime Text 3\sublime_text.exe
Arguments: $(ItemPath):$(CurLine):$(CurCol)
Initial directory: $(ItemDir)
@Snegovikufa
Snegovikufa / prop.snippet
Created January 28, 2014 10:18
ReSharper snippet for property with backing field
public $CoolPropertyClass$ $CoolProperty$
{
get { return $coolField$; }
set {
$coolField$ = value;
OnPropertyChanged("$CoolProperty$");
}
}
private $CoolPropertyClass$ $coolField$;
@Snegovikufa
Snegovikufa / code_example.snippet
Last active January 4, 2016 19:09
Resharper snippet for code example
/// <example>
/// <code>
/// <![CDATA[<StackPanel />]]>
/// </code>
/// </example>