Skip to content

Instantly share code, notes, and snippets.

View KrzysztofCiba's full-sized avatar

Krzysztof Daniel Ciba KrzysztofCiba

View GitHub Profile
@KrzysztofCiba
KrzysztofCiba / b.sh
Created October 1, 2012 20:24
trash8
[Fri, 04 Nov 14:17 E0][cibak@localhost:~/test]> python test.py
##### creating child
in child, gX is there? False
in child, foo is there? False
##### baseClass.run() exectuion
in base class run
gX = 1
function foo called
##### testChild.myRun() execution
in testChildMyRun
if __name__ == "__main__":
print "#"*5, "creating child"
child = testChild()
print "#"*5, "baseClass.run() execution"
child.run()
print "#"*5, "testChild.myRun() execution"
child.myRun()
from testBase import baseClass
class testChild( baseClass ):
def __init__( self ):
baseClass.__init__( self )
print "in child, gX is there? ", "gX" in globals()
print "in child, foo is there? ", "foo" in globals()
def myRun( self ):
@KrzysztofCiba
KrzysztofCiba / a.sh
Created October 1, 2012 20:22
trash5
[Fri, 04 Nov 14:32 E0][cibak@localhost:~/test]> python -m a
<type 'module'>
Fri, 04 Nov 14:29 E0][cibak@localhost:~/test]> python
Python 2.7 (r27:82500, Sep 16 2010, 18:02:00)
[GCC 4.5.1 20100907 (Red Hat 4.5.1-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from a import A
>>> a = A()
<type 'dict'>
@KrzysztofCiba
KrzysztofCiba / a.py
Created October 1, 2012 20:19
trash3
class A:
def __init__( self ):
print type(__builtins__)
if __name__ == "__main__":
a = A()
class baseClass( object ):
def __init__( self ):
from testGlobal import gX, foo
try:
__builtins__["gX"] = gX
__builtins__["foo"] = foo
except:
setattr( __builtins__, "gX", gX )
setattr( __builtins__, "foo", foo )
gX = 1
def foo( ):
print "function foo called"
#!/usr/bin/env python
##
# @file svn-policy.py
# @author Krzysztof Daniel Ciba (Krzysztof.Ciba@NOSPAMgmail.com)
# @date 06/05/2009
# @brief pre-commit hook
#
import os
import sys
import getopt
@KrzysztofCiba
KrzysztofCiba / Render.php
Created October 1, 2012 19:30
rendering graphs
require_once("System.php");
/**
* @class graphviz
* @author Krzysztof Daniel Ciba (Krzysztof.Ciba@NOSPAMgmail.com)
* @brief class for making Graphviz plots online
*/
class graphviz {
var $directed = True;