Skip to content

Instantly share code, notes, and snippets.

View tirinox's full-sized avatar
🎯
Focusing

TRX1 tirinox

🎯
Focusing
View GitHub Profile
# Prints pseudo 3D image in ASCII
import shutil
c, r = shutil.get_terminal_size()
print(''.join(('*' if (j-c/2) % (i+1) == 1 else '-' if 4*r/(i+1)%2==0 else ' ') for i in range(r) for j in range(c)), end='')
text = """
We develop a methodology for automatically analyzing text to aid in discriminating firms that encounter catastrophic
financial events. The dictionaries we create from Management Discussion and Analysis Sections (MD&A) of 10-Ks
discriminate fraudulent from non-fraudulent firms 75% of the time and bankrupt from nonbankrupt firms 80% of the
time. Our results compare favorably with quantitative prediction methods. We further test for complementarities by
merging quantitative data with text data. We achieve our best prediction results for both bankruptcy (83.87%) and
fraud (81.97%) with the combined data, showing that that the text of the MD&A complements the quantitative financial
information.
"""
import random
from flask import Flask, request
class Game:
X = 'X'
O = 'O'
N = ' '
def __init__(self, size=3, to_win=3):
import random
from flask import Flask, request
class Game:
X = 'X'
O = 'O'
N = ' '
def __init__(self, size=3, to_win=3):
import random
class ASCIICanvas:
def __init__(self, w=50, h=100):
assert 0 < w < 1000 and 0 < h < 1000
self.w = w
self.h = h
self.buffer = []
self.clear()
# this is Radix sort prove of O(n) time complexity
import random
import matplotlib.pyplot as plt
import time
def radix_sort(a_list, radix=10):
max_length_achieved = False
tmp, placement = -1, 1
# это пример показывает применение __matmul__ и __imatmul__ для пользовательских классов
class MyMatrix:
def __init__(self, data):
self.data = data
# для получения элементов матрицы как A[строка, столбец]
def __getitem__(self, pos):
i, j = pos
return self.data[i][j]
import operator
class Item:
def __init__(self, name, price, qty):
self.name = name
self.price = price
self.qty = qty
def total_cost(self):
import socket
import select
from urllib.parse import urlsplit
def brutal_download(url, save_to):
url_components = urlsplit(url)
host = url_components.netloc
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, 80))
import hashlib
import ecdsa
import os
from binascii import hexlify
from base58 import b58encode
# Installation:
# pip install base58 ecdsa
# Use that service to make sure that this generator works well: