Wednesday, September 30, 2015

Sudo no password

all user no password

sudo visudo
..
ALL ALL=(ALL) NOPASSWD:ALL
 
spesific user no password
 
sudo visudo
....
<user> ALL=(ALL) NOPASSWD:ALL

Wednesday, September 2, 2015

Duplicating Raspberry Image The hard Way

Compressed backup system

Insert sdcard containing working raspberry system
says it way detected as /dev/sdc/

copying the partition
sudo sfdisk -d /dev/sdc > partition.layout

mounting the sdcard
sudo mount /dev/sdc2 /mnt
sudo mount /dev/sdc1 /mnt/boot

compressing your system
cd /mnt
sudo tar cjvf /home/user/imagerpi-0000.tar.bz2 *

unmounting sdcard
cd ~
sudo umount /mnt/boot
sudo umount /mnt
unplug your sdcard

Cleanup log file

Simple script to clean up log file
vi cleanlog

#-------------------------------------------------------
#!/bin/bash

# Make sure only root can run our script
if [ "$(id -u)" != "0" ]; then
   echo "$0 must be run as root" 1>&2
   exit 1
fi

if [ "$1" ];then
   LOGDIR=$1
   if [ ! -d "$1" ];then
      echo "$1 not exist"
      exit 0
   fi
else
   LOGDIR="/var/log"
fi

Friday, August 28, 2015

Pretty OSMC

Just download the latest osmc for Raspberry, burn it to sdcard and plug.
Install kore at your android, enable service->webserver->remote http at your osmc,
Huray... i got media centre with remote control :)


The same does with openelec and xbian, it's pretty, and off course available for raspberry pi.

Saturday, August 22, 2015

Clock skew detected. Your build may be incomplete.

Happen to me many times, and keep forgeting this:

find . -exec touch {} \;

Bye bye "Clock skew detected. Your build now can be completed." :)

Thursday, August 20, 2015

Running Xorg From rc.local as common user

To start Xserver with no desktop manager at boot time and run as common user, simply put this line at /etc/rc.local
setsid sh -c 'su -c startx username <> /dev/tty1 >&0 2>&1' &

Replace the startx with your Xserver application such as startxfce, startlxde etc.

In my system i want to run the xterm on 1024x768 monitor with whole area active, no need mouse moved to active xterm area, says the geometri of xterm to cover whole area would be 170x59 character size, the command became:
setsid sh -c 'su -c "xinit -geometry 170x59" username <> /dev/tty1 >&0 2>&1' &

Ref: http://unix.stackexchange.com/questions/146758/how-do-i-run-as-a-limited-user-while-logged-in-as-root-and-another-question

VIm Cheatsheet

Cursor movement
h - move cursor left
j - move cursor down
k - move cursor up
l - move cursor right
w - jump forwards to the start of a word
W - jump forwards to the start of a word (words can contain punctuation)
e - jump forwards to the end of a word
E - jump forwards to the end of a word (words can contain punctuation)
b - jump backwards to the start of a word
B - jump backwards to the start of a word (words can contain punctuation)
0 - jump to the start of the line
^ - jump to the first non-blank character of the line
$ - jump to the end of the line
G - go to the last line of the document
5G - go to line 5
Tip Prefix a cursor movement command with a number to repeat it. For example, 4j moves down 4 lines.