Skip to content

Instantly share code, notes, and snippets.

@Tapanhaz
Tapanhaz / AutoCompleteEngine.mkd
Created May 10, 2024 05:21 — forked from aycarl/AutoCompleteEngine.mkd
Stateless Inc. Auto Complete Engine Code Challenge

Auto Complete Engine Code Challenge

by Carl Yao Agbenyega

SUMMARY

This is a python command line program that runs in the console/terminal. The application allows you to search through a file, containing a corpus of texts, to find a list of possible auto-complete options for a search letter/word/phrase based on frequency of their appearance in the file. The search is made using queries that specify the search prefix and a desired maximum number of results/options as output.

INSTALLATION & USAGE

This program can be run on widnows, linux or windows systems with python versions 3.x.x and to run and use:

@Tapanhaz
Tapanhaz / pyside6_uic.py
Created May 10, 2024 04:28 — forked from MadPonyInteractive/pyside6_uic.py
PySide6 class to load .ui files to memory like loadUi in PyQt
"""
This code has a YouTube video associated with it
https://www.youtube.com/watch?v=xKIPPZMP9y4&list=PLuvCsqbtUSFAEmez6Tuyi2KitVcS4fLWX&index=5
"""
import subprocess
import xml.etree.ElementTree as xml
class PySide6Ui:
"""
class to load .ui files to memory or
convert them to .py files
@Tapanhaz
Tapanhaz / qtabwidget.css
Created May 1, 2024 06:52 — forked from espdev/qtabwidget.css
A QTabWidget Custom Stylesheet Example
QTabWidget::pane {
border: 1px solid black;
background: white;
}
QTabWidget::tab-bar:top {
top: 1px;
}
QTabWidget::tab-bar:bottom {
@Tapanhaz
Tapanhaz / QThreadDecorators.py
Created April 25, 2024 09:38 — forked from Vrekrer/QThreadDecorators.py
Easy QT threading using python decorators.
# -*- coding: utf-8 -*-
from PyQt4 import QtCore
from functools import wraps
class Exception_StopQThread(Exception):
pass
class Runnable(QtCore.QRunnable):
def __init__(self, func, args, kwargs):
@Tapanhaz
Tapanhaz / redirect.py
Created April 25, 2024 07:12 — forked from rbonvall/redirect.py
Redirect both stdin and stdout of a process to a PyQt text edit.
from PyQt4 import QtGui, QtCore, uic
def p(x):
print x
class MainWindow(QtGui.QMainWindow):
def __init__(self):
QtGui.QWidget.__init__(self)
uic.loadUi('redirect.ui', self)
@Tapanhaz
Tapanhaz / aho_corasick.py
Created April 12, 2024 19:29 — forked from atdt/aho_corasick.py
Aho-Corasick string matching in Python
# Python implementation of Aho-Corasick string matching
#
# Alfred V. Aho and Margaret J. Corasick, "Efficient string matching: an aid to
# bibliographic search", CACM, 18(6):333-340, June 1975.
#
# <http://xlinux.nist.gov/dads//HTML/ahoCorasick.html>
#
# Copyright (C) 2015 Ori Livneh <ori@wikimedia.org>
#
# Licensed under the Apache License, Version 2.0 (the "License");
@Tapanhaz
Tapanhaz / _init.py
Created February 23, 2024 16:43 — forked from sprusty22/_init.py
from flask import Flask, render_template, redirect, url_for, request, session, flash, g, make_response, send_file
#import flask.ext.login
from flask_login import LoginManager, login_user, logout_user, current_user, login_required
from functools import wraps
import MySQLdb
from MySQLdb import escape_string as thwart
import json
import datetime
from datetime import datetime,timedelta
from time import mktime
@Tapanhaz
Tapanhaz / GetIVGreeks.py
Created February 13, 2024 10:50 — forked from ShabbirHasan1/GetIVGreeks.py
Python Class To Calculate Options IV and Greeks
# -*- coding: utf-8 -*-
"""
:description: Python Class To Calculate Options IV and Greeks
:license: MIT.
:author: Shabbir Hasan
:created: On Thursday December 22, 2022 23:43:57 GMT+05:30
"""
__author__ = "Shabbir Hasan aka DrJuneMoone"
__webpage__ = "https://github.com/ShabbirHasan1"
__license__ = "MIT"
@Tapanhaz
Tapanhaz / abcd.py
Last active May 7, 2024 08:08
Custom logging formatter with colored console outputs and logging to file.
import logging
logger = logging.getLogger(__name__)
def func1():
logger.warning("This is a warning message")
logger.info("This is a info message")
import requests
from io import BytesIO
from http import HTTPMethod
from json import JSONDecoder
from requests import Timeout
from requests import HTTPError
from requests import ConnectionError
from requests import JSONDecodeError
from requests import RequestException
from requests import TooManyRedirects