Skip to content

Instantly share code, notes, and snippets.

View ArjixWasTaken's full-sized avatar

Angelos Bouklis ArjixWasTaken

  • Greece
  • 05:47 (UTC +02:00)
View GitHub Profile
@ArjixWasTaken
ArjixWasTaken / main.py
Created November 25, 2021 22:06
Tic Tac Toe! in python
from typing import List
from itertools import cycle
from os import system as run_cmd
def get_player_id():
id = 1
while 1:
yield id
id += 1
@ArjixWasTaken
ArjixWasTaken / configurer.py
Last active October 30, 2021 23:01
A decorator that saves and loads config.
import click
import json
import sys
import os
class Configurer:
executable = os.path.abspath(sys.argv[0])
def save(func, *args, **kwargs):
@ArjixWasTaken
ArjixWasTaken / json2kotlin.py
Last active August 21, 2021 18:02
Converts any valid python data to its kotlin counterpart. (only works with native python data types)
def escape(string):
if ('"' in string):
return '"""{}"""'.format(string)
return '"{}"'.format(string)
def listToListOf(list_):
out = []
for x in list_:
if type(x) in (int, float):
@ArjixWasTaken
ArjixWasTaken / requests.js
Last active July 19, 2021 20:44
An attempt to make the fetch api easier in JS by imitating python's requests module.
// Copyright 2021 ArjixWasTaken
const isArray = (obj) => Array.isArray(obj);
const isDict = (obj) => {
if (typeof obj === "object" && !isArray(obj)) return true;
return false;
};
const isDictEmpty = (obj) => {
from bs4 import BeautifulSoup # pip install bs4
import re
with open(r"PATH/TO/CHAPTERS/XML/FILE.xml", 'r') as f:
soup = BeautifulSoup(f.read(), 'html.parser')
chapters = soup.select('editionentry > chapteratom')
chapters_array = []
# This is a wrapper for my API that scrapes Yify (yts.mx)
# Import the API
from YifyAPI.yify import search_yify as search # pip install YifyAPI
# Import the table
from tabulate import tabulate # pip install tabulate
# Import other utilities
import click, os # pip install click