Skip to content

Instantly share code, notes, and snippets.

View OlegKorn's full-sized avatar
💭
SEEK FOR A JUNIOR QA JOB

O OlegKorn

💭
SEEK FOR A JUNIOR QA JOB
View GitHub Profile
@OlegKorn
OlegKorn / 1
Created February 5, 2024 06:51
async notes
https://github.com/aio-libs/aiohttp/issues/955
https://stackoverflow.com/questions/51887784/using-aiohttp-with-proxy
https://superfastpython.com/python-async-requests/#Requests_Block_the_Asyncio_Event_Loop_this_is_bad
@OlegKorn
OlegKorn / semaphor_asyncio.py
Created February 5, 2024 01:06
something with semaphor asyncio requests
urls = open_file(0, 500) #array of urls
async def fetch_url(i, url, semaphore):
async with semaphore:
async with httpx.AsyncClient() as client:
reply = await client.get(url)
print(f'got {url}')
return i, reply
@OlegKorn
OlegKorn / any_list_elem_in_str.py
Created February 3, 2024 09:07
check if not any element of list in string
str = 'string'
list = [.....]
if not any(list_elem in str for list_elem in list):
do
import pandas as pd
import openpyxl
# maybe in loop
for i in data: # let i == [a, b]
df = pd.DataFrame(
[[a, b]],
columns=['Title1', 'Title2']
)
var lengthOfLongestSubstring = function(s, len=undefined) {
// check if all chars same
if (!len) {
if (s.length !== 0) {
const arr = [...s]
const allEqual = arr => arr.every(val => val === arr[0])
if (allEqual(arr)) {
return 1
}
@OlegKorn
OlegKorn / areAllCharsOfAStringSame.js
Created October 20, 2022 04:35
JS - check if all chars of string are same
s = "bbbb"
const arr = [...s]
const allEqual = arr => arr.every(val => val === arr[0])
if (allEqual(arr) {
return true
}
/*
Write a function to find the longest common prefix
string amongst an array of strings.
If there is no common prefix, return an empty string "".
Example 1:
Input: strs = ["flower","flow","flight"]
Output: "fl"
/*
nums1.length == m
nums2.length == n
0 <= m <= 1000
0 <= n <= 1000
1 <= m + n <= 2000
-10**6 <= nums1[i], nums2[i] <= 10**6
*/
var findMedianSortedArrays = function(nums1, nums2) {
/*
author Oleg Kornilov
[email protected]
Runtime: 2025 ms, faster than 11.72% of JavaScript online submissions for Longest Palindromic Substring.
Memory Usage: 52 MB, less than 12.11% of JavaScript online submissions for Longest Palindromic Substring.
*/
var longestPalindrome = function(s) {
@OlegKorn
OlegKorn / palindrom.js
Created October 12, 2022 07:07
leetcode - Palindrom.js
/*
author Oleg Kornilov
[email protected]
github.com/OlegKorn
https://leetcode.com/problems/palindrome-number/solution/
*/
var isPalindrome = function(x) {
x = x.toString()