Skip to content

Instantly share code, notes, and snippets.

View p0poff's full-sized avatar
💭
pressing keys

p0poff

💭
pressing keys
View GitHub Profile
import requests
import concurrent.futures
# https://www.digitalocean.com/community/tutorials/how-to-use-threadpoolexecutor-in-python-3-ru
def get_wiki_page_existence(wiki_page_url, timeout=10):
response = requests.get(url=wiki_page_url, timeout=timeout)
page_status = "unknown"
if response.status_code == 200:
page_status = "exists"
from pymongo import MongoClient
# Подключение к MongoDB
client = MongoClient('mongodb://localhost:27017/')
db = client['mydatabase']
collection = db['mycollection']
# Размер чанка
chunk_size = 100
# Подключение к MongoDB
client = MongoClient('mongodb://localhost:27017/')
db = client['mydatabase']
collection = db['mycollection']
# Размер чанка
chunk_size = 100
# Функция для обработки чанка данных
def process_chunk(chunk):
data = {
'morning': [
'Волшебного вам утра!',
'Бодрого утра!',
'Солнечного настроения на весь день!',
'Привет! Как спалось?',
'Хорошего дня!',
'Приветствую! Нас ждут великие дела!',
'Удачного начала нового дня!',
'Гармоничного вам состояния души на весь сегодняшний день!',
@p0poff
p0poff / go_postgres.py
Last active March 11, 2022 07:38
go_postgres,py
from pg import DB
class db_query:
def __init__(self, auth):
self.auth = auth
self.connect()
def __del__(self):
try:
self.db.close()
@p0poff
p0poff / auth_crm.py
Created March 11, 2022 07:34
auth_crm.py
def get_param_auth(param):
auth = {}
auth['dev'] = { 'host':'34.253.183.224',
'port':5434,
'user':'crmfeature',
'passwd':'Rt8ipeeghwswdel',
'db':'crm_feature',
'charset':'utf8'}
@p0poff
p0poff / crypt_db.py
Created March 11, 2022 07:32
crypt_db.py
import argparse
import go_postgres
import auth_crm
from Crypto import Random
from Crypto.Cipher import AES
import base64
import time
from concurrent.futures import ThreadPoolExecutor
WORKERS = 50
@p0poff
p0poff / import.py
Created September 6, 2021 21:07
import
import importlib
__conf = importlib.import_module('config.conf')
conf = __conf.getConf(path='config.yaml')
@p0poff
p0poff / curl.md
Last active July 5, 2021 15:26 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

{"phrases": [
{
"phrase":"ТЗ на одном листике было",
"link":"http://devanswers.ru/a/lb"
},
{
"phrase":"Там не сразу сервер отвечает",
"link":"http://devanswers.ru/a/ge"
},
{