Skip to content

Instantly share code, notes, and snippets.

@swvitaliy
swvitaliy / tinkoff_invert_events_csv.js
Created January 4, 2024 12:43
Userscript for creation a button "csv" for printing invest events into browser console as a csv (https://www.tinkoff.ru/invest/portfolios/events/)
// ==UserScript==
// @name tinkoff_invert_events_csv
// @namespace http://tampermonkey.net/
// @version 2024-01-04
// @description Create a button "csv" for printing invest events into browser console as a csv
// @author swvitaliy
// @match https://www.tinkoff.ru/invest/portfolios/events/
// @icon https://www.google.com/s2/favicons?sz=64&domain=tinkoff.ru
// @grant none
// ==/UserScript==
@swvitaliy
swvitaliy / Makefile
Last active September 23, 2023 20:05
build:
g++ -std=c++14 -Wall -O2 -oa a.cpp
naive:
sudo perf stat -B -e cache-misses ./a n
better:
sudo perf stat -B -e cache-misses ./a b
const range = (arr, start, len) => {
len = len || Math.max(0, arr.length - start);
const end = Math.min(arr.length, start + len);
return {
current: start,
length: len,
next: function() {
if (this.current >= end) return {done: true};
else return {done: false, value: arr[this.current++]};
},
@swvitaliy
swvitaliy / ifconfig.go
Created March 7, 2023 13:43
ifconfig.go
package main
//
// Print network interface information
//
import (
"fmt"
"net"
"strings"
@swvitaliy
swvitaliy / README.md
Created November 1, 2022 12:20
Bad nw connection hotfix

One liner - restart nw connection on failed

while true; do nc ya.ru 80 && service network-manager restart; T=$(date '+%H:%m:%S'); echo "${T} restarting"; sleep 10; done

Вместо service network-manager restart можно так же указать

nmcli networking off 
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
namespace SpanBench
{
class Program
{
static void Main(string[] args)
{
//BenchmarkRunner.Run<BenchmarkDemo1>();
using System.Collections.Generic;
using System.Linq;
using System.Diagnostics;
using gudusoft.gsqlparser;
using System;
public static class ParseSql
{
public class ColumnInfo
{
DoctorScheduleExclusion:
table: PL_EXCL
properties:
Id:
column: PL_EXCL_ID
OwnerType:
column: OWNER_TYPE
OwnerId:
column: OWNER_ID
Name:
---------------------------------------------------------------
user join 1 entity:
QUERY PLAN
|--SCAN fts1 VIRTUAL TABLE INDEX 32:M6
|--SEARCH t1 USING INTEGER PRIMARY KEY (rowid=?)
`--SEARCH u USING INTEGER PRIMARY KEY (rowid=?)
real 0m0,248s
user 0m0,239s
---------------------------------------------------------------
1 match:
QUERY PLAN
|--SCAN fts1 VIRTUAL TABLE INDEX 32:M5
|--SEARCH t1 USING INTEGER PRIMARY KEY (rowid=?)
`--SEARCH u USING INTEGER PRIMARY KEY (rowid=?)
real 0m0,173s
user 0m0,158s