sobota 8. června 2013

Multiple screenshots from video with a MPlayer


To take multiple screenshots use a screenshot video filter. Append command with -vf screenshot
> mplayer -vf screenshot movie-filename.avi
If you press 's' a screenshot is taken and it's saved in current directory as shot00001.png file.
To start a screenshot sequence press 'S' (shift+s) and for stop press it again. Multiple files are saved.

čtvrtek 30. května 2013

Vim color scheme

Change vim color simple by typing in vim:

:colorscheme ron (for dark background)
:colorscheme peachpuff (for light background)

Write this color schema as colorscheme  to /etc/vim/vimrc configuration file.

Find information on http://askubuntu.com/questions/24544/what-is-the-default-vim-colorscheme

středa 3. dubna 2013

Transfer files via browser

If you are running on Linux and your college needs to download files from you just run following command in directory with needed files:

python -m SimpleHTTPServer

Your colleges can see all files and subdirectories in browser on the address : and simple download them.


úterý 13. března 2012

WebConsole on Amazon

I manage my linux servers using ssh. From time to time I need to access them from places where ssh connection is not possible, e.g. behind firewall which enables HTTP only. Then I start a remote server with shell accessible via browser.

I use a simple solution using Amazon AWS EC2 service. I just start a prepared EC2 image on cheapest instance. This image contains installed Shell-in-a-box (Web based AJAX terminal emulator) and usage manual.

Shell In A Box implements a web server that can export arbitrary command line tools to a web based terminal emulator. For details see its homepage.

When I don't need the server anymore I just terminate it. The cost is several cents ($0.006/hour for Spot request server).

I you would like to try it the image name is ami-c73ef2ae (currently available only for US East - Northern Virginia).

WebConsole tutorial running on port 80

WebConsole shell running on port 443

středa 13. dubna 2011

Clean Code Talk - part III, Functions

Next talk by Robert C. Martin about one chapter of his book 'Clean Code'. Here is presentation used in video.


Clean Code III: Functions from Mike C. on Vimeo.


Clean-Code-Functions

Clean Code Talk - part I, Arguments

Great talk by Robert C. Martin about one chapter of his great book 'Clean Code'. Here is presentation used in video.


Clean Code I: Arguments from Mike C. on Vimeo.


Clean Code - Part 1, Arguments

středa 18. srpna 2010

Injecting Mockito mocks into a Spring bean

I would like to inject a Mockito mock object into a Spring (3+) bean for the purposes of unit testing. My bean dependencies are currently injected by using the @Autowired annotation on private member fields.

Howto do it simple with XML configuration:

<bean id="dao" class="org.mockito.Mockito" factory-method="mock">
    <constructor-arg value="com.package.Dao" />
</bean>


It's pretty elegant.