Skip to content

Instantly share code, notes, and snippets.

@tilalis
tilalis / wft.py
Created February 6, 2020 12:37
WTFPython
class Provider:
def __init__(self, name):
self.name = name
def __getattr__(self, attr):
return Provider(self.name + '.' + str(attr))
def __rmatmul__(self, other):
return other + '@' + self.name
@tilalis
tilalis / lexer.py
Last active January 21, 2020 14:13
Money Calculator
from money import Money, Currency
from enum import Enum
from string import ascii_letters
class TokenType(Enum):
NAME = 0
NUMBER = 1
MONEY = 2
import System.IO
import Data.Char (toLower)
process :: (Int, Int) -> [Int] -> [[Int]]
process (m, k) tasks = tasks : (process' (m, k) tasks)
process' (m, k) [] = []
process' (m, k) tasks = processed : (process' (m, k) processed) where processed = (drop m tasks) ++ (filter (>0) $ map (subtract k) (take m tasks))
showProcessed :: (Int, Int) -> [[Int]] -> String
showProcessed mk lst = trim (showProcessed' mk lst) ++ "\nTime: " ++ (show $ 6*(length $ tail lst)) ++ "\n"
import requests
import re
from bs4 import BeautifulSoup
#вызываемая функция для каждого раздела
def parse(page):
global kek
htmlPage = requests.get(page)
soup = BeautifulSoup(htmlPage.text , "html.parser")
while (soup.find('a' , id="link-pagination-next")) :
package by.iba.gomel;
import java.util.Scanner;
/**
* This class contains third dimensions array of char and tools for work with this array.
*
*/
public class CharArray {
private final char[][][] arrayOfChar;