This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NOTE. I'm not a python developer, so my solution may be not optimal | |
# Feel free to use it. But, please star it, so I could see someone found it useful. | |
import boto3 | |
import gzip | |
from io import BytesIO, RawIOBase | |
class UploadToS3Stream(RawIOBase): | |
def __init__(self, s3, bucket_name, remote_path): | |
self.s3 = s3 | |
self.bucket_name = bucket_name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
! Убрать из ленты блок "короткие видео" | |
vk.com##.ShortVideoFeedBlock.page_block | |
vk.com##.feed_row:has(.VideosFeedTitle) | |
! Убрать из ленты блок "рекомендуемые группы" | |
vk.com##.feed_groups_recomm | |
! Убрать что-то там связанное с футболом из меню. Вроде можно скрывать через настройки, но так тоже. | |
vk.com##.feed_section_football._ui_item_football._ui_rmenu_subitem.ui_rmenu_subitem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = 'a'..'z' | |
b = 1..1000 | |
x = a.lazy.map { |x| puts "x-#{x}"; b.lazy.map { |y| puts "y-#{y}"; [x, y] } }.flat_map(&:itself); | |
y = a.lazy.map { |x| puts "y-#{x}"; b.lazy.map { |y| puts "y-#{y}"; [x, y] } }.flat_map(&:itself).take(2); | |
> x.select { |xx| y.include?(xx) }.any? | |
x-a | |
y-1 | |
y-a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ruby version of Siderite's fast and accurate string distance algorith described here: | |
# | |
# http://siderite.blogspot.com/2007/04/super-fast-and-accurate-string-distance.html | |
class StringTools | |
def self.sift3distance(s1, s2, maxOffset, maxDistance) | |
if (s1.try(:length) || 0) == 0 | |
return s2.try(:length) || 0 | |
end | |
if (s2.try(:length) || 0) == 0 |