Friday, July 17, 2015

MPJEG Player

Small python script that I put together to play a sequence of JPEG images at a given FPS. Feel free to steal any of it.

Depends on numpy for data type conversion and open cv for image processing (JPEG decoding)

Monday, October 8, 2012

Releasing Krypton v1.0

Krypton - a super experimental ASCII cipher from the planet Krypton
For general general help --> python --help
Use with caution. Not recommended for any serious work.

Source code available at:
Feel free to criticize on any un-pythonic code.

As an effort to learn crypto BIG ideas:
1. Confusion - Caesar cipher
2. Diffusion - Column transportation
3. Secret only in the key - As obvious as it is

How the encryption works:
  1. Diffuse the key - with a column transportation of state size 16
  2. Confuse the data with something similar to Caesar cipher with confusion
    in the size of original key length
  3. Then do an awesome XOR
+  To decrypt go in reverse order

The testing:
# Encrypt a simple ASCII text file
python -i -o test.enk -k apple
# -D option to Turn on the Decryption mode
python -D -i test.enk -o test.dek -k apple

# -B option to Encrypt a binary file
# Encrypted file will be double the size of original file
python -B -i debian.torrent -o debian.enk -k"apple!booz"
# -B -D options to Turn on the Decryption mode with binary file
python -B -D -i debian.enk -o debian.dek -k"apple!booz"

diff test.dek
diff debian.dek debian.torrent -b

Test in one shot
rm *.enk *.dek
python -i -o test.enk -k apple
python -D -i test.enk -o test.dek -k apple
diff test.dek

python -B -i debian.torrent -o debian.enk -k"apple!booz"
python -B -D -i debian.enk -o debian.dek -k"apple!booz"
diff debian.dek debian.torrent -b

Saturday, April 7, 2012

Story of a question @stack

Asking a good question needs a little more work than some one would expect. Asking a great question especially in Stackoverflow is not that easy [My respect for the guys who were able to ask great questions].

I love to hangout @Stackoverflow in my free time [By the way it is quite addictive]. I see stackoverflow as a wealth of knowledge for the developers by the developers.

I asked my first question @Stackoverflow, it was all exciting. And as expected got some helpful answers. Okay now wait, did I get the answer that I was really looking for -- nope. But there was a close one.  

Blame it on the stack! Read on before going crazy, it was all my fault. I realized that I am doing something(s) wrong. It was an out of ordinary question (who says that, I say it). It was a question that I wondered for a long time,  to find THE solution (any thing that was already implemented).

If you know a bit of javascript you would probably know that it's current implementation is single threaded. Asking the impossible was out of ordinary in my question. In no-time there it was, a comment, letting me know that I am not following the right track. It was the hard truth that I didn't like to accept.
It cannot be done, the function will not return control to anything until it is finished. – Esailija - link
When expecting the answer, I knew about web workers, javascripts' single threadedness. But the answers I got were telling me the same, that I have found out already. What have I done wrong?

Its just simple. I have obviously skipped the mandatory section of a good question. What have I tried? No matter whether I have spend years, months or days to find a solution, no matter the question was answered by industry experts, I am not getting the right answer that I want just because no one is able to get into my head and see what have I tried? In this particular question - What do I know?

So ending up the tale of my question, I accepted an answer - accepted for its help as well as for the time and work dedicated just for answering my insane question. I felt guilty for not asking a good question. Felt bad not for up-voting the other answers, because I said "Any help is greatly appreciated! Thanks a lot." Finally it ended up voting up every answer just for their effort they have put on. I am discouraged to rephrase and ask the same question but properly -- once again.

It was a great experience, I like to learn by my mistakes.
And by the way I am still interested in answering the impossible. 

Ask questions to find answers

Sunday, December 25, 2011

Clean Tabs CSS Styles Pack - 0.1

There are 2 main styles, But you can change the color variables in SCSS to create more nice looks.

What's cool:

- No more hassle creating tabs with icons

Just use the jquery-ui's ui-icon and ui-icon-home & ui-icon-heart CSS classes. Or would work with your own icons, you can get it with a glimpse on to the code.

- Used SCSS so you can customize very easily

Variables section gives you the ability to change color themes without any challenge

Saturday, November 26, 2011

How to get rid of "Microsoft Office Click-to-Run 2010 (Protected)" drive from My Computer

MS Office starter package came free with my Windows box.
Although I was happy with the Microsoft freebie, what annoyed me was the new Drive (Q:), named as "Microsoft Office Click-to-Run 2010 (Protected)", that the installer configured with the installation. Seems like there is no official support to remove it from 'My Computer'.

My solution was just to hide the drive (Q:), named as "Microsoft Office Click-to-Run 2010 (Protected)". The following simple Registry tweak worked quite well for me..
1. Open Run (with 'Win key'+R or Start 'Run')
2. Type Regedit press OK -- this will open the 'Registry editor' (Be cautious when editing registry)
3. Go to 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer'
4. Create a DWORD value named 'NoDrives' and set its value in 'Decimal' according to the drive letter you want to hide.
A: 1, B: 2, C: 4, D: 8, E: 16, F: 32, G: 64, H: 128, I: 256, J: 512, K: 1024, L: 2048, M: 4096, N: 8192, O: 16384, P: 32768, Q: 65536, R: 131072, S: 262144, T: 524288, U: 1048576, V: 2097152, W: 4194304, X: 8388608, Y: 16777216, Z: 33554432
Mine was letter Q. So 65536 in Registry edit looked like below.
And there were no problems with MS Office after hiding the drive and I do not expect any. Restart the machine to see changes in 'My Computer'.

Tested and worked well on a Win 7.
Refer to this article about hiding drives from 'My Computer'

Friday, November 4, 2011

Interesting from the web

Some interesting stuff from the web

Thursday, October 27, 2011

Overcoming the 'graying' problem in Gnome panels

I am running Ubuntu in VirtualBox (on a Windows 7 host). Several times now, the top-level menu bar, the task bar — and seemingly every system dialog — have forgotten the out-of-the-box "Ambiance" theme they conform to when I first installed the system. Window captions still preserve the theme, but pretty much nothing else does -- from question
I was running into the same problem in Linux Mint, the bottom panel and all dialog boxes and panels were having an unintended gray color as in a Windows classic theme.
Below is the hack that worked for me.
Yout too can go through this simple process to beat the bug
Open the terminal and ..
user@machine ~ $ su
machine user # cd /etc/xdg/autostart/
machine autostart # sudo gedit
Or use editor of your choice. Copy and paste the below code

pid=$(pgrep gnome-settings-)

while [ -n "$pid" ];
pid=$(pgrep gnome-settings-)
sleep 0
killall -9 nautilus

exit 0
After closing saving the file in the terminal run
machine autostart # chmod +x
machine autostart # sudo gedit gnome-settings-daemon.desktop
change the Exec line to
Exec=bash -c '/etc/xdg/autostart/;/usr/lib/gnome-settings-daemon/gnome-settings-daemon'
Now you are ready. Restart the system to see how it works! Code came up through guidance of this answer and more googling