Skip to content

Instantly share code, notes, and snippets.

import { React, window } from "https://deno.land/x/tsx_static@2.0.3/mod.ts";
export type Cycle = {
id: string;
durations?: Record<string, number>;
};
const Box = <div></div>;
const DetailItem = <div></div>;
@lydonchandra
lydonchandra / getReduxStore.js
Created October 17, 2022 06:49
getReduxStore, react v18
// Traverse a dom element
const stores = new Set();
const traverse = (element) => {
let store =
element?.memoizedState?.element?.props?.store
|| element?.pendingProps?.store
|| element?.stateNode?.store;
if (store) {
stores.add(store);
@lydonchandra
lydonchandra / string-comparison.cs
Created October 17, 2022 04:44
string-comparison edge case culture.cs
// https://www.meziantou.net/string-comparisons-are-harder-than-it-seems.htm
Console.WriteLine("The current culture is {0}",
Thread.CurrentThread.CurrentCulture.Name);
//Thread.CurrentThread.CurrentCulture = new CultureInfo("tr-TR");
//// Change the current culture to Portuguese (Brazil).
//Console.WriteLine("Current culture changed to {0}",
// Thread.CurrentThread.CurrentCulture.Name);
import matplotlib.pyplot as plt
x, y = mnist['data'], mnist['target']
digit1 = x.iloc[0]
digit1_image = digit1.values.reshape(28, 28)
plt.imshow(digit1_image, cmap='binary')
plt.axis('off')
plt.show()
[[1631836800000,299.87],[1631750400000,305.22],[1631664000000,304.82],[1631577600000,299.79],[1631491200000,296.99],[1631232000000,295.71],[1631145600000,297.25],[1631059200000,300.21],[1630972800000,300.18],[1630627200000,301.14],[1630540800000,301.15],[1630454400000,301.83],[1630368000000,301.88],[1630281600000,303.59],[1630022400000,299.72],[1629936000000,299.09],[1629849600000,302.01],[1629763200000,302.62],[1629676800000,304.65],[1629417600000,304.36],[1629331200000,296.77],[1629244800000,290.73],[1629158400000,293.08],[1629072000000,294.6],[1628812800000,292.85],[1628726400000,289.81],[1628640000000,286.95],[1628553600000,286.44],[1628467200000,288.33],[1628208000000,289.46],[1628121600000,289.52],[1628035200000,286.51],[1627948800000,287.12],[1627862400000,284.82],[1627603200000,284.91],[1627516800000,286.5],[1627430400000,286.22],[1627344000000,286.54],[1627257600000,289.05],[1626998400000,289.67],[1626912000000,286.14],[1626825600000,281.4],[1626739200000,279.32],[1626652800000,277.01],[1626393600000
@lydonchandra
lydonchandra / download Tests DLL and run dotnet test on it.yml
Created September 18, 2021 02:05
download Tests DLL and run dotnet test on it
- task: DownloadPipelineArtifact@2
inputs:
source: 'specific'
project: 'projectName1'
pipeline: 5432
path: './tests' # destinationPath
runVersion: 'specific'
# use specific runId to troubleshoot
runId: 1433
- task: PowerShell@2
@lydonchandra
lydonchandra / linqpad - specs filter.cs
Last active July 16, 2021 20:25
linqpad - specs filter
void Main()
{
//nameof(UserQuery.Brand).Dump();
//Enum.GetName(UserQuery.Brand.Adidas).Dump();
List<Product> products = new()
{
new Product { Color = Color.Green, Size = Size.Small, Brand = Brand.Adidas },
new Product { Color = Color.Red, Size = Size.Large, Brand = Brand.Adidas },
new Product { Color = Color.Red, Size = Size.Medium, Brand = Brand.Nike },
@lydonchandra
lydonchandra / pipoint_earliest_latest_timestamp.py
Created November 3, 2020 18:14
Get earliest and latest timestamp for PIPoint
import datetime
import glob
import pandas as pd
import datetime as dt
import functools
import os
import sys
@lydonchandra
lydonchandra / nrrd-3d.py
Created October 15, 2020 18:40
Display nrrd as 3d using visvis
import numpy as np
import nrrd
import argparse
import os.path
from argparse import ArgumentParser
import imageio
import visvis as vv
RescaleGrayscale4x4_to_8x8
// floored output
{
0, 0, 0, 1, 1, 2, 2, 3,
1, 2, 2, 2, 3, 3, 4, 4,
3, 3, 4, 4, 5, 5, 5, 6,
5, 5, 6, 6, 6, 7, 7, 8,
6, 7, 7, 8, 8, 9, 9, 9,
8, 8, 9, 9, 10, 10, 11, 11,