Skip to content

Instantly share code, notes, and snippets.

View iSevenDays's full-sized avatar

Anton Sokolchenko iSevenDays

View GitHub Profile
@iSevenDays
iSevenDays / gist:4583750a17ee453783cbaa3acd4ab5fc
Created August 8, 2025 16:58
Qwen3-480b-A32b chat template for tool calling
{#- Copyright 2025-present Anton Sokolchenko. #}
{#- Licensed under the Apache License, Version 2.0 (the "License") #}
{#- Edits made by Anton Sokolchenko to fix the chat template #}
{% macro render_item_list(item_list, tag_name='required') %}
{%- if item_list is defined and item_list is iterable and item_list | length > 0 %}
{%- if tag_name %}{{- '\n<' ~ tag_name ~ '>' -}}{% endif %}
{{- '[' }}
{%- for item in item_list -%}
{%- if loop.index > 1 %}{{- ", "}}{% endif -%}
{%- if item is string -%}
@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 / 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 / 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;