Skip to content

Instantly share code, notes, and snippets.

View gormih's full-sized avatar
🧸
bear

Michael Alexeevich gormih

🧸
bear
View GitHub Profile
@gormih
gormih / python_logging_sqlite_handler.py
Last active January 20, 2022 08:45 — forked from giumas/Logging - SQLite handler
A minimal SQLite handler for the python logging module
import sqlite3
import logging
import time
__version__ = "0.2.0"
initial_sql = """CREATE TABLE IF NOT EXISTS log(
TimeStamp TEXT,
Source TEXT,
from win32com import client
def process_sql_in_mdb(mdb_file_path: str, sql: str):
'''
:param mdb_file_path: Full path to .mdb file
:param sql: sql query
:return: row set for db
'''
connection = client.Dispatch(r'ADODB.Connection')
row_set = client.Dispatch(r'ADODB.Recordset')
import requests
from PIL import Image
from playsound import playsound
oauth_url = 'https://oauth.yandex.com/token'
client_id = 'iddddddd'
client_secret = 'secret'
username = '[email protected]'
password = 'passowrd'
@gormih
gormih / img-sound-to-video.sh
Created January 10, 2021 17:06 — forked from orjanv/img-sound-to-video.sh
Use ffmpeg to create a video of a picture and a sound file
ffmpeg -loop 1 -i image.jpg -i audio.wav -c:v libx264 -tune stillimage -c:a aac -strict experimental -b:a 192k -pix_fmt yuv420p -shortest out.mp4
from github import Github
account = Github('username', 'password')
repo = account.get_repo('username/your_public_repository')
repo.create_file("new_file.txt", "init commit", "file_content ------ ")
@gormih
gormih / remove me from repositories.py
Last active September 2, 2020 14:16
Remove user from all repositories, exclude allowed owners.
from github import Github
def go_github():
allowed_acc = ['allowed_friend1', 'allowed_friend2', 'username']
account = Github("username", "password")
for repo in account.get_user().get_repos():
owner = repo.owner.login
if owner not in allowed_acc:
print(owner)
repo.remove_from_collaborators('username')
# -*- coding: utf-8 -*-
import requests
from stem import Signal
from stem.control import Controller
import time
class TorSession(object):
from django.core.management.base import BaseCommand, CommandError
from django.db import connection, connections
from django.db.utils import OperationalError
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('target_base', nargs='+', type=str)
import psycopg2
import random
num_iterations = 1000
db = 'domains'
host = '127.0.0.1'
pwd = 'topsecretmegapassword'
conn = psycopg2.connect(database=db,
user=db,
password=pwd)
def s_p_s_result(my, enemy):
if my == enemy:
return 'Ничья'
elif (my, enemy) in [('Ножницы', 'Бумага'), ('Камень', 'Ножницы'), ('Бумага', 'Камень')]:
return 'Ты победил'
else:
return 'Я выиграл'