Skip to content

Instantly share code, notes, and snippets.

Avatar

Max Kovalovs max-kov

View GitHub Profile
View dijkstra.py
num = int(input())
verteces = int(input())
data = [[-1]*(verteces+1) for i in range(verteces+1)]
for i in range(num):
indata = [int(i) for i in input().split()]
data[indata[0]][indata[1]] = indata[2]
current = 1
@max-kov
max-kov / parse.py
Last active Oct 11, 2017
Letter parser for text files
View parse.py
from string import ascii_lowercase
from collections import Counter
import matplotlib.pyplot as plt
import operator
import numpy as np
import glob
my_counter = Counter()
# for filename in glob.iglob(/home/max/*.txt):
@max-kov
max-kov / analysis.py
Last active May 21, 2020
Cambridge colleges admissions scraper and analyser
View analysis.py
import colorsys
import pandas as pd
from scipy.stats import beta
from matplotlib import pyplot as plt
import math
import numpy as np
import matplotlib.patches as mpatches
@max-kov
max-kov / scraper.py
Created Jul 16, 2017
dr frost maths python point farmer
View scraper.py
import requests
from BeautifulSoup import BeautifulSoup
import dryscrape
import time
url = "http://www.drfrostmaths.com/homework/do-question.php?aaid=161230"
sess = dryscrape.Session()
sess.visit("http://www.drfrostmaths.com/homework/login.php")
name = sess.at_xpath('//*[@name="login-email"]') # Where <input name="username">
name.set("email here")
@max-kov
max-kov / maxs_bot.py
Created Jun 22, 2017
my bot for discord i made, sensitive data replaced with --...--
View maxs_bot.py
from cleverwrap import CleverWrap
import discord
from discord.ext.commands import Bot
import wolframalpha
at_max_id = "--MY ID--"
at_bot_id = "--BOT ID--"
cb = CleverWrap("--cb id--")
token = "--chat token--"
my_bot = Bot(command_prefix="!")
@max-kov
max-kov / main.py
Last active May 21, 2020
The two guy problem
View main.py
import pygame
import math
start_x = 50
start_y = 150
start_dist = 300
top_guy = [start_x,start_dist+start_y]
bottom_guy = [start_x,start_y]
vel = 0.1
angle = 0
@max-kov
max-kov / csanalysis.tex
Created May 9, 2017
my cs analysis in latex
View csanalysis.tex
\documentclass{article}
\usepackage{titlesec}
\titleformat{\section}{\huge\bfseries}{}{}{}
\setlength{\parindent}{4em}
\setlength{\parskip}{1em}
\begin{document}
\author{Maksims Kovalovs}
\title{Computer science programming project}
@max-kov
max-kov / circles3
Created Mar 21, 2017
circle rolling in another circle
View circles3
import pygame
import numpy as np
# change these values
points = 50000
radius1 = 100.0
radius2 = 70.0
point_disp = 100.0
angle_ratio =radius1/radius2
@max-kov
max-kov / circles2.py
Created Mar 21, 2017
drawing circles on a circle (which is moving)
View circles2.py
import pygame
import numpy as np
# change these values
points_temp = 1000
radius1 = 100
radius2 = 100
angular_speed_1 = 0.01
angular_speed_2 = 0.0002
View circles.py
import pygame
import numpy as np
# change these values
points = 10000
circles = 30.0
radius = 200.0
resolution = np.array([1000, 500])