Skip to content

Instantly share code, notes, and snippets.

View JanneSalokoski's full-sized avatar

Janne Salokoski JanneSalokoski

View GitHub Profile
body {
background-image: none;
background-color: #f9f9f9;
color: #2d2d2d;
font-family: Cantarell, Calibri, Arial, serif;
max-width: 800px;
margin-left: auto;
margin-right: auto;
}
#include <iostream>
#include <cmath>
int main()
{
using namespace std;
long long a[20] = {*a};
int i = 1;
#!/usr/bin/python3
a_name = "Akhilleos"
b_name = "Turtle"
a_velocity = 2
b_velocity = 1
a_position = 0
b_position = 10
@JanneSalokoski
JanneSalokoski / ack.py
Created April 15, 2015 16:37
A python implementation of the ackermann function from here: http://www.eprg.org/computerphile/ackermann.c
#!/usr/bin/python3
import sys
sys.setrecursionlimit(100000) #Python seems to be a sissy language by default.
def ack(m, n):
if m == 0:
ans = n + 1
elif n == 0:
ans = ack(m - 1, 1)
#!/usr/bin/python
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
config = {
'description': 'My Priject',
'author': 'Roman Fedoruk',
#!/usr/bin/python3
import time
class Color:
def __main__(self):
pass
def print(self, string, fg, bg=0, end="\n"):
print("\033[38;5;{}m\033[48;5;{}m{}".format(fg, bg, string), end=end)
#!/usr/bin/python3
ten = 0
for i in range(0, 256):
print("\033[48;5;{}m {:^5} ".format(i, i), end="")
#print("\n\033[48;5;0mi: {}\ni % 10: {}".format(i, i % 10))
if i % 10 == 0:
#!/usr/bin/python3
import re
def congruence(a, b, n, **kwargs):
if kwargs["verbose"] != None:
if kwargs["verbose"] == True:
verbose = True
else:
verbose = False
#!/usr/bin/python3
###
# Copyright @ Janne Salokoski 2015
###
import os
import time
import random
@JanneSalokoski
JanneSalokoski / clock_angle.py
Last active August 29, 2015 14:16
A program that asks for time, and calculates the angle of the clock hands for the given time.
#!/usr/bin/env python3
import sys
def get_clock_angle(hour, minute):
"""Counts the angle of given clock hands.
Takes two integers, hour and minute.
Returns a float, the angle."""
# Check if the given values are valid.
if hour < 1 or hour > 24: