Raspberry Pi 2 Unboxing

New toy!!!!








By penoi on Friday, February 13, 2015 | , | A comment?

OnePlus One

Matagal na akong IOS device user. Nagsimula sa Apple Iphone 4 then Iphone5. Although, my first smartphone device was a Sony Ericsson Xperia X10 android phone.

Siguro masyado lang ako na-bored sa user interface ng IOS kaya bumalik ulit ako sa Android. Matagal ko din pinagisipan kung Google Nexus 6 or OnePlus One... Nexus6 have superb up-to-date specs... but price-wise, I got OnePlus One. Since in my opinion(yung may mga budget), max lifespan lang ng isang phone ay 2 years.... magpapalit ka na agad(again, if you have the budget)

OnePlus One
My unit still has the Cyanogen logo at the back


OnePlus One with tempered glass and Diztronic casing




By penoi on Saturday, January 31, 2015 | , , | A comment?

How to get the last IP address on the Subnet using Ruby



>> require 'ipaddr'
>> ip=IPAddr.new("192.168.1.0/24")
=> #<IPAddr: IPv4:192.168.1.0/255.255.255.0>
>> gateway=IPAddr.new(ip.to_range.last.to_i-1,ip.family).to_s
=> "192.168.1.254"
>> ip=IPAddr.new("192.168.1.0/20")
=> #<IPAddr: IPv4:192.168.0.0/255.255.240.0>
>> gateway=IPAddr.new(ip.to_range.last.to_i-1,ip.family).to_s
=> "192.168.15.254"


to get the first ip of the subnet
 >> gateway=IPAddr.new(ip.to_range.first.to_i+1,ip.family).to_s

By penoi on Friday, January 23, 2015 | | A comment?

Posting from mobile

Post test from mobile

By penoi on Friday, January 9, 2015 | | A comment?

penoycentral.net dead

after years of maintaining penoycentral.net, i've decided to end it.

By penoi on Wednesday, January 7, 2015 | A comment?

Wordpress to blogger

This is my first post using blogger from smartphone. Yeah i've changed my blog hosting from wordpress to blogger after someone hacked my supposedly patched wordpress. Anyway, been contemplating to move to blogger anyway.. Free hosting and bandwidth without thinking of any security stuffs.

By penoi on Saturday, February 2, 2013 | | A comment?

RaspberryPi+raspbian+ratpoison

Setting up a web kiosk system using raspberrypi+raspbian+ratpoison

This instruction assumes that you already installed raspbian on your SD card

Installing required packages

sudo apt-get update
sudo apt-get ratpoison
sudo apt-get chromium
sudo apt-get x11vnc
sudo apt-get install x11-xserver-utils


=====

Start user pi at startup

pi@raspberrypi:~$ grep pi /etc/inittab 
1:2345:respawn:/bin/login -f pi tty1 
/dev/tty1 2>&1

pi@raspberrypi:~$ cat /home/pi/.bash_profile
if [ -z "$DISPLAY" ] && [ $(tty) == /dev/tty1 ]; then
startx
fi

=====

Set ratpoison's config file

pi@raspberrypi:~$ cat /home/pi/.xinitrc
exec ratpoison


pi@raspberrypi:~$ cat /home/pi/.ratpoisonrc
banish
exec xset s off
exec xset -dpms
exec unclutter -root
exec x11vnc -loop
exec /usr/bin/chromium --kiosk http://www.penoycentral.net


Remotely connec thru vnc
vncviewer raspberrypi.local

By penoi on Wednesday, November 21, 2012 | | A comment?

Enable DNS queries in BIND

# rndc querylog 


Query logs should be logged on /var/log/messages

To turn off

# rndc querylog


ref: http://www.cyberciti.biz/faq/howto-enable-dns-linux-unix-server-logging/

By penoi on Friday, November 2, 2012 | | A comment?

bash: scp: command not found

scp file.rar root@192.168.11.60:/var/tmp/
root@192.168.11.60's password:
bash: scp: command not found
lost connection


 

i forgot that i have done a minimal server install on the receiving end. installing openssh-clients solve the problem

By penoi on Thursday, November 1, 2012 | , , | A comment?

Vi/VIM

To insert characters on the beginning of a line. Example, insert // from line 1 to 10

 :1,10s!^!//! 


Sample in creating folding in vim. Insert #{{{ text here #}}} provided everything was properly setup on vimrc


~/workspace/puppetworks $ cat site.pp
node 'chrisp.lab.local' {#{{{




}#}}}



pressing zc will close the folded texts


+-- 6 lines: node 'chrisp.lab.local' {#----------------------------------------------------------------------------


ref: http://www.linux.com/learn/tutorials/442438-vim-tips-folding-fun

By penoi on Monday, October 1, 2012 | , | A comment?

Separating logs per hostname on a Central rsyslog server

Under /etc/rsyslog.conf append


$FileCreateMode 0655
$DirCreateMode 0755
$Umask 0022

$template default,"/srv/logs/%HOSTNAME%/%$now%.log"
*.* ?default


this will create directories under /srv/logs//*.logs with Directory permission of 755 and file permission of 655

By penoi on Sunday, September 30, 2012 | A comment?

Apology Accepted!!!

Vmware apologizes for technical difficulties on the recent webcast Technology Day Online. It looks like the webcast provider was caught off guard on the situation. To compensate, VMware will be sending me a USB memory stick containing all of the materials presented on the said event.

Well.. apology accepted!!!!! :)

By penoi on Thursday, September 20, 2012 | | A comment?

Our Samsung LCD TV retired

Our Samsung LCD TV retired after exactly 3 yrs of service. Bad thing is that it is already out of warranty. Yesterday the screen suddenly turns to white that you can barely see the images.

By penoi on Monday, August 6, 2012 | | A comment?

sed Galore

Find and replace string recursively

find /home/penoycentral/whichfolder -type f -print0| xargs -0 sed -i 's/oldstring/newstring/g'


If you want to make sure that you are changing which, use the old grep first
find /home/penoycentral/whichfolder -type f -print0| xargs -0 grep -i oldstring


Example Problem: Change /etc/bind to /var/named/master in named.conf

Just print what will be changed
 sed -n 's/\/etc\/bind/\/var\/named\/master/p' named.conf 


to change:
 sed -i 's/\/etc\/bind/\/var\/named\/masterr/g' named.conf 


Change double qoute to single qoute
sed -i "s/[\"]/\'/g" some-file.pp


Referrence:
http://stackoverflow.com/questions/1583219/awk-sed-how-to-do-a-recursive-find-replace-of-a-string

By penoi on Wednesday, June 27, 2012 | | A comment?

How to check DNS change global Propagation

DNS change progation is one of sysads problem. After a dns record change, nslookup result will differ depending on which region you are in.

Check your DNS global progation

 http://www.whatsmydns.net/

By penoi on Thursday, June 21, 2012 | | A comment?

Mercurial hgwebdir on CentOS 6

Note this setup is unsecured and just for the purpose of having my own lab svn repo.

Install mercurial on your server

yum install mercurial


Setup the mercurial site on apache

mkdir /var/www/cgi-hg
cp /usr/share/doc/mercurial-1.4/hgwebdir.cgi /var/www/cgi-hg/
chmod +x /var/www/cgi-hg/hgwebdir.cgi


Create the hgweb.config
 /var/www/cgi-hg/hgweb.config
[paths]
#VIRTUAL_PATH = /REAL/PATH
#myproject = myproject
lab = /srv/hg


Reload apache
service httpd reload


Make sure everything has the right permission on selinux or you can temporarily disable selinux

Your site now is accessible thru http://servername/hg

To test push functionality,you might try to disable ssl and allow push to all

/srv/hg/.hg/hgrc

[web]
allow_push = *
push_ssl = false



Ref:
http://mercurial.selenic.com/wiki/RHEL4HgWebDirSetup
http://mercurial.selenic.com/wiki/PublishingRepositories

By penoi on Saturday, June 16, 2012 | | A comment?

Devops Singapore Meetup Puppet in production session



Devops Singapore Meetup Puppet in production session

By penoi on Thursday, June 14, 2012 | | A comment?

Quick iptables gateway setup

eth0 - with internet connection as they say
eth2 - local network


echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i eth2 -j ACCEPT

By penoi on Monday, June 11, 2012 | | A comment?

Quick mail sending test


penoy@fedora:~$ mail -s "test sending mail from nix server" penoy@example.com < /dev/null

By penoi on Friday, June 8, 2012 | | A comment?

Port forwarding to a different IP:port using iptables


sysctl net.ipv4.ip_forward=1
iptables -t nat -A PREROUTING -p tcp --dport 3129 -j DNAT --to-destination ip-address:3128
iptables -t nat -A POSTROUTING -j MASQUERADE
iptables -L
iptables -t nat -L -n -v
iptables-save

By penoi on Tuesday, June 5, 2012 | | A comment?