Vim Tricks

[:de]

Von Zeit zu Zeit schaltet sich das Syntax-Highlighting aus, so kann man es wieder starten oder neustarten:

:syn on | off

[:en]From time to time the syntax highlighting gets messed up, here how to restart it:

:syn on | off[:pl]

Od czasu do czasu wyłącza się podświetlanie składni, tak można go ponownie uruchomić:

:syn on | off

[:]

Screen TricksScreen TricksScreen Tricks

Some usefull stuff about the screen command under Linux:

How to split screen in screen 🙂

1. Create a split: C-a |
2. Move between splits: C-a
3. Create windows inside screens: C-a c

Some usefull stuff about the screen command under Linux:

How to split screen in screen 🙂

1. Create a split: C-a |
2. Move between splits: C-a
3. Create windows inside screens: C-a c

Kilka wskazówek na temat komendy screen w linuksie:

Jak podzielić widok w pionie 🙂

1. Podziel widok: C-a |
2. Poruszaj się między widokami: C-a
3. Utwórz nowe okno w widoku: C-a c

Linux Tricks

In this article i would like to share some linux command tricks, which may help you through the admin day.

count the connection per port:
netstat -plan|grep :80|awk {‚print $5‘}|cut -d: -f 1|sort|uniq -c|sort -nk 1 | wc -l
delete files older than 5 days:
find /path_to_check/temp* -type d -ctime +5 -exec rm -Rf {} \;
show zombie processes:
ps aux | awk ‚{ print $8 “ “ $2 }‘ | grep -w Z
kill zombies:
ps -ef | grep defunct | awk ‚{ print $3 }‘ | xargs kill -9

Git Tricks

Recover orgnal files from repository:
reset to HEAD
git reset –hard HEAD
git pull

GitVideo (gource required)
gource –bloom-multiplier 1.2 –bloom-intensity 1.2 –seconds-per-day 10 –title „mediAsystent“ –auto-skip-seconds 1 -1280×720

Yii TricksYii TricksYii Tricks

Name des Kontrollers:
Yii::app()->controller->id

oder

Yii::app()->getController()->getId()
Neuer Eintrag oder ändern in der Datenbank:
if (($model = ModelObject::model()->findByPk($obj_id))===null){
                    $model=new ModelObject;
                    $model->OBJ_ID = $obj_id;
                    $model->GROUP_ID = NULL;
                    .
                    .
                    .
                }
                else{
                    $model->OBJ_ID = $obj_id;
                    $model->GROUP_ID = NULL;
                    .
                    .
                    .
                }
                $model->save(); // save or update group record
Lesen GET/POST data

Yii::app()->request->getQuery($key, $defaultValue); // POST
Yii::app()->request->getPost($key, $defaultValue); // GET