Skip to content

Instantly share code, notes, and snippets.

Avatar

Anton Sokolchenko iSevenDays

View GitHub Profile
@iSevenDays
iSevenDays / ViewModelClosable.swift
Last active Oct 12, 2021
SwiftUI create View Model that emits close action
View ViewModelClosable.swift
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 }
View 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 / BasicTradeStats.py
Created Feb 14, 2021
BasicTradeStats for backtrader
View BasicTradeStats.py
#######################################
# Code: Rich O'Regan (London) Sep 2017
#######################################
import math
import numpy as np
from backtrader import Analyzer
from backtrader.utils import AutoOrderedDict, AutoDict
View TextAlert.swift
//
// 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 Feb 1, 2020
Exclude thumbnail images folder inside apple photo library for Backup and Sync for Google Photos
View gist:8227aca72ac65a7014a028fbdf069c4c
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 Jan 31, 2020
Override Google Backup and Sync performance upload issues
View gist:336cd3d80a158479abc3086738470983
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.
View pyboard.py
#!/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.
View Github repo size in mbytes
git count-objects -vH | grep 'size-pack'
@iSevenDays
iSevenDays / NavBarTitleView-titleView-height-error.m
Last active Feb 9, 2016
UINavigationBar titleView changes its height(or becomes prompt) after push view controller
View NavBarTitleView-titleView-height-error.m
- (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 Feb 9, 2016
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console