Skip to content

Instantly share code, notes, and snippets.

View GeorgiyDemo's full-sized avatar

Demka GeorgiyDemo

View GitHub Profile
@GeorgiyDemo
GeorgiyDemo / pg_stat_statements.sql
Created July 13, 2022 21:09
Check performance of Postgres DB via pg_stat_statements lib
SELECT
substring(query, 1, 50) AS short_query,
round(total_exec_time::numeric, 2) AS total_exec_time,
calls, round(mean_exec_time::numeric, 2) AS mean,
round ((100 * total_exec_time / sum(total_exec_time::numeric) OVER ())::numeric, 2) AS percentage_overall
FROM pg_stat_statements
ORDER BY total_exec_time DESC
LIMIT 35;
import pyautogui
import time
import random
time.sleep(5)
while True:
pyautogui.moveRel(100, 0)
time.sleep(1)
pyautogui.moveRel(0, -100)
time.sleep(1)

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
class ValA:
def __init__(self, obj):
self.obj = obj
def get(self):
return self.obj
def set(self, obj):
self.obj = obj
git rm -r --cached .
git add .
git commit -m "Re index done"
//Подключить namespace
using System.Data.OleDb;
//Добавить поля в класс
public static string connectString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=../../../Exam.mdb;";
private OleDbConnection myConnection;
//Конструктор формы
public MainForm()
{
@GeorgiyDemo
GeorgiyDemo / phpSessionCookie.md
Created November 7, 2018 11:47 — forked from FoggyK/phpSessionCookie.md
Дз по сессиям и кукам

Задачи по сессиям

Примеры решения задач

Задача 1

Сделайте две страницы: index.php и hello.php. При заходе на index.php спросите с помощью формы имя пользователя, запишите его в сессию. При заходе на hello.php поприветствуйте пользователя фразой "Привет, %Имя%!".

Решение:

Страница index.php:

@GeorgiyDemo
GeorgiyDemo / install-poppler-ubuntu.md
Created October 16, 2018 16:09 — forked from Dayjo/install-poppler-ubuntu.md
How to install Poppler on Ubuntu

First install all these prerequisites for compiling:

sudo apt install g++ autoconf libfontconfig1-dev pkg-config libjpeg-dev libopenjpeg-dev gnome-common libglib2.0-dev gtk-doc-tools libyelp-dev yelp-tools gobject-introspection libsecret-1-dev libnautilus-extension-dev

First download the encoding files (no need to compile these) to the current working directory

wget https://poppler.freedesktop.org/poppler-data-0.4.7.tar.gz
@GeorgiyDemo
GeorgiyDemo / test.py
Created October 13, 2018 08:13 — forked from christianroman/test.py
Bypass Captcha using 10 lines of code with Python, OpenCV & Tesseract OCR engine
import cv2.cv as cv
import tesseract
gray = cv.LoadImage('captcha.jpeg', cv.CV_LOAD_IMAGE_GRAYSCALE)
cv.Threshold(gray, gray, 231, 255, cv.CV_THRESH_BINARY)
api = tesseract.TessBaseAPI()
api.Init(".","eng",tesseract.OEM_DEFAULT)
api.SetVariable("tessedit_char_whitelist", "0123456789abcdefghijklmnopqrstuvwxyz")
api.SetPageSegMode(tesseract.PSM_SINGLE_WORD)
tesseract.SetCvImage(gray,api)
print api.GetUTF8Text()
@GeorgiyDemo
GeorgiyDemo / match.py
Created August 21, 2018 14:08 — forked from hdf/match.py
Image matching using OpenCV in Python
from PIL import Image, ImageGrab
import cv2, numpy
img = cv2.cvtColor(numpy.array(ImageGrab.grab()), cv2.COLOR_RGB2BGR)
template = cv2.cvtColor(numpy.array(Image.open('PS/3C.png')), cv2.COLOR_RGB2BGR)
d, w, h = template.shape[::-1]
res = cv2.matchTemplate(img, template, cv2.TM_CCOEFF_NORMED)
#all matches: