Skip to content

Instantly share code, notes, and snippets.

View iSevenDays's full-sized avatar

Anton Sokolchenko iSevenDays

View GitHub Profile
@iSevenDays
iSevenDays / BasicTradeStats.py
Created February 14, 2021 12:10
BasicTradeStats for backtrader
#######################################
# Code: Rich O'Regan (London) Sep 2017
#######################################
import math
import numpy as np
from backtrader import Analyzer
from backtrader.utils import AutoOrderedDict, AutoDict
@iSevenDays
iSevenDays / ViewModelClosable.swift
Last active October 12, 2021 10:40
SwiftUI create View Model that emits close action
import Foundation
import Combine
import SwiftUI
/// View Model closable protocol - conform to this protocol if your view model should emit close block to close the screen that uses this view model
public protocol ViewModelClosableProtocol {
var closeCancellable: AnyCancellable? { get set }
// when inheriting protocol, set @Published
// var shouldCloseView: Bool { get set }
@iSevenDays
iSevenDays / get_feed_for_csv_path.py
Created February 14, 2021 12:11
get_feed_for_csv_path.py
import backtrader as bt
from backtrader.feeds import GenericCSVData
class GenericCSV_Signal(GenericCSVData):
# Add a 'pe' line to the inherited ones from the base class
lines = ('autoencoder_signal',)
# auto encoder signal in GenericCSVData has index 8 ...
@iSevenDays
iSevenDays / TextAlert.swift
Last active August 7, 2020 10:01 — forked from chriseidhof/TextAlert.swift
TextAlert
//
// ContentView.swift
//
// Created by Chris Eidhof on 20.04.20.
// Copyright © 2020 objc.io. All rights reserved.
//
// Updated by Anton Sokolchenko for Xcode 12 Beta 4
import SwiftUI
import UIKit
@iSevenDays
iSevenDays / gist:8227aca72ac65a7014a028fbdf069c4c
Created February 1, 2020 23:18
Exclude thumbnail images folder inside apple photo library for Backup and Sync for Google Photos
Workaround thumbnail images, metadata junk photos from apple photo library.
Tested on mac os mojave
You cannot move Masters out of the library using symlinks, BUT you can have symlinks INSIDE the .photolibrary?
What's the idea? We will have .photolibrary INSIDE .photolibrary
The folder structure
@iSevenDays
iSevenDays / gist:336cd3d80a158479abc3086738470983
Created January 31, 2020 20:17
Override Google Backup and Sync performance upload issues
This overrides performance settings defined in site-packages/common/feature_switch_manager.py
Aren't default settings perfect? Default settings were not able to upload 200 000 files within 3 days.
There were some interruptions and the app had to re-verify everything from scratch.
Go to Contents/MacOS folder and execute
./Backup\ and\ Sync --max_batch_upload_files=300 --max_sha1_match_batch_size=500 --telemetry_enabled=0 --token_bucket_read_qps=30 --token_bucket_write_qps=20 --num_workers=10
max_batch_upload_files = Maximum number of files to include in a batch upload.
max_sha1_match_batch_size = Maximum number of sha1 match requests in a batch.
#!/usr/bin/env python
#from __future__ import print_function
"""
pyboard interface
This module provides the Pyboard class, used to communicate with and
control the pyboard over a serial USB connection.
@iSevenDays
iSevenDays / Github repo size in mbytes
Created March 4, 2016 15:49
Github repo size in mbytes
git count-objects -vH | grep 'size-pack'
@iSevenDays
iSevenDays / NavBarTitleView-titleView-height-error.m
Last active February 9, 2016 10:13
UINavigationBar titleView changes its height(or becomes prompt) after push view controller
- (void)viewDidLoad {
[super viewDidLoad];
// some custom view
UIView *navTitle = [[UIView alloc] initWithTopTitle:tag middleTitle:loggedIn frame:frame];
self.navigationItem.prompt = nil;
@iSevenDays
iSevenDays / 0_reuse_code.js
Created February 9, 2016 10:05
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console