Sunday, March 4, 2012

vim indent commands

>> Indent line by shiftwidth spaces
<< De-indent line by shiftwidth spaces
5>> Indent 5 lines
5== Re-indent 5 lines

>% Increase indent of a braced or bracketed block (place cursor on brace first)
=% Reindent a braced or bracketed block (cursor on brace)
<% Decrease indent of a braced or bracketed block (cursor on brace)
]p Paste text, aligning indentation with surroundings

=i{ Re-indent the 'inner block', i.e. the contents of the block
=a{ Re-indent 'a block', i.e. block and containing braces
=2a{ Re-indent '2 blocks', i.e. this block and containing block
>i{ Increase inner block indent

Monday, January 2, 2012

ptrace: Operation not permitted

I got above error when try to use Eclipse CDT to attach an running process for debugging.

It because of the ptrace protection since Ubuntu 10.10.

Here is the link to more detail explain
https://wiki.ubuntu.com/SecurityTeam/Roadmap/KernelHardening#ptrace%20Protection

To work around:
first need to enable root account
>sudo passwd root
>su
>echo 0 > /proc/sys/kernel/yama/ptrace_scope
>exit
re-disable root account for security reason
>sudo passwd -dl root

Now, it works

To permanently allow it edit /etc/sysctl.d/10-ptrace.conf and change the line to:
kernel.yama.ptrace_scope = 0

Monday, June 20, 2011

Git ---- denied: You cannot push changes not committed by you

If you get the PERMISSION DENIED error when try to push to a remote server, check the followings:
  • The author name and email should be the same as your git profile.
Expecially, the author name is FULL NAME of your profile on git server.

  • If you are using Linux, you also need to setup committer name and email to the same as git profile. otherwise, it will be youid@your_linux_host by default


To fix the permission problem:

>export GIT_COMMITTER_NAME="Your Fullname"
>export GIT_COMMITTER_EMAIL="Your Email"
>export GIT_AUTHOR_NAME="Your Fullname"
>export GIT_AUTHOR_EMAIL="Your Email"

//to back out the commit and index
>git reset HEAD^
//recommit and push again
>git commit
>git push