Thursday, October 1, 2015

Saturday, July 18, 2015

[RPI] Bluethooth Pairs

18 July 2015

sudo apt-get install bluetooth bluez-utils blueman
sudo apt-get install bluez-compat
sudo bluez-simple-agent hci0 48:86:E8:B5:2B:7A
sudo pand --connect 48:86:E8:B5:2B:7A -n
dhclient bnep0

Referensi
http://www.modmypi.com/blog/installing-the-raspberry-pi-nano-bluetooth-dongle
http://www.ctheroux.com/a-step-by-step-guide-to-setup-a-bluetooth-keyboard-and-mouse-on-the-raspberry-pi/
http://m-jorgensen.dk/how-to-enable-pan-on-raspberry/

Thursday, July 16, 2015

[RPI] Yicam - Resize - Tweet via Raspberry Pi

16 July 2015

RPI Config for live image Yicam - Rpi - Resize - Tweet

sudo apt-get install python-setuptools
sudo easy_install pip
sudo apt-get install libjpeg-dev
sudo pip-3.2 install pillow
sudo pip-3.2 install TwitterApi

Gunakan pyton3 command

python3 yirestwet.py

Referensi
- http://stackoverflow.com/questions/8915296/python-image-library-fails-with-message-decoder-jpeg-not-available-pil
- http://pi-camera.blogspot.com/p/raspberry-pi-setup.html
- https://www.raspberrypi.org/forums/viewtopic.php?f=32&t=97326
- https://github.com/deltaflyer4747/Xiaomi_Yi/blob/master/Standalone_scripts/Camera_photo.py
- http://copter.sovgvd.info/a/Xiaomi-Yi-protocol-remote-control
- https://www.youtube.com/watch?v=WrtebUkUssc
- https://gist.github.com/capung48/0f2f73d599f2de8100eb

Friday, July 3, 2015

[PYTHON] Twitter API POST Test

3 July 2015

Installation TwitterAPI by geduldig

1. python -m pip install TwitterAPI


Referensi
-https://github.com/geduldig/TwitterAPI
-http://stackoverflow.com/questions/13111222/windows-7-python-3-2-file-not-found-on-open

Thursday, July 2, 2015

[PYTHON] Beautiful Soup pada Windows CMD

2 July 2015

Installasi beautifulsoup windows via command prompt

1. python -m pip install -U pip (upgrade pip)
2. python -m pip install beautifulsoup4

Refferensi
-http://www.crummy.com/software/BeautifulSoup/

[PYTHON] JKT NEWS (updated)

2 July 2015



My first Python script
Ngambil berita terakhir dari web official jkt


Menggunakan BeautifulSoup

Refferensi
-https://www.daniweb.com/software-development/python/threads/213221/urllib-in-python-3-1
-http://pythonprogramming.net/parse-website-using-regular-expressions-urllib/
-http://www.crummy.com/software/BeautifulSoup/bs4/doc/

Monday, June 29, 2015

[DEBIAN] Installasi Samba

29 Juni 2015

Instalasi SAMBA pada server Debian mungkin possible juga diimplementasikan ke RPI (referensi link ada di dasar post)

1. sudo apt-get install samba
2. sudo nano /etc/samba/smb.conf

[name-folder]
path = /path/to/dir
browseable = yes
writeable = yes
guest ok = no
public = no
read only = no
security = user

3. sudo smbpasswd -a user
4. sudo service samba restart

catatan:
- pembuatan user untuk samba samakan dengan user yang sudah ada, jika belum ada buat user dengan adduser
- perhatikan owner & permission pada directory yang akan disamba
- install samba-common-bin untuk raspberry pi

Referensi:
-http://endrisuryanti.blogspot.com/2015/02/install-samba-di-linux-debian-server.html
-https://www.digitalocean.com/community/tutorials/how-to-add-delete-and-grant-sudo-privileges-to-users-on-a-debian-vps

Wednesday, June 24, 2015

[CheatSheet] PHP MySQL

22 Juni 2015

MYSQL

- Reset auto increment
ALTER TABLE tablename AUTO_INCREMENT = 1

- clear table
TRUNCATE TABLE tablename

- select table
SELECT * FROM table

- insert row
INSERT INTO table_name (column1, column2, column3,...)
VALUES (value1, value2, value3,...)

- insert multi row
INSERT INTO table_name (column1, column2, column3,...)
VALUES (value1, value2, value3,...),
       (value1, value2, value3,...),
       (value1, value2, value3,...);

PHP5

-date
date("Y-m-d");                         // 2015-10-01

-time
date("Y-m-d H:i:s");                   // 2015-10-01 17:03:18

-do while
$x = 1; 
do {
    echo "The number is: $x <br>";
    $x++;
}

while ($x <= 5);


-call db
$query = 'SELECT * FROM table';
$mysql = $conn->query($qno);
if ($mysql->num_rows > 0) {
    while($row = $result->fetch_assoc()) {
//interesting here
    }
}

Monday, June 22, 2015

[OpenWRT] Add on

22 Juni 2015

Beberapa add-on yang ku install pada openwrt

- enable sftp
opkg install openssh-sftp-server

- nano
opkg install nano

- wget
opkg install wget

Referensi
http://wiki.openwrt.org/doc/howto/sftp.server
http://www.cyberciti.biz/faq/wget-example-download-from-https-web-sites/

Sunday, June 21, 2015

[OpenWRT] Extroot OpenWRT

21 Juni 2015

Extroot OpenWrt Attitude Adjustment 12.09-rc1 - OpenWrtID / LuCI 0.11 Branch (0.11+svn9599) di TP-LINK MR3420 v2

1. Format Flashdisk
-partisi 1 = primary dengan format ext4 (size besar)
-partisi 2 = primary dengan format linux swap (size kecil)
2. Colok flashdisk ke router dan login via ssh
3. cek UUID flashdisk dengan format ext4 dengan command blkid
4. copy UUID
5. masuk web interface openwrt
6. system - mount point - mount point - edit
general setting
7. enable mount (ceklis)
8. mount point root (/)
9. use as root file system (ceklis)

advance
10. paste UUID flashdisk - save

11. kembali ke system - mount point - swap - edit
general setting
12. enable this swap (ceklis)
13. save and reboot

catatan:
- pada versi ini kmod-usb-storage kmod-fs-ext4 sudah terinstall

Referensi:
-https://www.youtube.com/watch?v=at_UZHkOYI8
-http://www.kaskus.co.id/show_post/000000000000000493416937/3/optional

Sunday, June 7, 2015

[RPI] Instalasi OPENVPN pada Raspberry Pi

7 Juni 2015



Instalasi OPENVPN pada Raspberry Pi, mengikuti tutorial dari mas ari-f berikut dapat di implementasikan ke rpi (link ada di dasar post)

1. Test RPI dengan command cat /dev/net/tun
jikalau muncul cat: /dev/net/tun: File descriptor in bad state artinya dapat melanjutkan instalasi openvpn.
2. sudo -s masuk sebagai root3. apt-get update && upgrade -y update RPI
4. cp -a /usr/share/doc/openvpn/examples/easy-rsa /etc/openvpn copy sample script ke /etc/openvpn
5. cd /etc/openvpn/easy-rsa/2.0 change dir /etc/openvpn/easy-rsa/2.0
6. source ./vars
7. ./clean-all
8. ./build-ca buat cert (dikosongkan saja enter enter)
9. ./build-dh buat diffie hellman parameter
10. ./build-key-server server01 generate certificate server (dikosongkan tak mengapa diakhir pertanyaan jawab dengan: yes)
11. openvpn --genkey --secret keys/ta.key udp flood protection
12. cd /etc/openvpn change dir /etc/openvpn
13. nano server.conf buat file server.conf
port 1194
proto udp
dev tun
ca keys/ca.crt
cert keys/server01.crt
key keys/server01.key
dh keys/dh1024.pem
plugin /usr/lib/openvpn/openvpn-auth-pam.so login
client-cert-not-required
username-as-common-name
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "redirect-gateway def1"
push "dhcp-option DNS 4.2.2.1"
push "dhcp-option DNS 4.2.2.2"
keepalive 5 30
comp-lzo
persist-key
persist-tun
status server-tcp.log
verb 3
14. nano server-tcp.conf buat file server-tcp.conf
port 465
proto tcp
dev tun
ca keys/ca.crt
cert keys/server01.crt
key keys/server01.key
dh keys/dh1024.pem
plugin /usr/lib/openvpn/openvpn-auth-pam.so login
client-cert-not-required
username-as-common-name
server 10.9.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "redirect-gateway def1"
push "dhcp-option DNS 4.2.2.1"
push "dhcp-option DNS 8.8.8.8"
keepalive 5 30
comp-lzo
persist-key
persist-tun
status server-tcp.log
verb 3
15. mkdir /etc/openvpn/keys buat folder untuk keys
16. cp /etc/openvpn/easy-rsa/2.0/keys/{ca.crt,server01.crt,server01.key,dh1024.pem,ta.key} /etc/openvpn/keys/ copy ca.crt,server01.crt,server01.key,dh1024.pem,ta.key ke keys folder
17. nano /etc/default/openvpn edit config openvpn dan uncoment AUTOSTART=ALL
18. /etc/init.d/openvpn restart restart openvpn
19. lsof -i |grep openvpn cek parameter (harus ada TCP dan UDP yang UP)
20. nano /etc/sysctl.d/forwarding.conf buat file untuk konfigurasi forwarding
net.ipv4.ip_forward=1
21. sysctl -p /etc/sysctl.d/forwarding.conf
22. iptables -t nat -I POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE setting iptables UDP
23. iptables -t nat -I POSTROUTING -s 10.9.0.0/24 -o eth0 -j MASQUERADE setting iptables TCP
24. mkdir clientconfig buat folder clientconfig dalam folder /etc/openvpn
25. cp /etc/openvpn/easy-rsa/2.0/keys/{ca.crt,ta.key} clientconfig/ copy ca.crt ta.key ke folder client config
26. cd clientconfig change directory client config
27. nano PI-UDP.ovpn buat konfigurasi client UDP
client
dev tun
proto udp
remote (IP RASPI) 1194
resolv-retry infinite
route-method exe
resolv-retry infinite
nobind
persist-key
persist-tun
ca ca.crt
auth-user-pass
comp-lzo
verb 3
28. nano PI-TCP.ovpn buat konfigurasi client TCP
client
dev tun
proto tcp
remote (IP RASPI) 465
resolv-retry infinite
route-method exe
resolv-retry infinite
nobind
persist-key
persist-tun
ca ca.crt
auth-user-pass
comp-lzo
verb 3
29. login ssh sebagai root dan copy ca.crt PI-UDP.ovpn PI-TCP.ovpn 
jika belum ada password untuk root: sudo passwd root dan ketikkan passwordnya
30. copy ke config client dan jalankan.

Referensi:
-http://www.ari-f.com/mumet-ndase/ok-baiklah-nih-tutorial-instal-openvpn-di-vps-debian
-https://www.raspberrypi.org/forums/viewtopic.php?p=67232

[CONSOLE] Looping Script

7 Juni 2015

Membuat program looping

> Windows bat

> Linux sh
$ cat every-5-seconds.sh
#!/bin/bash
while true
do
   /home/ramesh/backup.sh
   sleep 5
done
Referensi:
- http://www.thegeekstuff.com/2011/07/cron-every-5-minutes/
- http://stackoverflow.com/questions/166044/sleeping-in-a-batch-file
- http://ss64.com/nt/for.html

Saturday, April 11, 2015

[PHP] Simple Email dengan PHP Mailer

11 April 2015

Intro::

Simple send email menggunakan PHPMAILER dengan akun Gmail.

Steps::

Download Script PHPMAILER
1. https://github.com/PHPMailer/PHPMailer
2. install & extract localhost/twitplay/lib/phpmailer/

Simple Parsing html
1. copas script dibawah ini dan jangan lupa mengganti username_gmail, password_gmail, name, to_email

<?php
require 'lib/phpmailer/PHPMailerAutoload.php';
$mail = new PHPMailer;

$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;

//from username
$mail->Username = 'username_gmail';
$mail->Password = 'password_gmail';
$mail->SMTPSecure = 'ssl';
$mail->Port = 465;
$mail->From = 'username_gmail@gmail.com';
$mail->FromName = 'name';

//to email
$mail->addAddress('to_email@example.com');
//$mail->addCC('cc@example.com');
//$mail->addBCC('bcc@example.com');

//attachment
//$mail->addAttachment('/var/tmp/file.tar.gz');
$mail->addAttachment('img/yupi.jpg');
$mail->isHTML(true);

//body
$mail->Subject = 'Hello World';
$mail->Body    = 'Yupi was Here.';
//$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';

if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
    echo 'Message has been sent';
}

?>

2. simpan email.php dan panggil di browser

Catatan::

attachment yupi.jpg jangan lupa dimasukan kedalam folder /img/

[PHP] Simple Remote Imageshack Upload

11 April 2015

Intro::

Simple Remote Imageshack Upload menggunakan remote image uploader by ptcong

Steps::

Download Script Remote Image Uploader
1. https://github.com/ptcong/php-remote-image-uploader
2. install & extract localhost/twitplay/lib/remoteupload/

Buat Applikasi Imageshack mendapatkan api key
1. https://imageshack.com/contact/api
2. isi form kemudian catat api_key

Simple Upload Imageshack
1. copas script dibawah ini dan jangan lupa mengganti username, password, api_key

<?php
include 'lib/remoteupload/autoload.php';
include 'lib/remoteupload/ChipVN/ClassLoader/Loader.php';
ChipVN_ClassLoader_Loader::registerAutoLoad();

$uploader = ChipVN_ImageUploader_Manager::make('Imageshack');
$uploader->login('username', 'password');
$uploader->setApi('api_key');

//dir upload
echo $uploader->upload(getcwd(). '/img/yupi.jpg');

//link upload
//echo $uploader->transload('http://img33.imageshack.us/img33/6840/wz7u.jpg');


?>

2. simpan testupload.php dan panggil di browser

Catatan::

Jangan lupa menginstall class loader dalam /twitplay/lib/remoteupload/
>https://github.com/ptcong/php-chipvn-classloader
>https://github.com/ptcong/php-http-client
>https://github.com/ptcong/php-cache-manager

[PHP] Simple HTML Parser

11 April 2015
Inspect Element

Intro::


Simple HTML parser, pake Simple DOM HTML Parser.

Steps::

Download Script DOM Html Parsser
1. http://simplehtmldom.sourceforge.net/
2. install & extract localhost/twitplay/lib/dom/

Simple Parsing html
1. copas script dibawah ini untuk parsing Berita Terbaru dari official jkt48

<meta charset="UTF-8">
<?php include "lib/dom/simple_html_dom.php"; 

// Create DOM from URL or file
$url = 'http://jkt48.com/news/list?lang=id';
$html = file_get_html($url);

//set counter
$c = 1;

// Find all post
foreach($html->find('div[class=post]') as $element){
foreach($element->find('div[class=contentpink]') as $element2){
// $c as counter
echo $c.'. ';
echo $element2->find('div[class=excerpt]')[0]->plaintext;
echo ' ';
echo $element2->find('div[class=metadata]')[0]->innertext;
echo '<br><br>';
$c++;
}
}

?>

2. simpan beritajkt.php dan panggil di browser

Catatan::

Simple html dom parser manual : http://simplehtmldom.sourceforge.net/manual.htm

Friday, April 10, 2015

[PHP] Twitter POST API simple

10 April 2015

Intro::

Simple POST update status example buat twitter API via PHP, menggunakan script Abraham.

Steps::

Buat Applikasi Twitter untuk mendapatkan token & secret code
1. https://apps.twitter.com/
2. copy & catat, consumer keyconsumer secretaccess tokenaccess token secret

Download Script TwitterOAuth PHP (versi Abraham)
1. https://github.com/abraham/twitteroauth
2. install & extract localhost/twitplay/lib/twitteroauth/

Simple Post Update
1. copas script dibawah ini dan jangan lupa mengganti consumer keyconsumer secretaccess tokenaccess token secret

<?php include "lib/twitteroauth/autoload.php";
use Abraham\TwitterOAuth\TwitterOAuth;

$consumer = "consumer key";
$consumersecret = "consumer secret";
$accesstoken = "access token";
$accesstokensecret = "access token secret";
$twitter = new TwitterOAuth($consumer, $consumersecret, $accesstoken, $accesstokensecret);
$content = $twitter->get("account/verify_credentials");

//POST UPDATE
$update = 'Testing post via API cc: @radenfaris';
if (strlen($update) < 140){
$updates = $twitter->post("statuses/update", array("status" => $update));
echo "Success updateted - ".$update;
}

?>

2. simpan posttweet.php dan panggil dengan /localhost/twitplay/posttweet.php



Simple Post Update dengan image
1. copas script dibawah ini dan jangan lupa mengganti consumer keyconsumer secretaccess tokenaccess token secret

<?php include "lib/twitteroauth/autoload.php";
use Abraham\TwitterOAuth\TwitterOAuth;

$consumer = "consumer key";
$consumersecret = "consumer secret";
$accesstoken = "access token";
$accesstokensecret = "access token secret";
$twitter = new TwitterOAuth($consumer, $consumersecret, $accesstoken, $accesstokensecret);
$content = $twitter->get("account/verify_credentials");

//tweets
$update = 'Test update via API dengan image cc: @radenfaris';

//image path
$image = 'img/indah.jpg';
if (strlen($update) < 120){
$media = $twitter->upload('media/upload', array('media' => $image));
$param = array(
'status' => $update,
'media_ids' => implode(',', array($media->media_id_string)),
);
$updates = $twitter->post('statuses/update', $param);
echo "Success updateted - ".$update;
}


?>

2. simpan postimage.php dan panggil dengan /localhost/twitplay/postimage.php

Catatan::

yupi.jpg jangan lupa dimasukan kedalam folder /img/Twitter Rest API : https://dev.twitter.com/rest/public
TwitterOAuth PHP Abraham : https://github.com/abraham/twitteroauth

[PHP] Twitter GET API simple

10 April 2015

Intro::

Simple GET timeline example buat twitter API via PHP, menggunakan script Abraham.

Steps::

Buat Applikasi Twitter untuk mendapatkan token & secret code
1. https://apps.twitter.com/
2. copy & catat, consumer key, consumer secret, access token, access token secret

Download Script TwitterOAuth PHP (versi Abraham)
1. https://github.com/abraham/twitteroauth
2. install & extract localhost/twitplay/lib/twitteroauth/
3. copas script dibawah ini dan jangan lupa mengganti consumer keyconsumer secretaccess tokenaccess token secret

<?php include "lib/twitteroauth/autoload.php";
use Abraham\TwitterOAuth\TwitterOAuth;

$consumer = "consumer key";
$consumersecret = "consumer secret";
$accesstoken = "access token";
$accesstokensecret = "access token secret";
$twitter = new TwitterOAuth($consumer, $consumersecret, $accesstoken, $accesstokensecret);
$content = $twitter->get("account/verify_credentials");

//query twitter
$tweets = $twitter->get("statuses/user_timeline",
array( 'screen_name' => 'radenfaris',
'count'=>20,
));

$c=1;

foreach($tweets as $tweet){
echo $c.'. '.$tweet->text.'<br>';
$c++;
}


?>

4. simpan mytweet.php dan panggil dengan /localhost/twitplay/mytweet.php

Catatan::

Twitter Rest API : https://dev.twitter.com/rest/public

Thursday, April 9, 2015

[PHP] Wamp Server Test

9 April 2015

Intro::

Instalasi Apache web server di windows menggunakan wamp server. Wamp server sudah termasuk PHP5, MYSQL, PHPMYADMIN

Steps::

Download dari web resmi Wamp
1. http://www.wampserver.com/en/
2. pilih download versi 32bit/64bit
3. Install
4. Buka applikasi wamp server dan put it online

Test php
1. Tulis script dibawah ini
<?php phpinfo(); ?> 
2. Simpan dengan nama testphp.php di folder
C:\wamp\www\
3. Open browser dengan URL
http://localhost/testphp.php

Test PhpMyAdmin
1. Terinstall pada /phpmyadmin
http://localhost/phpmyadmin
Test MySQL

1. Buka PHPmyadmin dengan membuka halaman
http://localhost/phpmyadmin
2. Buat database dengan nama myoshi
3. pilih database myoshi kemudian pilih import
4. upload myoshi.sql dan klik go

PHP-MYSQL
1. buat file dengan nama myoshi.php di localhost (C:\wamp\www\)
paste kode dibawah ini

<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "myoshi";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
     die("Connection failed: " . $conn->connect_error);
}
$result = $conn->query('SELECT * FROM profil WHERE oshimen=1');
while($row = $result->fetch_assoc()){
echo 'Oshimen: '.$row["nama"];
}
?>

Catatan::

Diperhatikan servername dan password default adalah root dan 'blank'.

Saturday, March 21, 2015

[RPI] Instalasi Apache, PHP, MySql, PHPmyAdmin, PHP Curl dalam Raspberry (updated)

20 Maret 2015
Raspberry PHP

Intro::

Raspberry Pi instalasi Apache, PHP5, MYSQL, PHPMYADMIN

Steps::

Instalasi Apache

sudo apt-get install apache2 -y *installasi apache
untuk test di browser ketik IP Rpi.
sudo nano /var/www/index.html *optional untuk edit index.html

Instalasi PHP5
sudo apt-get install php5 libapache2-mod-php5 -y *instalasi PHP5
cd /var/www/ *change directory
sudo cp index.html index_old.html *rename index.html -> index_old.html
sudo nano index.php *buat file index.php
untuk test masukan script dibawah ini
<?php phpinfo(); ?> 
open browser untuk melihat berhasil/tidak

Instalasi Mysql
sudo apt-get install mysql-server php5-mysql -y *instalasi mysql server
akan diminta password mysql

Instalasi PHPmyAdmin
sudo apt-get install phpmyadmin -y *instalasi phpmyadmin
   >pilih apache2
   >masukan password mysql 
   >OK
- sudo nano /etc/apache2/apache2.conf *update konfigurasi apache
tambahkan
Include /etc/phpmyadmin/apache.conf
sudo /etc/init.d/apache2 restart *restart apache
- phpmyadmin terinstall di "yourpiaddress"/phpmyadmin


Instalasi Curl-PHP

sudo apt-get install php5-curl -y 


Finish move
cd /var/www
sudo chown pi: .
rm *


If use no password on phpmyadmin:
- sudo nano /etc/phpmyadmin/config.inc.php
- uncomment $cfg['Servers'][$i]['AllowNoPassword'] = TRUE;

Documentation::

- http://www.raspberrypi.org/documentation/remote-access/web-server/apache.md
- http://www.raspberrypi.org/documentation/usage/wordpress/README.md
- http://www.raspipress.com/2012/09/tutorial-install-phpmyadmin-on-your-raspberry-pi/
- http://serverfault.com/questions/144095/phpmyadmin-on-ubuntu-lamp-login-without-a-password-is-forbidden-by-configurat

[RPI] Raspberry Access Point

20 Maret 2015

Intro::

Raspberry Pi sebagai Router Access Point.

Steps::

- sudo apt-get install hostapd udhcpd *installasi hostapd dan udhcpd
sudo nano /etc/udhcpd.conf *update konfigurasi udhcpd
start 192.168.48.2
end 192.168.42.20
interface wlan0
remaining yes
opt dns 8.8.8.8 4.2.2.2
opt subnet 255.255.255.0
opt router 192.168.48.1 #set Rpi IP address
opt lease 864000 # 10 day DHCP lease time in seconds.
sudo nano /etc/default/udhcpd *update konfigurasi default udhcpd
rubah DHCP enable jadi YES
DHCPD_ENABLED="no" --> DHCPD_ENABLED="yes"
sudo nano /etc/network/interfaces *update konfigurasi wlan0
allow-hotplug wlan0
auto wlan0
iface wlan0 inet static
address 192.168.48.1
netmask 255.255.255.0
dan comment section ini
#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
#iface default inet manual

sudo nano /etc/hostapd/hostapd.conf *konfigurasi nama SSID, password AP
dengan password WPA2
interface=wlan0
driver=nl80211
ssid=r48pi
hw_mode=g
channel=11
wpa=2
wpa_passphrase=p48sword
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
wpa_ptk_rekey=600
macaddr_acl=0
 open network *not tested
interface=wlan0
driver=nl80211
ssid=r48pi
channel=11
hw_mode=g
channel=6
auth_algs=1
wmm_enabled=0
- sudo nano /etc/default/hostapd *update konfigurasi hostapd
DAEMON_CONF="" --> DAEMON_CONF="/etc/hostapd/hostapd.conf"
sudo nano /etc/sysctl.conf *update konfigurasi NAT
tambahkan line
net.ipv4.ip_forward=1
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT *forward eth0 -> wlan0
sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT *run
sudo sh -c "iptables-save > /etc/iptables.ipv4.nat" *save iptables change
sudo nano /etc/network/interfaces *update konfigurasi interface
tambahkan line
up iptables-restore < /etc/iptables.ipv4.nat
sudo service hostapd start *run hostapd
sudo service udhcpd start *run udhcpd
sudo update-rc.d hostapd enable *run hostapd at boot
sudo update-rc.d udhcpd enable *run hostapd at boot
- enjoy


Documentation::

- http://www.rpiblog.com/2012/12/turn-raspberry-pi-into-wireless-access.html

[RPI] Static Address Raspberry Pi

21 Maret 2015
static eth0

Intro::

Disaat mau ngoprek Rpi via ssh gak nyaut, disitu IP Rpi berubah. Jadi untuk mengatasi perubahan IP digunakan metode static ip.

Gather Information::

ifconfig eth0 *cek IP pada metwork module eth0
catat addr, bcast, mask
address 192.168.1.136
broadcast 192.168.1.255
netmask 255.255.255.0
netstat -nr *cek akan route kemana
catat gateway, destination untuk network eth0
Gateway 192.168.1.1
Destination 192.168.1.0
sudo nano /etc/network/interface *rubah default setting
ganti
iface eth0 inet dhcp -> iface eth0 inet static
tambahkan dibawahnya
address 192.168.1.136
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
sudo reboot *restart

Documentation::

- http://www.modmypi.com/blog/tutorial-how-to-give-your-raspberry-pi-a-static-ip-address (21-Maret-2015)

Monday, March 16, 2015

[RPI] Wifi dengan Raspberry (updated)

16 Maret 2015


Intro::

Koneksi PI dengan Wifi dongle. Kebetulan dongle yang ku punya TP-LINK TL-WN727N (firnware-ralink) sudah include dalam RASPBIAN.

Driver Wifi::

- lsusb *pengecekan usb terdeteksi/tidak
- sudo apt-get install firmware-ralink *installasi driver
- sudo iwlist wlan0 scan *pengetesan scanning wifi dengan dongle
- sudo nano /etc/wpa_supplicant/wpa_supplicant.conf *pembuatan konfigurasi wifi yang ingin disambung

   network={
            ssid="SSID"
            psk="PASSWORD"
           }

- sudo ifdown wlan0 *reset dongle dengan mematikan kemudian menghidupkan
- sudo ifup wlan0
- ifconfig wlan0 *jika tersambung cek ip dengan ifconfig


Update auto connect (21 June 2015)
- sudo nano /etc/network/interfaces  edit config untuk auto connect wlan

auto lo
iface lo inet loopback

auto eth0
allow-hotplug eth0
iface eth0 inet dhcp

auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

Documentation::

- http://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md

Sunday, March 15, 2015

[RPI] Raspberry 3G

15 Maret 2015
sakis3g interface

Intro::

Koneksi 3G di Raspberry dengan Huawei E303. Menggunakan usb-modeswitch, ppp, dan sakis3g.

Driver Modem::

Connect via SSH
- Sambung Modem dengan Raspi
- ketik lsusb di LX-Terminal untuk melihat apakah modem terdeteksi/tidak

pi@raspberrypi ~ $ lsusb
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 006: ID 12d1:1446 Huawei Technologies Co., Ltd. E1552/E1800/E173 (HSPA modem)
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install usb-modeswitch *untuk merubah dari mode storage menjadi modem
>> kalau sudah reboot dan dicek lsusb akan berubah menjadi seperti ini 
pi@raspberrypi ~ $ lsusb
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 006: ID 12d1:1436 Huawei Technologies Co., Ltd.

sudo apt-get install ppp *modem dial up 3G menggunakan protokol ppp
- Install sakis3g dari mirror (karena sakis3g down)
> sudo wget "http://downloads.sourceforge.net/project/vim-n4n0/sakis3g.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fvim-n4n0%2Ffiles%2F&ts=1363537696&use_mirror=tene~t" -O sakis3g.tar.gz
sudo tar -xzvf sakis3g.tar.gz> sudo chmod +x sakis3g
- sudo ./sakis3g --interactive *buka jendela sakis3g
- Connect with 3G
- USB device *pilih koneksi via
- Huawei Mobile *pilih modem
- pilih Interface #0
- Reported by your modem (Internet)
- isi username: internet
- kemudian password: internet
- jika lampu indikator modem menyala dan panel sudah connected, selamat sudah tersambung
- cek dengan mengirimkan paket ping ke google sebanyak 4 ping -c 4 google.com


Catatan:

- setelah connect dan disconnect internet dengan 3G, tidak bisa kembali menggunakan koneksi internet dari LAN kecuali setelah reboot


Documentation::

- http://www.instructables.com/id/Raspberry-Pi-as-a-3g-Huawei-E303-wireless-Edima/?ALLSTEPS

Saturday, March 14, 2015

[RPI] Connect Pi via SSH dan Remote Desktop VNC

14 Maret 2015
Remote Desktop via VNC

Intro::

Koneksi SSH sudah aktif by default di RASPBIAN jadi tak perlu disetting lagi.

Timeline::

1. Connect via SSH RASPBIAN OS
Material
- Raspberry Pi 2 & Power supply
- Cable LAN Straight
- Router
- Keyboard & Mouse
- HDMI to VGA converter
- Monitor

Software
- SSH Client (cth: di Windows - Bitvise Tunniler)
- VNC Client (cth: di Windows - Tight VNC)

SSH Connection::

Connect via SSH
- Boot sampai Desktop Raspbian dan sambung cable LAN
- cari tahu IP Raspbian dengan mengetikan ifconfig di LX-Terminal
- Install Bitvise Tunniler di Windows
- Masukan IP Raspbian dengan port 22
- Initial Method = Password
- default Username/Password Raspbian:: 
username : pi
password : raspberry
- click connect, dan save session.
- open New Terminal Console untuk membuka console

VNC Connection::

Connect via SSH/Boot langsung
- LX-Terminal
- sudo apt-get update
- sudo apt-get upgrade
- sudo apt-get install tightvncserver
- vncserver :1 *jalankan vncserver port 1
- untuk pertama kali akan diminta masukan password untuk authentication *raspberry
- VNC sudah run


Membuat shell script untuk menghidupkan VNC
- sudo nano vnc.sh *membuat file vnc.sh
- tulis shell script ini
#!/bin/sh
vncserver :1 -geometry 1024x768 -depth 24 -dpi 96
- simpan ctrl+o, exit ctrl+x
- ubah permission sudo chmod 755 vnc.sh
- panggil dengan ./vnc.sh

Catatan:

- :1 dalam vncserver adalah port 1, di VNC client masukan port 5901
- resolusi/ -geometry dapat dirubah sesuai kebutuhan
- gunakan text editor nano / vi untuk membuat shell script
- ubah permission chmod untuk dapat dieksekusi

Documentation::

- http://www.raspberrypi.org/documentation/remote-access/vnc/
- http://www.instructables.com/id/Setting-up-a-VNC-Server-on-your-Raspberry-Pi/?ALLSTEPS

Friday, March 13, 2015

[RPI] Install Raspbian di Raspberry PI 2 1GB

13 Maret 2015

Gambar1. Halaman raspi-config.

Intro::


Dapet pake Pi dari lapak kaskus >
kelengkapan
- Mesin Raspberry Pi B 1GB
- Micro SD Sandisk 16GB
- Casing Curve

Timeline::

1. Nonton 4 Video Newbie dari element14 >> YOUTUBE
2. Install OS Raspbian
Material
- Raspberry Pi 2
- Cable USB-microUSB untuk power
- Keyboard & Mouse
- HDMI to VGA converter
- Monitor
- Micro SD 16GB
- NOOBS OS

Install RASPBIAN OS::


- Download NOOBS > http://www.raspberrypi.org/downloads/
- Extract NOOBS ke mSD card via winrar
- insert mSD ke raspi
- plug cable power Raspi
- plug converter HDMItoVGA ke Raspi
- plug in cable Monitor ke converter HDMItoVGA (akan muncul halaman depan NOOBS di monitor)
- plug in Keyboard & Mouse
- pilih install RASPBIAN OS
- pilih bahasa dibawah *note: gb = great britain
- proses install +- 10-15menit

Setting PI::

- akan muncul halaman config seperti Gambar 1
- pilih menu 4. Internationalization *untuk setting tanggal dan time zone
- pilih menu 3. Enable Boot to Desktop - Desktop log in as user pi at graphical desktop *untuk menghidupkan mode desktop
- reboot

Catatan::

- Format mSD card fat32, dengan primary
- Converter HDMItoVGA disambung dulu ke raspi kemudian baru sambung ke monitor
- Langkah diatas ada di video dari element 14 >> YOUTUBE