Skip to content

Instantly share code, notes, and snippets.

View JanneSalokoski's full-sized avatar

Janne Salokoski JanneSalokoski

View GitHub Profile
#!/usr/bin/python
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
config = {
'description': 'My Priject',
'author': 'Roman Fedoruk',
@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/python3
a_name = "Akhilleos"
b_name = "Turtle"
a_velocity = 2
b_velocity = 1
a_position = 0
b_position = 10
#include <iostream>
#include <cmath>
int main()
{
using namespace std;
long long a[20] = {*a};
int i = 1;
body {
background-image: none;
background-color: #f9f9f9;
color: #2d2d2d;
font-family: Cantarell, Calibri, Arial, serif;
max-width: 800px;
margin-left: auto;
margin-right: auto;
}
# This is a list of bash commands I've found useful, but hard to remember.
# Get the temperature of the graphics card.
# Note: Only works for ATI/AMD cards.
sensors | grep radeon -A 2 | grep temp | sed 's:[^+]*\(\S*\).*$:\1:'
# Show the progress of a dd process.
dd --status=progress
# or
watch -n 10 kill -USR1 $(pgrep -l '^dd$' | sed 's: dd::')
local debug = false
local new_temperature = 0
sim.ambientAirTemp(20)
-- Test Window
local testWindow = Window:new(-1, -1, 150, 55)
local currentY = 10
#!/usr/bin/python
import random
import time
import sys
def getNewQuestion(x, y):
print("{:^4} + {:^4} = ".format(x, y), end="")
try:
result = input()
#!/usr/bin/python
import random
import re
words = {
"pyytää, rukoilla": ["be", "ber", "bad", "bett"],
"sitoa": ["binda", "binder", "band", "bundit"],
"purra": ["bita", "biter", "bet", "bitit"],
"tarjota": ["bjuda", "bjuder", "bjöd", "bjudit"],
#!/usr/bin/env python
import sys
import math
def simple(n):
a = 0
for i in range(0, n):
a = a + (-1)**i * 1/(2*i+1)