$ watch ss -tp
Sunday, 18 August 2013
virtualisation note
I have worries abut graphics performance. Anyway:
https://communities.vmware.com/thread/230428?start=15&tstart=0
https://www.google.co.uk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=4&ved=0CEQQFjAD&url=http%3A%2F%2Fwww.vmware.com%2Ffiles%2Fpdf%2Ftechpaper%2Fvmware-horizon-view-graphics-acceleration-deployment.pdf&ei=zm4QUvmHHKyn0wW02YDwBA&usg=AFQjCNGAqJQsJ7e-6UNyvDXl5BcpiKjfGw&bvm=bv.50768961,d.d2k&cad=rja
https://communities.vmware.com/thread/230428?start=15&tstart=0
https://www.google.co.uk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=4&ved=0CEQQFjAD&url=http%3A%2F%2Fwww.vmware.com%2Ffiles%2Fpdf%2Ftechpaper%2Fvmware-horizon-view-graphics-acceleration-deployment.pdf&ei=zm4QUvmHHKyn0wW02YDwBA&usg=AFQjCNGAqJQsJ7e-6UNyvDXl5BcpiKjfGw&bvm=bv.50768961,d.d2k&cad=rja
Friday, 16 August 2013
Thursday, 15 August 2013
nbconvert notes
Changing to A4
Edit latex.py in the nbconvert directory and change, documentclass_options from `11pt,english' to `11pt,english,a4'
Tuesday, 13 August 2013
Efficient / elegant Python file reading
from ipython.org:
with open('workfile', 'r') as f:
read_data = f.read()
Monday, 12 August 2013
ipython notebook animations. So far so bad.
Some problems here.
$ sudo apt-get install libavcodec-extra-52 libavdevice-extra-52 libavfilter-extra-0 libavformat-extra-52 libavutil-extra-49 libpostproc-extra-51 libswscale-extra-0
Attempt with recordmydesktop
$ sudo apt-get install recordmydesktop
$ recordmydesktop -x 500 -y 250 --width 800 --height 700 --no-sound --delay 10 output.ogv
imageRoot = '/home/me/screenshots/animSource/'
imageTarget1 = '/home/me/screenshots/animCroppedSolid/'
imageTarget2 = '/home/me/screenshots/animCroppedTrans/'
fontpath = '/usr/share/fonts/truetype/ubuntu-font-family-0.80/' # system specific!
a = os.listdir(imageRoot)
a = [i for i in a]
f = reference.logscale(1, 1000, 192)
# It seems that PIL will not load normal fonts like those given away
# by Ubuntu, or those on the system already. That's damn annoying.
# Seems they have thier own format: pbm or .pil but I cannot find them.
# No: truetype fonts do work but the command for use is truetype specific.
font = ImageFont.truetype(fontpath + 'Ubuntu-B.ttf', size=16) # true type
#font = ImageFont.load(fontpath + 'Ubuntu-B.ttf') # true type
# font = ImageFont.truetype("arial.ttf", 15) # truetype
ii = 0
imageTarget = imageTarget1
for i in sorted(a):
print i, ii, f[int(ii/2)]
b = Image.open(imageRoot + i)
c = b.crop((740, 345, 1580, 880)) # use this when happy freqs are correct.
# c = b # use this to check f[ii/2] = f
draw = ImageDraw.Draw(c)
# draw.line((0,0) + c.size, fill=128) # an example.
draw.text([300, 10], 'Frequency: %.2f Hz' % f[int(ii/2)], fill=128, font=font)
del(draw)
c.save(imageTarget + i + '.new.png')
if imageTarget == imageTarget1:
imageTarget = imageTarget2
else:
imageTarget = imageTarget1
ii += 1
Attempt to use openshot to create video (failed)
Anyway, install openshot. Openshot got upset with my Lucid installation codecs when I attempted export; claiming libx264 was not installed. Some reading: there are two versions, one closed, one open. I most likely have the open version which is limited.$ sudo apt-get install libavcodec-extra-52 libavdevice-extra-52 libavfilter-extra-0 libavformat-extra-52 libavutil-extra-49 libpostproc-extra-51 libswscale-extra-0
Then openshot hangs on export.
Attempt command line encoding with libav-tools (fail to install on Lucid)
Try command line: I need the libav-tools package, not present in Lucid. Add a personal package providing it:
$ sudo add-apt-repository ppa:kxstudio-team/ppa
$ sudo apt-get update
Still can't install it! Manually add,
deb http://ppa.launchpad.net/kxstudio-team/ppa/ubuntu lucid main
deb-src http://ppa.launchpad.net/kxstudio-team/ppa/ubuntu lucid main
to /etc/apt/sources.list and update: $ sudo apt-get update
Still no joy. Looks like I need to update my installation.
Workaround:
Attempt command line encoding with ffmpeg (Seg fault)
Older linux: create movie from images with ffmpeg:
$ ffmpeg -qscale 5 -r 20 -b 9600 -i v9_j58_anim???.png v9_j58.mp4
FFmpeg version SVN-r0.5.9-4:0.5.9-0ubuntu0.10.04.3, Copyright (c) 2000-2009 Fabrice Bellard, et al.
configuration: --extra-version=4:0.5.9-0ubuntu0.10.04.3 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --disable-stripping --disable-vhook --enable-runtime-cpudetect --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --enable-shared --disable-static
libavutil 49.15. 0 / 49.15. 0
libavcodec 52.20. 1 / 52.20. 1
libavformat 52.31. 0 / 52.31. 0
libavdevice 52. 1. 0 / 52. 1. 0
libavfilter 0. 4. 0 / 0. 4. 0
libswscale 0. 7. 1 / 0. 7. 1
libpostproc 51. 2. 0 / 51. 2. 0
built on Jan 24 2013 19:42:59, gcc: 4.4.3
Input #0, image2, from 'v9_j58_anim000.png':
Duration: 00:00:00.05, start: 0.000000, bitrate: N/A
Stream #0.0: Video: png, rgb24, 1276x934, 20 tbr, 20 tbn, 20 tbc
Segmentation fault
Pity. Gave up here.#
Attempt with avconv (not in Lucid)
avconv looks simpler and is available on newer Ubuntus. Try,
$ avconv -i *.png movie.mp4
or don't in Lucid: it's not available.
Attempt with openmovieeditor
$ sudo apt-get install openmovieeditor
So far so good. Navigate to the directory containing nothing but images and click render.
Result: a non-zeros file, that displays a black mplayer screen. That's a morning lost.
Attempt with gifsicle
I used to use this during the PhD. It needs gif images so convert all these pngs to gifAttempt with recordmydesktop
$ sudo apt-get install recordmydesktop
$ recordmydesktop -x 500 -y 250 --width 800 --height 700 --no-sound --delay 10 output.ogv
A good start. Capture works and mplayer plays the output. Now to crop.
Best approach (using xdotool, xmacrorec, screengran, python PIL and GIMP)
recordmydesktop worked but had a habit of leaving a white square on the desktop after closing, and
dropped some frames; and the result didn't look so good. A better approach might be to write a macro
to iterate through the animation frames, saving them. Crop the result in python and create the animation in GIMP.
Luckily, PafVu will save animations as a series of .png files, leaving only the cropping and creation of the animation.
If a frequency based animation is needed, use the other tools to create a macro to step through the displaced shapes.
imageRoot = '/home/me/screenshots/animSource/'
imageTarget1 = '/home/me/screenshots/animCroppedSolid/'
imageTarget2 = '/home/me/screenshots/animCroppedTrans/'
fontpath = '/usr/share/fonts/truetype/ubuntu-font-family-0.80/' # system specific!
a = os.listdir(imageRoot)
a = [i for i in a]
f = reference.logscale(1, 1000, 192)
# It seems that PIL will not load normal fonts like those given away
# by Ubuntu, or those on the system already. That's damn annoying.
# Seems they have thier own format: pbm or .pil but I cannot find them.
# No: truetype fonts do work but the command for use is truetype specific.
font = ImageFont.truetype(fontpath + 'Ubuntu-B.ttf', size=16) # true type
#font = ImageFont.load(fontpath + 'Ubuntu-B.ttf') # true type
# font = ImageFont.truetype("arial.ttf", 15) # truetype
ii = 0
imageTarget = imageTarget1
for i in sorted(a):
print i, ii, f[int(ii/2)]
b = Image.open(imageRoot + i)
c = b.crop((740, 345, 1580, 880)) # use this when happy freqs are correct.
# c = b # use this to check f[ii/2] = f
draw = ImageDraw.Draw(c)
# draw.line((0,0) + c.size, fill=128) # an example.
draw.text([300, 10], 'Frequency: %.2f Hz' % f[int(ii/2)], fill=128, font=font)
del(draw)
c.save(imageTarget + i + '.new.png')
if imageTarget == imageTarget1:
imageTarget = imageTarget2
else:
imageTarget = imageTarget1
ii += 1
Friday, 9 August 2013
ipython solution control. Create .geo from template, convert to PAFEC, parallel solve, import.
fn = 'v9_j55'
if solve:
createAnalysisFile(dataRoot + fn + '_template.geo', dataRoot + fn + '.geo',
prepend = 'dia_t = 1.067E-3;\n')
output = !gmsh -2 {dataRoot + fn + '.geo'} # this works!
args = setArgs()
args['FREQUENCIES.FOR.ANALYSIS'] = ffa(3, 15000, 50000, 192)
args['restrain'] = [{'Heater':1}]
convert.gmsh2pafec(dataRoot + fn, case = 66, verb = 0, args = args)
solveJob(fn)
if loadData:
res['v9_j55: heaterClamp'] = getResult(dataRoot + fn, Vnode = 68)
ipython 1.0 notes
The new ipython includes many new features: so many I'll log some here. IPython amazes me! I wonder if I could up sections of my notebooks to blogger..... anyway. Much of the following is noted directly from the following address:
http://ipython.org/ipython-doc/stable/interactive/tutorial.html
% timeit range(1000) # run this one line
%% timeit range(1000) # run this cell.
max(x)
% run -d myprogram.py # step through the program!
% debug # now works in the notebook! As does raw_input() !
System commands!
output = !ping www.bbc.co.uk
.. to provide the command with ipython variables, use $ or wrap in {} as follows:
output = !grep -rF $pattern ipython/*
a = 'hello'
output = !grep -rF {a} ipython/*
Grab external python programs, edit and execute!
%load http://matplotlib.sourceforge.net/plot_directive/mpl_examples/mplot3d/contour3d_demo.py
Set high quality plots: Put this at the start.
% config InlineBackend.figure_format = 'svg'
Undo: Thank you!
%connect_info
to display connection info for other ipython consoles.
Setting up clients and workers:
worker:
user@worker: $ ipython kernel
[IPKernelApp] To connect to another client on this kernel, use:
[IPKernelApp] --existing kernel-12345.json
client:
user@client $ ipython qtconsole --ssh=worker --existing /path/to/kernel-12345.json
Manual ssh tunnels. This is interesting even without ipython.
$ ssh :: -f -N
Blogger mangled. Check the source at
http://ipython.org/ipython-doc/stable/interactive/qtconsole.html
for this.
http://ipython.org/ipython-doc/stable/interactive/tutorial.html
% timeit range(1000) # run this one line
%% timeit range(1000) # run this cell.
max(x)
% run -d myprogram.py # step through the program!
% debug # now works in the notebook! As does raw_input() !
System commands!
output = !ping www.bbc.co.uk
.. to provide the command with ipython variables, use $ or wrap in {} as follows:
output = !grep -rF $pattern ipython/*
a = 'hello'
output = !grep -rF {a} ipython/*
Grab external python programs, edit and execute!
%load http://matplotlib.sourceforge.net/plot_directive/mpl_examples/mplot3d/contour3d_demo.py
Set high quality plots: Put this at the start.
% config InlineBackend.figure_format = 'svg'
Undo
%connect_info
to display connection info for other ipython consoles.
Setting up clients and workers:
worker:
user@worker: $ ipython kernel
[IPKernelApp] To connect to another client on this kernel, use:
[IPKernelApp] --existing kernel-12345.json
client:
user@client $ ipython qtconsole --ssh=worker --existing /path/to/kernel-12345.json
Manual ssh tunnels. This is interesting even without ipython.
$ ssh
Blogger mangled. Check the source at
http://ipython.org/ipython-doc/stable/interactive/qtconsole.html
for this.
Thursday, 8 August 2013
python documentation / uml diagrams
To read convert.py and create documentation based on comment strings in a pdf:
$ epydoc --pdf convert -o convert_docs
To do something similar with html (including class diagrams)
$ epydoc convert -o convert_docs
$ epydoc --pdf convert -o convert_docs
To do something similar with html (including class diagrams)
$ epydoc convert -o convert_docs
Wednesday, 7 August 2013
ipython notebook formatting.
\begin{verbatim}
blah blah
\end{verbatim}
... generates a boxed display in the notebook but nbconvert uses the environment as hoped.
# title
## section
### subsection
#### subsubsection
behaves as expected.
Titles properly centred:
'title here \n good' worked as hoped.
r'title here \\ bad' will left justify the second line. Yuk.
tit = 'Effect of coupling PZT to diaphragm at edge only\n'
tit += r'with controlled $f_{0}$. $pcb_{t}=3.2mm$'
works as hoped. :)
Sunday, 4 August 2013
linux security
John the Ripper:
$ sudo unshadow /etc/passwd /etc/shadow > mypasswd
$ cat mypasswd
$ john mypasswd
$ john --show mypasswd
0 password hashes cracked, 1 left
$ john --status
guesses: 0 time: 0:00:05:11 (3) c/s: 456
http://www.openwall.com/john/doc/EXAMPLES.shtml
is useful.
Interrupting and running with $ bg doesn't seem to work and left a john process and locked file. Killing the process fixed this. Running as,
$nohup john mypasswd &
then seemed to work ok but subsequent
$ john --status
returned a static,
guesses: 0 time: 0:00:00:02 0% (2) c/s: 369
even though one of the machine cores was at 100$ with john using it all. Don't do this then! Run without nohup and &.
$ sudo unshadow /etc/passwd /etc/shadow > mypasswd
$ cat mypasswd
$ john mypasswd
$ john --show mypasswd
0 password hashes cracked, 1 left
$ john --status
guesses: 0 time: 0:00:05:11 (3) c/s: 456
http://www.openwall.com/john/doc/EXAMPLES.shtml
is useful.
Interrupting and running with $ bg doesn't seem to work and left a john process and locked file. Killing the process fixed this. Running as,
$nohup john mypasswd &
then seemed to work ok but subsequent
$ john --status
returned a static,
guesses: 0 time: 0:00:00:02 0% (2) c/s: 369
even though one of the machine cores was at 100$ with john using it all. Don't do this then! Run without nohup and &.
Subscribe to:
Posts (Atom)