Thursday, January 24, 2013

Remove line by vi in known_hosts file

When IP of servers are changed you got:

[roman@local ~]$ ssh my_server
Warning: the RSA host key for 'cheetah' differs from the key for the IP address '192.168.153.156'
Offending key for IP in /home/roman/.ssh/known_hosts:3
Matching host key in /home/roman/.ssh/known_hosts:76
Are you sure you want to continue connecting (yes/no)?

We need to remove old server info online 3:
vi /home/rivanov/.ssh/known_hosts +3
press to remove current line"
"dd"
save:
:wq

Enjoy.!

Wednesday, January 23, 2013

Maven3 does not update repository to latest plugins

Maven update for plugins (--update-plugins) does not work in maven3. No way to get latest file
https://bg.reveredata.com/maven2/com/revere/maven/plugins/rdbds-maven-plugin/maven-metadata.xml
only one solution - exact version to specify, but in this case maven-metadata.xml is not updated even new plugin is downloaded and used on launch.

Details:
https://cwiki.apache.org/MAVEN/maven-3x-compatibility-notes.html#Maven3.xCompatibilityNotes-UniqueSnapshotVersionsandClassifiers
- "Automatic Plugin Version Resolution"
- "Plugin Metaversion Resolution"

Launch maven plugin by exact version


source:


mvn groupID:artifactID:version:goal
Example:
mvn org.apache.maven.plugins:maven-checkstyle-plugin:2.5:checkstyle



Monday, January 21, 2013

Fedora 18 for Dell Vostro 1510

1. New Installation in fedora 18 is crap.... I broke my mind when I tried to install it on required partition - far from intuitive.


2. change power button to ask what to do (source):

In order to get the Power Shutdown selection menu in Fedora 16, you must download dconf-editor with sudo yum install dconf-editor
Once this is done, open dconf editor from gnome, and navigate to ORG/Gnome/Setting Daemon/Plugins/Power and then modify the action on power button to be "Interactive".


3. Skype and google talk plugin it is necessary to install from terminal (source):
"yum localinstall skype-4.1.0.20-fedora.i586.rpm"


4. Problem with microphone...
lspci | grep Audio
00:1b.0 Audio device: Intel Corporation 82801H (ICH8 Family) HD Audio Controller (rev 03)

I did restart, install of
su
yum install gnome-media
changed level of microphone in "Sound" application, tab "Input" and it become alive.



5. install Cromium (source):
su
yum install wget
cd /etc/yum.repos.d/
wget http://repos.fedorapeople.org/repos/spot/chromium-stable/fedora-chromium-stable.repo
yum install chromium

6. Install Flash player to browsers
Follow instructions from: http://www.if-not-true-then-false.com/2010/install-adobe-flash-player-10-on-fedora-centos-red-hat-rhel/

7. Open terminal from Nautilus current folder:
yum install nautilus-open-terminal
No logout is required, just close all active Nautilus windows and launch it again.

8.Add rpmfusion repository, to add more packages (lha, unrar, unace archive support and more other stuff):

sudo yum localinstall --nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm

sudo nano /etc/yum.repos.d/rpmfusion-nonfree.repo
set in all rows: "gpgcheck=0"

9. Install Archive support packages (requires rpmfusion):
sudo yum install unrar p7zip p7zip-plugins lha arj unace dpkg

10. how to set up Caps Lock as language switch.
standard way to setup this in "Keyboard" or "Language and Regions" - does not work! :(
bug, workaround work perfectly well!


11. Install mp3 and other codecs for Fedora18
Follow http://jaisejames.wordpress.com/2012/11/30/fedora-18-missing-video-decoder-audio-decoder-codec-installing/
it will require to download gpg keys from http://rpmfusion.org/keys?action=AttachFile&do=view&target=RPM-GPG-KEY-rpmfusion-nonfree-fedora-18 but beware that nonfree kay is empty and will not work s so you might consider to use "gpgcheck=0" (see above).
Additional step require to put key in proper place with renaming to your architecture(i386 or x86_64):
cp RPM-GPG-KEY-rpmfusion-nonfree-fedora-18 /etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-nonfree-fedora-18-i386
cp RPM-GPG-KEY-rpmfusion-free-fedora-18 /etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-free-fedora-18-i386

...



Oracle recompile invalid objects


SQL to select all invalid objects(that have errors or need to be just recompiled because Oracle is lazy):
select
   object_type ,
   owner,
   object_name
from
   dba_objects
where
   status != 'VALID';
 
SQL to grab objects and try to recompile them to fileter out that have Errors and object that just invalidated by Oracle for any internal reason:
select
   'ALTER ' || object_type || ' ' ||
   owner       || '.' ||
   object_name || ' COMPILE;'
from
   dba_objects
where
   status != 'VALID'
   and (object_type='VIEW'
   or object_type='MATERIALIZED VIEW'
   or object_type='TRIGGER'
   or object_type='FUNCTION'
   or object_type='PROCEDURE'
   or object_type='PACKAGE'
);

select
   'ALTER PUBLIC ' || object_type || ' ' ||
   object_name || ' COMPILE;'
from
   dba_objects
where
   status != 'VALID'
   and object_type='SYNONYM'
   and owner='PUBLIC';

select
   'ALTER ' || object_type || ' ' || OWNER || '.' ||
   object_name || ' COMPILE;'
from
   dba_objects
where
   status != 'VALID'
   and object_type='SYNONYM'
   ;

-- SYNONYMs could be compiled only as sysdba , so do it by "sqlplus sys/oraclexe as sysdba"

select
   'ALTER ' || object_type || ' ' ||
   owner       || '.' ||
   object_name || ' COMPILE;'
from
   dba_objects
where
   status != 'VALID'
   and object_type='SYNONYM'
   and owner<>'PUBLIC';
 
select
   'ALTER PACKAGE' || ' ' ||
   owner       || '.' ||
   object_name || ' COMPILE BODY;'
from
   dba_objects
where
   status != 'VALID'
   and object_type='PACKAGE BODY';



Sunday, January 20, 2013

How to show git branch/status information in bash

extension for terminal/command line to use git more effectively:

For Mac users, (zsh): https://github.com/olivierverdier/zsh-git-prompt

For bash(works fine for Ubuntu): https://github.com/magicmonty/bash-git-prompt
I do following update for /home/USER/.bash/gitprompt.sh :
PROMPT_START="$WHITE$Time12a $Yellow$PathShort$ResetColor"
PROMPT_END=" $ "

For simple branch show(works very fast), (link second comment):
Simply add following line it ~/.bashrc
PS1='[\u@\h`__git_ps1` \W]\$ '



Saturday, January 5, 2013

Gitolite - permissions examples

Attention: Gitolite version 2.
Deny permission completely(no access for clone) for user @trial user group, all other full access:


@trial  = denis


repo    my_repo
   - =   @trial
   RW+  =   @all
   config gitolite-options.deny-repo = 1


Give user Jenkins permission only for Read/Fetch/Clone, all other full access:

repo    my_repo
   R    =   jenkins
   -    =   jenkins
   RW+  =   @all

Forbid "git push --force" for 'master' branch only to avoid repository history damage, all other branches could be rewinded ('--force'):

repo    my_repo
   RW  master  = @all
   -   master  = @all
   RW+         = @all



Examples: site1, site2,

Friday, January 4, 2013

Hotkeys for terminal advanced usage

Web Source: http://allhotkeys.com/ubuntu_hotkeys.html

the most useful and less known commands:

1) Ctrl+D = Log out from the current terminal. In X, this may log you out after a shuting down the emulator.
It is very useful if you have a lot of open terminals(with ssh connection to remote server) and you want to logout from them quickly(without typing 'exit' in each on them)

2) Ctrl+R = History search (Finds the last command matching the letters you type).
Previously I used "history | grep my_command", but this looks like more elegant.

3)Ctrl+L = Clears terminal output.