Skip to content

Instantly share code, notes, and snippets.

View DmitriyVlasov's full-sized avatar

Dima Vlasov DmitriyVlasov

View GitHub Profile
@DmitriyVlasov
DmitriyVlasov / latency.markdown
Created December 8, 2015 07:22 — forked from valadan/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@DmitriyVlasov
DmitriyVlasov / system.windows.forms.powerstatus.fsx
Created June 30, 2016 10:34
Пример работы с классом PowerStatus из WinForms
// https://msdn.microsoft.com/ru-ru/library/system.windows.forms.powerstatus(v=vs.110).aspx
// http://www.codeproject.com/Articles/30414/Getting-Started-in-F-A-Windows-Forms-Application
open System
open System.Drawing
open System.Windows.Forms
type MainForm() as form =
inherit Form()
// Define private variables
@DmitriyVlasov
DmitriyVlasov / GIF-Screencast-OSX.md
Created October 13, 2016 22:47 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@DmitriyVlasov
DmitriyVlasov / DeedleFormatter.fsx
Created November 20, 2017 13:54 — forked from mndrake/DeedleFormatter.fsx
Deedle Series and IFrame formatter for IFSharp
#I "../lib"
#r "FSharp.Markdown.dll"
#r "FSharp.Literate.dll"
#r "Deedle.dll"
open System.IO
open Deedle
open Deedle.Internal
open FSharp.Literate
open FSharp.Markdown
@DmitriyVlasov
DmitriyVlasov / Power BI dax shortcut keys.md
Last active June 22, 2018 08:06
Power BI dax shortcut keys (Russian)

Памятка по сочетаниям клавиш окна редактирования DAX формул Microsoft Power BI

Базовое редактирование

Клавиша Описание
Ctrl+X Вырезать строку (Пустое выделение)
Ctrl+C Скопировать строку (Пустое выделение)
Alt+↑ Alt+↓ Перемещает текущую строку вверх / вниз
Shift+Alt+↑ Shift+Alt+↓ Копирует строку и вставляет её выше / ниже
@DmitriyVlasov
DmitriyVlasov / ExampleDaxMeasureSVG.dax
Last active August 9, 2018 09:49
Example Create DAX Measure generate sparkline with SVG
Sparkline Line =
// Sample get from: https://powerbi.microsoft.com/en-us/blog/power-bi-desktop-august-2018-feature-summary/
// Formared width: http://www.daxformatter.com/
// Issue: SparlineMeasure var won't work when referenced (all bars end up 100%)
// Issue: Refactor to avoid nested SUMMARIZEs
// Issue: Negative values currently will not appear
VAR SparklineMeasure =
SUM ( Sales[SalesAmount] ) // don't use this below per issue above
VAR SparklineMeasureTarget =
Sparkline Line =
// Static line color - use %23 instead of # for Firefox compatibility
VAR LineColor = "%2301B8AA"
// "Date" field used in this example along the X axis
VAR XMinDate = MIN('Table'[Date])
VAR XMaxDate = MAX('Table'[Date])
// Obtain overall min and overall max measure values when evaluated for each date
// Пример использования функции получения Производственного календаря:
//
// источник взят отсюда: http://data.gov.ru/opendata/7708660670-proizvcalendar
// На момент 24.05.2018 в календаре содержатся описание праздников с 1999 года по 2025 год.
//
// let
// PROD_СALENDAR_URL =
// "https://data.gov.ru/opendata/7708660670-proizvcalendar/data-20181017T0930-structure-20181017T0930.csv?encoding=UTF-8",
// ProductionCalendar = getProductionCalendar( PROD_СALENDAR_URL )
// in
@DmitriyVlasov
DmitriyVlasov / fable-repl.css
Last active March 29, 2019 19:53
Minimal application showing how to use Elmish
html,
body {
font-size: 16px;
}
.main-container {
display: flex;
width: 100%;
height: 100%;
justify-content: center;
// На большом объеме данных так работает плохо!!!
var date_time_text = format( 'fact_data'[moment]; "dd.MM.yyyy hh:00:00" )
var current_date = DATEVALUE( date_time_text )
var current_time = timeVALUE( date_time_text )
var curent_datetime = current_date + current_time
return curent_datetime