Skip to content

Instantly share code, notes, and snippets.

View sokol8's full-sized avatar
💭
hacking sport programming

Kostiantyn Sokolinskyi sokol8

💭
hacking sport programming
View GitHub Profile
@sokol8
sokol8 / concurrent_hit.py
Created February 11, 2024 22:10 — forked from rednafi/concurrent_hit.py
1000 concurrent API request with ThreadPoolExecutor Python
import time
from concurrent.futures import ThreadPoolExecutor
from functools import wraps
import requests
from tqdm import tqdm
def timeit(method):
@wraps(method)
@sokol8
sokol8 / download_file.py
Created February 3, 2024 05:50 — forked from ruxi/download_file.py
python download_file with progressbar using request and tqdm
#!/usr/bin/env python
__author__ = "github.com/ruxi"
__license__ = "MIT"
import requests
import tqdm # progress bar
import os.path
def download_file(url, filename=False, verbose = False):
"""
Download file with progressbar
@sokol8
sokol8 / README.md
Created February 3, 2024 05:12 — forked from Bharat-B/README.md
A python script that downloads multiple files in parallel with support for s3:// | http:// | https:// protocols

Python

A script that downloads multiple files in parallel with support for s3:// | http:// | https:// protocols

Description

downloader.py

Usage: python downloader.py url1 url2 url3

@sokol8
sokol8 / randomString.swift
Created January 28, 2023 23:28
Radnom string generation
// based on https://gist.github.com/szhernovoy/276e69eb90a0de84dd90
// and my performance measurements
public func randomString(of length: Int) -> String {
let letters = Array("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
var s = ""
for _ in 0 ..< length {
s.append(letters.randomElement()!)
}
return s
}
@sokol8
sokol8 / executionTimeInterval.swift
Created January 28, 2023 23:20
Calculate execution time for a block of Swift code
// based on gist https://gist.github.com/kristopherjohnson/4201fbe86473f6edb207
// and discussion
// https://forums.swift.org/t/recommended-way-to-measure-time-in-swift/33326/4
// https://github.com/apple/swift-corelibs-xctest/pull/109
// Ensures Monotonic time
public func executionTimeInterval(block: () -> ()) -> TimeInterval {
let start = Foundation.ProcessInfo.processInfo.systemUptime
block();
let end = Foundation.ProcessInfo.processInfo.systemUptime
@sokol8
sokol8 / sublime-text-3-windows-shortcuts.md
Created September 26, 2021 20:35 — forked from mrliptontea/sublime-text-3-windows-shortcuts.md
Sublime Text 3 - Useful Shortcuts (Windows)

Sublime Text 3 - Useful Shortcuts (Windows)

General

Shortcut Description
Ctrl+Shift+P command prompt
Ctrl+Alt+P switch project
Ctrl+P go to file
Ctrl+G go to line