Skip to content

Instantly share code, notes, and snippets.

View mvacha's full-sized avatar

Michal Vácha mvacha

View GitHub Profile
@mvacha
mvacha / CachedTasks.cs
Last active July 18, 2024 15:26
Cached Tasks
// See https://aka.ms/new-console-template for more information
using System.Runtime.CompilerServices;
Console.WriteLine("Program started");
var cache = new Dictionary<string, object>();
//Use lambda, so the task does not start immediately
Func<Task<string>> taskFactory = async () =>
{
d3.select(window).on("resize", resize);
var margin = {top: 20, right: 20, bottom: 30, left: 40};
var viewWidth = window.innerWidth;
var viewHeight = window.innerHeight;
var width = viewWidth - margin.left - margin.right;
var height = viewHeight - margin.top - margin.bottom;
OURS: need update fun challenge desperately need update pay allie level september 1 still new level soon new level week update use favorite
ORIG: need to be updated be fun & challenging desperately need of update pay for allie level september 1 still no new levels- when soon?? no new level of week no updates use to be favorite
---------------------------------
OURS: good let make but cannot share anything like instagram please fix soon
ORIG: no good will let make but cant share to anything like instagram!! (( please fix this soon
---------------------------------
OURS: album function need improvement current version open up possible folders includ cache file should selectable settings avoid unnecessary browse result low productivity
ORIG: album function need improvement current version open all possible folder which includ cache file which should be selectable from setting to avoid unnecessary browse result low productivity
---------------------------------
OURS: can not edit pdf wanna note something pdf b
static Compilation Compile(string code)
{
var parserOptions = new CSharpParseOptions(languageVersion: LanguageVersion.CSharp7);
var parsedTree = CSharpSyntaxTree.ParseText(code, options: parserOptions);
//Assert parser success
Debug.Assert(!parsedTree.GetRoot().HasErrors());
//Enable flow-analysis feature flag
var options = parsedTree.Options.WithFeatures(new[] { new KeyValuePair<string, string>("flow-analysis", "true") });
@mvacha
mvacha / ThresholdingAlgo.cs
Created July 21, 2017 18:01
C# implementation of Thresholding algorithm used for peek (and through) detection from https://stackoverflow.com/questions/22583391/peak-signal-detection-in-realtime-timeseries-data/22771985
/// <summary>
/// Algo from: https://stackoverflow.com/questions/22583391/peak-signal-detection-in-realtime-timeseries-data/22771985
/// </summary>
public static (IList<double> avg, IList<double> sd, IList<int> detected)
ThresholdingAlgo(this IList<double> values, int windowSize, double threshold, double influence){
//number in constructor represent capacity, not size
var avg = new List<double>(values.Count);
var mad = new List<double>(values.Count);
var filteredValues = new List<double>(values.Count); //used for calculating avg and sd
@mvacha
mvacha / PeakDet.cs
Created July 17, 2017 02:00
C# implementation of PeakDet algorithm from: http://www.billauer.co.il/peakdet.html
public static IList<(int pos, double val)> PeakDet(this IList<double> vector, double triggerDelta)
{
double mn = Double.PositiveInfinity;
double mx = Double.NegativeInfinity;
int mnpos = 0;
int mxpos = 0;
bool lookformax = true;
var maxtab_tmp = new List<(int pos, double val)>();
//var mintab_tmp = new List<(int pos, double val)>();
using Newtonsoft.Json;
using PipeGuard.Data.Code;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace PipeGuard.Data.Services
{
public class ConfigService
10:00-12:00 Športovský palác
14:00-17:00 Budova Elektrických podniků
14:00 Bydlení na Letné
16:00 Veletržní palác
18:00 Nová budova - Národní muzeum
@mvacha
mvacha / bc.cs
Created September 27, 2016 15:00
using System;
using Gamanet.C4;
using Gamanet.C4.DriverFramework;
using Gamanet.C4.Logging;
using Gamanet.C4.DriverFramework.Communication;
using System.Collections.Generic;
using System.Linq;
namespace NetGlade.C4Driver.Devices
{
public static T GetVisualChildByType<T>(this DependencyObject referenceVisual) where T : DependencyObject
{
DependencyObject child = null;
for (Int32 i = 0; i < VisualTreeHelper.GetChildrenCount(referenceVisual); i++)
{
child = VisualTreeHelper.GetChild(referenceVisual, i) as DependencyObject;
if (child != null && child is T)
{
break;
}