Skip to content

Instantly share code, notes, and snippets.

View Visgean's full-sized avatar

martin Visgean

View GitHub Profile
# Easiest way:
# But it is without support for complex number.
from math import factorial
factorial(6)
#! /usr/bin/python
# -*- coding: UTF-8 -*-
# Pascal´s Rectangle
start = int(raw_input("Starting number: "))
pascal = [[start]] # at least one item is necessary to be here
for cycle in range(int(raw_input("Number of lines: "))-1):
line = []
#! /usr/bin/python
# -*- coding: UTF-8 -*-
# Deda vseveda by Visgean Skeloru <visgean (at) gmail.com>
# To run this script you have to EAT A CAT and force somebody to COMMIT A SUCIUDE!
from random import choice
from sys import argv
#! /usr/bin/python
# -*- coding: UTF-8 -*-
import pyinotify
class notifier(pyinotify.ProcessEvent):
def process_IN_ACCESS(self, event):
"file was accessed."
pass
#! /usr/bin/python
# -*- coding: UTF-8 -*-
# Script for discover where is some module which you want to use with starndart
# sys.path
import sys, os
desiredModule = raw_input("Module name: ")
def pseudoRange(numberOfCycles):
i = 0
while i < numberOfCycles:
i += 1
yield i
for i in pseudoRange(4):
print i
if i == 2:
#! /usr/bin/python
# -*- coding: UTF-8 -*-
# Pythagoras triangle in new version with yield!
def giveMeLines(numberOfLines):
line = [1]
for xexe in xrange(numberOfLines):
yield line
tempLine = [] # buffer for new elements
#! /usr/bin/python
# -*- coding: UTF-8 -*-
def fact(ar):
x = 1
while ar > 0:
x *= ar
ar -= 1
return x
#! /usr/bin/python
# -*- coding: UTF-8 -*-
import urwid
from database import Pathject
>>> from database import Pathject
>>> import urwid
>>> paths = map(str, list(Pathject.select()))
>>> paths = map(urwid.Text, paths)
>>> for path in paths: print path
...
<Text flow widget "<Pathject 1 path='/' pins='asx' comment=None lastTimeUsed=None timeLimit=1.0>">
<Text flow widget "<Pathject 2 path='/' pins='asx' comment=None lastTimeUsed=None timeLimit=1.0>">
<Text flow widget "<Pathject 3 path='/' pins='asx' comment=None lastTimeUsed=None timeLimit=1.0>">
<Text flow widget "<Pathject 4 path='/' pins='asx' comment=None lastTimeUsed=None timeLimit=1.0>">