Mobil Mewah

Salah satu sumber Inspirasi.

Mobil Sport terbaik

Anda pasti bisa memilikinya.

Bermain dengan pesawat

Salah satu ide yang gila, Balapan di udara.

Bermain di angkasa

Apakah ini salah satu Goals dalam hidup anda? anda pasti bisa mencapainya

Saturday, 17 May 2014

Use Bash in FreeBSD machine

Bash In FreeBSD
FreeBSD using C shell for the root user, and the user got sh for their shell by default. And there are so many shell can be used. But why you want to use bash at the first place, in FreeBSD terminal ?

One thing for sure, every Linux distribution by default using Bash as their shell of choice. This will get some compatibility if you create script which not run in Bash. So the options was you use bash or you change your script.

So the option to using bash shell in FreeBSD is open. we can change any type of shell we want to use. So now i will show how to change the default shell in FreeBSD which i had encounter and some tips which not a standard setup for Bash in FreeBSD.

First, install bash shell if not installed. Here are my step to install :

#cd /usr/ports/shell/bash

#make install clean



Then to change the shell as a user :

$ chsh


This will prompt user profile, change the shell to /usr/local/bin/bash

Then you can relogin to get the bash shell.

And in Linux , you can create profile for Bash, so when login the script executed. This was called .bashrc , but not in FreeBSD.

To make the bash start script run when user login, you must put it in .bash_profile .

This happend to me when i want to create a virtualenvwrapper setup in FreeBSD.

That's it. you have your Bash way.

Thursday, 15 May 2014

Git Branching Model for Great Project

I got a development bump when using GIT. Currently i do the master branch only with git and develop all in master branch and log back to the master branch.

Now i start using the git branching for development of new feature, and all the way, i got confuse if i merge back to master, the current running stable version i cannot revert.

I remember the git tag usage, so i can tag the point where the code was stable, the same way when using svn for source code management.

But in git, i think and search a better way and a best proven practice somebody else employ and works in the project very well with single fighter or with many developers.

So i look for it in the web, and i found one. This is very interesting and i would like to share it and blog about it.

I will give the link [1] to the site where i learn a lot. Here are some summary i got :

  1. Always have a Master and Develop branch in origin repo.
  2. In master use Tag to pin point the stable release of the code. Master branch is the production ready code ready to be deploy.
  3. In your own repo or developer repo, you can have feature branch, release branch, hotfix branch. But not in you origin repo.
  4. Some rules to be remember :
    For branching out ::
    Feature branch always branching from develop branch.
    Release Branch always branching from a ready develop branch.
    Hotfix branch always branching from Master

    For Merging in :
    Feature branch always merge back to Develop branch when ready.
    Develop branch alway merge back to Release branch when ready.
    Hotfix branch always merge back to Master and Develop branch.
  5. Always remember the rules and better explanation is with a picture.
For the better understanding of course the picture :


Picture explain a thousand words right. Hope this help. What do you think about this method? are you have any other best method you employ in your GIT work flow with greater success, share it with me.

Source :
[1]  A-successful-git-branching-model , download at  15 May 00:07 +8 GMT

Wednesday, 14 May 2014

Django Collectstatic usage

Django Collect Static Usage
After some project completed and had a common project template layout directory , usually we will want to reuse the previous project template. But there are some static files which not belong to new project anymore. This needs time to fix.

The question is, can we put the static files for an application in their own static folder, not in the project static file it self? so when we use the app in django project, we also no need to copy to project wide static folders, which served by the webserver, usually Nginx or apache.

So come the rescue Collectstatic command in the Django admin. These feature available since Django1.3, but i actually never used it until now i understand how to implement it, and it's smart. So how to use it? I will share the step-by-step to make the collectstatic run without hassle and give speed up in development. This run with Django < 1.6 as i write this.

Step 1 :

in your settings.py :

STATIC_ROOT = '/usr/local/www/1millionproject/collected_static'



Then let say you have an app called ordernow

Step2 :

create a static folder and put any static directory or files in the folder.

ordernow/static/orderstyle.css
ordernow/static/images/produt1.png

So what happend and how to get the static file in the correct path inside project ?

Step 3 :

From your project root directory run the collectstatic command :

$python manage.py collectstatic

Then you will get a prompt and warning if you want to proceed to collect all the static files in your application folder and put it in the STATIC_ROOT location you state in Step 1.

Then make sure you set the STATIC_ROOT accessible from the webserver which will serve the static files.

In your Django code, use it as usuall with {{ STATIC_URL }} in your template files.

So the benefit of using collectstatic command is you won't need the copy command to your initial project files. Also when deploy to the production server, just issue collectstatic command and all the static files will copied from the app folder to your public static folder.

This is one of some nice features Django have. I love it especially you have many reusable app with its own static files. All will be in 1 place in the application specific directory.

How about your way, you can give a comment and share.

Thanks for reading.

Friday, 18 April 2014

The Best Compression available

When working with files, especially large files and need to be transfered over the network, one optimization can be done is with the file size. We can compress the file to the smallest size, but how small is small ?

So i look up for some comparison about the file compression to be used in linux system. For usual compression in linux, the compression used was .tar.gz or .tar.bz2 . I prefer use .tar.bz2 because better than .tar.gz .

But you know what, there are other compression that is better which is .rar and .7z .

I look for some data and got the comparison chart. You can see the chart below.
Surely the result is compelling, and look to use .7z . In linux there are 7zip package which called p7zip , in debian linux.

I also tested with my current file, which use bz2, and compress it using 7z, I got around 20Mb - 100 Mb more disk space with 7z compression, even with mp4 video files.

So more disk space left for storage when using 7z compression. No worries with the compatibility, because 7zip also available in any Operating System like linux, windows, MacOS.

Here are some how to use 7z compression.

To install :

$ sudo apt-get install p7zip-full

To compress :

$ 7za a big-bang-theory.7z  big-bang-theory/

To test compression :

$ 7za t big-bang-theory.7z

To uncompress :

$ 7za x big-bang-theory.7z

So happy Compressing.


Monday, 14 April 2014

Heartbleed SSL Vulnerability

Recently the IT Security community had a security event  about OpenSSL bug which is widely use by server that implement SSL/TLS secure connection.

The bug enable an attacker to see 64k size of memory content of the server without leaving a trace. This including the primary data, which is private key of the encryption.

The bug revealed by Neel Mehta of Google's security team and reported the defect on April 1, 2014 to the OpenSSL team.

The Heartbleed name it self come from a Finnish cybersecurity company, which also created the bleeding heart logo, and launched the domain Heartbleed.com to explain the bug to the public, which called codenomicon. They reported on April 3, 2014.

This bug effect was so big to the internet community. On April 10, "Cisco Systems and Juniper Networks, two of the biggest creators of Internet equipment, announced that their products had been affected by the Heartbleed bug. Routers, firewalls and switches, all likely been affected by the bug, leaving your personal information at risk of being stolen by hackers."



Even some independent researchers On April 12, were able to steal private keys using this attack from an experimental server intentionally set up for that purpose by CloudFlare.

What is the impact of this ?

When a service that use OpenSSL which is vulnerable, some attacker may be able to retrieve sensitive information, anything include secret keys which is the primary information in OpenSSL infrastructure.


With the secret key, they can create a spoofing server, even run a Man in The Middle attack with the private key. Even with you not know that it was happening.

Who uses OpenSSL ? any service which utilize SSL/TLS would it be https server, vpn connection end point, in switch, router, email, is using the OpenSSL for the underlying system.

I also use the OpenSSL software, because its opensource and free. Many internet server and services use it. But not every OpenSSL implementation affected. Check your OpenSSL software version you use.

The affected versions of OpenSSL include OpenSSL 1.0.1 through 1.0.1f (inclusive). OpenSSL 1.0.1g, OpenSSL 1.0.0 branch and OpenSSL 0.9.8 branch are not vulnerable

Almost every Linux distribution come with OpenSSL by default. My self using FreeBSD, but the affected version is up to FreeBSD 9.2 or release that use OpenSSL version mentioned above. You can check in FreeBSD website.

Even in my local linux machine, which is Linux Debian 7.1 Wheezy affected by this. But Debian had release a fix in here.

What to do for user is make sure have a password which is changed every 30 days minimal. With this event, you better change your password. I even hear yahoo was affected and they fix it quickly, but who knows what had leaked.


Monday, 7 April 2014

Text To Speech in Linux Debian

Do you know that in linux, you can enjoy a good quality of text to speech application with good quality like the one available in Windows.

And just like other high quality open source software, these application are free to use.

The one i found out and used it is quite easy to use.

I will share it in here so you can benefit with the application.

First you need libreOffice, which will become the GUI. Neat right, because we usually use libreOffice to word processing office like apps.

Then we combine SVOX tools (pico) with LibreOffice.

To install in linux debian :

$sudo apt-get install libttspico0 libttspico-utils libttspico-utils 

And how to run the tts? well, we can use the LibreOffice extension.

Install the readtext extension of LibreOffice.

To install the readtext extension, just download the extension, then in LibreOffice, go to Tools - Extension Manager , and add the extension file.

After that you must reload LibreOffice. It will show up as a small smiling icon in the left side of the toolbar.


And to use it, just select the text, and click the readtext extension icon (a Happy face with a ballon) , a pop up will be shown, and setup the command line options to use PICO_READ_TEXT_PY .


Then you get a working text-to-speech system with the beauty of Open Source program.

Enjoy the text to speech system.

Tuesday, 1 April 2014

Debian linux Routing configuration

In Debian linux, i need to add some IP specific routing config. I have a default route for internet, and have other gateway for other services to access.

So i need to be able make the routing configuration is injected when the network services loaded.

How to do this are, in your /etc/network/interfaces add this :

auto eth0

iface eth0 inet static
  hwaddress 00:1b:24:b0:b7:8f
  address 192.168.113.109
  netmask 255.255.255.0
  broadcast 192.168.113.255
  gateway 192.168.113.224
  up route add -net 172.16.0.0 netmask 255.255.0.0 gw 192.168.113.204
  up route add -net 172.30.0.0 netmask 255.255.0.0 gw 192.168.113.205
  up route add -net 192.168.0.0 netmask 255.255.0.0 gw 192.168.113.206
  up route add -net 10.0.0.0 netmask 255.255.0.0 gw 192.168.113.104


So the result are like this :

Default traffic going to 192.168.113.224 , and traffic going to network 172.16.x.x going through gateway 192.168.113.204 , and same rule apply to the next network destination.

You can add more route according your needs.



Twitter Delicious Facebook Digg Stumbleupon Favorites More