Skip to content

Instantly share code, notes, and snippets.

@sergey-miryanov
sergey-miryanov / GridContainer.py
Created January 13, 2011 09:26
Template, Plot and Line
def gridShape (count) :
columns = int (ceil (sqrt (count)))
columns = columns if columns > 0 else 1
rows = int (count) / columns
if count % columns > 0 :
rows += 1
return (rows, columns)
class GridContainer (object) :
@sergey-miryanov
sergey-miryanov / so.cpp
Created March 19, 2011 19:40
Example for SO question
/**
* \author Sergey Miryanov (sergey.miryanov@gmail.com)
* */
#define BOOST_SPIRIT_QI_DEBUG
#include <boost/config/warning_disable.hpp>
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/phoenix_core.hpp>
#include <boost/spirit/include/phoenix_operator.hpp>
#include <boost/spirit/include/phoenix_stl.hpp>
@sergey-miryanov
sergey-miryanov / gdb clang++
Created April 6, 2011 07:55
clang++ crashes on windows 7
$ gdb clang++
GNU gdb 6.8
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-mingw32"...
<nctions -fmove-loop-invariants -funroll-loops -march=native -msse -msse2 -mfpmath=sse -Wno-missing-braces -Wno-sign-compare -v -o bin/more.so
Starting program: c:\llvm-build\build\bin/clang++.exe plugins/MORE-Spirit/more.cpp plugins/MORE-Spirit/module.cpp -lpython2.6 -IC:\boost_1_46_0 -IC:\Python26\in
@sergey-miryanov
sergey-miryanov / clang++ in debug
Created April 6, 2011 08:08
clang++ crashes on windows 7 (debug)
clang++ plugins/MORE-Spirit/more.cpp plugins/MORE-Spirit/module.cpp -L/usr/lib -lpython2.6 -IC:\boost_1_46_0 -IC:\Python26\Lib\site-packages\numpy\core\include
-IC:\Python26\include -Isrc/cpp/ufsim/office/io/parser -Isrc/cpp/ufsim/office/core/more -shared -fPIC -ggdb -O0 -D_DEBUG -DBOOST_SP_DISABLE_THREADS -Wno-missing
-braces -Wno-sign-compare -Iplugins/MORE-Spirit -v -o bin/more.so
clang version 3.0 (trunk 128807)
Target: i686-pc-mingw32
Thread model: posix
"c:/llvm-build/build/bin/clang++.exe" -cc1 -triple i686-pc-mingw32 -S -disable-free -main-file-name more.cpp -pic-level 2 -mdisable-fp-elim -mconstructor-alias
es -momit-leaf-frame-pointer -v -g -resource-dir c:/llvm-build/build/bin\..\lib\clang\3.0 -D _DEBUG -D BOOST_SP_DISABLE_THREADS -I C:\boost_1_46_0 -I C:\Python2
6\Lib\site-packages\numpy\core\include -I C:\Python26\include -I src/cpp/ufsim/office/io/parser -I src/cpp/ufsim/office/core/more -I plugins/MORE-Spirit -O0 -Wn
o-missing-braces -Wno-sign-compare -ferror-limit 19 -fmessage-length 160 -fcx
Traceback (most recent call last):
File "./ufsim-office", line 20, in <module>
app.start ()
File "/home/zerg/src/ufsim-office/src/python/ufsim/office/app.py", line 98, in start
startApp()
File "/home/zerg/src/ufsim-office/src/python/ufsim/office/app.py", line 104, in startApp
PluginManager.loadPlugins ()
File "/home/zerg/src/ufsim-office/src/python/ufsim/office/core/PluginManager.py", line 51, in loadPlugins
mod = cls._load (p["module"], [cls._pluginsDir, plugin])
File "/home/zerg/src/ufsim-office/src/python/ufsim/office/core/PluginManager.py", line 81, in _load
In [2]: blue_sky.kernel.registeres_types ()
Out[2]:
[(Kernel types, str_data_table),
(Kernel types, idx_data_table),
(bs_bos_core, BOS_Core event_base class),
(bs_bos_core, WECON),
(bs_bos_core, WEFAC),
(bs_bos_core, data_storage),
(bs_pvt, pvt_dead_oil),
(bs_bos_core, well_factory),
@sergey-miryanov
sergey-miryanov / bs
Created April 22, 2011 12:26
blue-sky fails
In [1]: import bs
[Fri Apr 22 18:25:47 2011]: Main Blue-Sky Config Parser: No config file "/etc/blue-sky/blue-sky.conf"
[Fri Apr 22 18:25:47 2011]: boost::filesystem::directory_iterator::construct: No such file or directory: "/home/zerg/src/bs-eagle/blue-sky/share/blue-sky/plugins"
[Fri Apr 22 18:25:47 2011]: boost::filesystem::directory_iterator::construct: No such file or directory: "/home/zerg/src/bs-eagle/blue-sky/share/blue-sky/plugins"
[Fri Apr 22 18:25:47 2011]: boost::filesystem::directory_iterator::construct: No such file or directory: "/home/zerg/.blue-sky/plugins"
[Fri Apr 22 18:25:47 2011]: boost::filesystem::directory_iterator::construct: No such file or directory: "/home/zerg/.blue-sky/plugins"
[Fri Apr 22 18:25:47 2011]: /home/zerg/src/bs-eagle/blue-sky/exe/debug/plugins/libbs_mtx_d.so (bs_bos_core_base)
[Fri Apr 22 18:25:47 2011]: /home/zerg/src/bs-eagle/blue-sky/exe/debug/plugins/libbs_bos_core_d.so (bs_bos_core_base, bs_mtx, bs_lsolvers, bs_bos_core_data_storage, bs_mesh, bs_scal, bs_pvt)
[F
@sergey-miryanov
sergey-miryanov / bs.test
Created April 25, 2011 12:23
bs test failed
zerg@bakumatsu:~/src/bs-eagle/blue-sky$ gdb python
GNU gdb (GDB) 7.2-ubuntu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
@sergey-miryanov
sergey-miryanov / chaco
Created April 26, 2011 06:26
example of use chaco + pyqt4
from math import ceil, sqrt
from PyQt4 import QtGui
from PyQt4.QtGui import QWidget
import numpy as np
from enthought.enable.api import Window
from enthought.chaco.api import \
ArrayDataSource, PlotAxis, \
LinearMapper, DataRange1D, LinePlot, \
@sergey-miryanov
sergey-miryanov / gist:958815
Created May 6, 2011 11:55
bs-eagle loading
zerg@bakumatsu:~/src/bs-eagle/blue-sky$ py
Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53)
Type "copyright", "credits" or "license" for more information.
IPython 0.10.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.