Skip to content

Instantly share code, notes, and snippets.

@z2s8
z2s8 / pi
Last active August 29, 2015 14:07
from timeit import timeit
from decimal import *
getcontext().prec = 200
print ("A PI értékének számítása folyamatban...")
def calc (prec = 100):
pi = Decimal(0)
for k in range (prec):
pi = pi + Decimal( (1/(16**k))*( (4/(8*k+1))-(2/(8*k+4))-(1/(8*k+5))-(1/(8*k+6)) ) )
print (pi)
print (timeit(calc, number = 1))
@z2s8
z2s8 / pi
Last active August 29, 2015 14:07
from timeit import timeit
from decimal import *
getcontext().prec = 101
print ("A PI értékének számítása folyamatban...")
def calc (prec = 80):
pi = Decimal(0)
for k in range (prec):
pi = pi + Decimal( (Decimal(1)/Decimal(16**k))*( (Decimal(4)/Decimal(8*k+1))-(Decimal(2)/Decimal(8*k+4))-(Decimal(1)/Decimal(8*k+5))-(Decimal(1)/Decimal(8*k+6)) ) )
print (k)
print (pi)
@z2s8
z2s8 / pi
Last active August 29, 2015 14:07
from timeit import timeit
from decimal import *
getcontext().prec = 101
print ("A PI értékének számítása folyamatban...")
def calc (prec = 80):
pi = Decimal(0)
for k in range (prec):
pi = pi + (Decimal(1)/Decimal(str(16**k)))*( (Decimal(4)/Decimal(str(8*k+1)))-(Decimal(2)/Decimal(str(8*k+4)))-(Decimal(1)/Decimal(str(8*k+5)))-(Decimal(1)/Decimal(str(8*k+6))) )
print (k)
print (pi)
def kilepes():
print ("A kilépés megkezdődik...")
def belepes():
print ("Bejelentkezés...")
def fo_menu(navig):
for e in enumerate(navig):
print("{0}. {1}".format(str(e[0]), e[1].__name__))
valasz = int(input("Add meg a menüpont számát:"))
u0_a200@grouper:/ $ python
Python 3.2.2 (default, Jun 23 2014, 00:13:13)
[GCC 4.8] on linux-armv7l
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> re.match('^[a-z0-9]{8}$', '878h76t5')
<_sre.SRE_Match object at 0x405ec480>
>>> re.match('^[a-z0-9]{8}$', '8786h76t5')
>>> re.match('^[a-z0-9]{8}$', '8786h76X5')
>>> s='ide az input'
#!/usr/bin/env python3
fagyosok = []
for i in range(1, 8):
homerseklet = int(input('{0}. nap homerseklete: '.format(i)))
if homerseklet < 0:
fagyosok.append(i)
if len(fagyosok) > 0:
[z2s8@HELLCAT pys]$ python3 program.py
Udv a DANET rendszer fomenujeben!
0. Regisztracio
1. Bejelentkezes
Adja meg a menüpont számát: 1
Bejelentkezes
Hozzaferes tipusok: TANAR es TANULO
A fomenube visszatereshez: ENTER billentyu
Hozzaferes tipusa: [TANAR/TANULO] TANULO
Danetkod: tothmari
@z2s8
z2s8 / install.txt
Created October 29, 2014 15:00
Some stuff to instal on brand new ubuntu
sudo add-apt-repository ppa:webupd8team/sublime-text-3
sudo apt-get update
sudo apt-get install python3 git idle git-doc python3-pip bpython ssh-askpass ssh-client binutils-doc man-db debian-keyring curl wget sl sublime-text-installer
@z2s8
z2s8 / Stuff
Created October 30, 2014 19:37
partMasolAs
dd if=/dev/sda | pv | dd of=/dev/sdc bs=512 conv=noerror,sync
@z2s8
z2s8 / rsync.txt
Last active August 29, 2015 14:08
rsync
sudo rsync -rlptgoDAEXH --progress /honnan/ /hova/