20 December 2013

Chromium guna Flash yg lain

By default, chromium guna flash version 11.2.x

Utuk guna flash yg terbaru(spt yg digunakan oleh google-chrome),

chromium-browser --ppapi-flash-path=/opt/google/chrome/PepperFlash/libpepflashplayer.so  --ppapi-flash-version=11.9.900.170

ref: http://www.webupd8.org/2012/09/how-to-make-chromium-use-flash-player.html

19 December 2013

DHCP: cara nak abaikan default gw

DHCP response dari server akan assign default gw.
Bagaimana nak elakkan OS dari gunakan gw ini.

File: /etc/dhcp3/dhclient.conf
interface "eth1" { 
 request subnet-mask, broadcast-address, time-offset, interface-mtu; 
}

ref: https://lists.isc.org/pipermail/dhcp-users/2011-April/013451.html



Better Solution

1) sudo aptitude install ifmetric
2) file: /etc/network/interfaces
     allow-hotplug eth0 
     iface eth0 inet dhcp 
           metric 1 

     allow-hotplug eth1 

18 December 2013

bash skrip: beri input pada program

#!/usr/bin/expect -f
spawn openvpn client.warriors.conf.open
match_max 100000
expect "*?assword:*"
send -- "mypassword"
send -- "\r"
expect eof

ref: http://stackoverflow.com/questions/11240184/pass-private-key-password-to-openvpn-command-directly-in-ubuntu-10-10

17 December 2013

switch kawal MAC address

Sesetengah admin, kawal LAN berdasarkan pendaftaran MAC

sebelum white list:
#arp -an
(10.0.5.110) at 00:1D:09:67:89:7B

MAC adress sebenar adalah yg lain.
Mungkin,  switch spoofkan semua MAC address yg belum register.

16 December 2013

soket

Soalan:
Bagaimana multi client boleh connect serentak ke server yg hanya listen pada satu port(ie: 80)?


A socket is identified by {SRC-IP, SRC-PORT, DEST-IP, DEST-PORT, PROTOCOL} not by {SRC-IP, SRC-PORT, DEST-IP, DEST-PORT} - Protocol is an important part of a socket's definition.




ref: http://stackoverflow.com/questions/3329641/how-do-multiple-clients-connect-simultaneously-to-one-port-say-80-on-a-server

21 November 2013

Joomla: Table Menu

After experimenting with `#__menu` table I have discovered many interesting features.

There is a DB Table called #__menu in the joomla installation database. The function of each column is stated below.

id(INT) Primary key.

title(VARCHAR) Display name of the menu. Very important field.

Menu type(VARCHAR) *Tells if the menu is ‘main menu’, ‘top menu’ , ‘left-menu’ …. Admin menus are supposed to have ‘main’ value. But whether they are displayed on the back end or not is determined by ‘client_id’ field (see below), not here.*

alias(VARCHAR) Alias of ‘title’. But it doesn’t make any effect if it is populated or not. I tried to populate it and left the ‘title’ field blank. Then the menu became blank. But if I left ‘alias’ blank and fill ‘title’, the menu got text.

note(VARCHAR) Remark (or note).

path(VARCHAR) Path name to be displayed in the browser address bar. It doesn’t have to relate with the ‘link’ information. (But both ‘path’ and ‘link’ fields have to be filled in order the menu to work properly).

link(VARCHAR) URL. Tells where the system will go when the menu is clicked. Important.

type (VARCHAR) Tells if the menu is component or url(external link) … . (Seems, it is just an ‘extra’ information – no visible effect on the menu).

published (TINYINT)
1 – Published. 0 – Not published. Hide/Show the menu in the front end.


parent_id (INT)
0- ‘Main Item root’ value. It should exist only once.
1- List among menu items on level one.
x- If this value is given another menu’s id then it will automatically become a child (second level) menu and ‘pops out ‘of its parent menu.


level (INT) Level is expected to reflect its position in the menu hierarchy. Eg. If the menu has a parent of level one, its level must be 2. If it has a parent of level 5 it has to be level 6 menu. But Joomla seems to calculate its actual level by looking to its parents and ignore this value.

component_id (INT) Component id. Value is taken from #__extensions table. (But emptying this field doesn’t seem to have any effect).

ordering (INT) Ordering (standard joomla column).

checked_out (INT) Check out (standard joomla column).

checked_out_time (TIMESTAMP) Check out time (standard joomla column).

browserNav (TINYINT) ?

access (INT) Very important field.
1 – Public
2 – Registered users only.
3 – Special Users (Eg. Managers and Admins )


img (VARCHAR) Image path if you want the menu have a background image.

template_style_id (INT) Template Id attached to while viewing the page associated with this menu.

params (TEXT) Component configuration data.

lft (INT) ?

rgt (INT) ?

home (TINYINT) Joomla has to have one and only one default page. This value determines this.
1 – This page is default.
0 – Not default. Only one menu has to have value 1. (Most of the time ‘home’).
language (CHAR) For which languages the menu displays.

client_id (TINYINT)
0 – Open to public.
1 – Back end menu. Even if the menu is given a back end menu item as a parent_id, if ‘client_id’ has value of 0, the menu will not display in admin side. But whatever value you give in ‘Menu type’ field, as long as ‘client_id’ value is 1 it will display in the back end.


Scenarios:
Menu type => ’main’ client_id =>’1’, published=> 1/0: In this case menu is only displayed in the back end. Published value has no effect.

Menutype=> ‘mainmenu’, ‘client_id’=>1, published=>1: The menu is displayed in both back end and front end. Published value determines its visibility. Whether the ‘menutype’ value is ‘main’ ,’mainmenu’, ‘top-menu’ … has no effect on its visibility in back end – only ‘client_id’ matters.

Menutype=> ‘mainmenu’, ‘client_id’=>1, published=>0: Has the same effect for admin side as the scenario above. But in front side, the menu is not visible (with published state 0).
ref:http://stackoverflow.com/questions/17142321/adding-joomla-menu-for-new-component-directly-in-db-joomla-2-5

Joomla Component: options

Option untuk component Joomla 3 disimpan di table _extensions, field params.
Data disimpan dalam format json.

Code utk retrieve(dlm Model):

jimport('joomla.application.component.helper');
$params = JComponentHelper::getParams(JRequest::getVar('option')); // Get parameter helper
$id = $params->get('email'); // Get an individual parameter

contoh data dlm field params:
{"email":"myemail@yourcompany.com","show_date":"1"}

18 November 2013

joomla url parameter

1) http://example.com/index.php?option=com_<name>&view=[&task=<mytask>]

a) task : run method <mytask> dalam class <name>Controller, yg ada dalam file [components/com_<name>/controller.php]


2) http://example.com/index.php?option=com_<name>&view=<myview>&format=ajax

a) view : pakai  fail [components/com_<name>/views/<myview>/view.ajax.php]
default format : html

hacked install joomla 3 component


1)minimum file
components_dir

  • com_komponen
    • komponen.php

2) daftar komponent dalam table extensions

INSERT INTO `#__extensions`
(`extension_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`)
VALUES (0, 'Komponen Den', 'component', 'com_komponen', '', 1, 1 )

relatif


git remote


Nak clone libemu pada github dan cipta branch utk patch utk isu test al, 3d (a8 d3)
  1. Create new repo kat github
  2. clone ke local
  3. git remote add carnivore git://git.carnivore.it/libemu.git
  4. git fetch carnivore
  5. git checkout master (jika bukan dlm branch master)
  6. git merge carnivore/master
  7. git push origin master

ubuntu desktop menu

/usr/share/applications/program_name.desktop

Contoh file utk Eclipse(Applications -> Programming -> Eclipse)

[Desktop Entry]
Type=Application
Name=Eclipse
Comment=Eclipse Integrated Development Environment
Icon=eclipse
Exec=eclipse
Terminal=false
Categories=Development;IDE;Java;

04 November 2013

md5 hash : php vs linux bash

Hasil dua hash tak sama.

md5("anakomak")
vs
echo "anakomak" | md5sum

sebab:
echo dalam bash akan tambah extra character (new line)

solution:
echo -e "anakomak\c" | md5sum         <<== baru sama.

man echo:
-e     enable interpretation of backslash escapes
\c     produce no further output

paksa guna https utk phpmyadmin



File: phpMyAdmin’s config.inc.php

// place this at the bottom somewhere
$cfg['ForceSSL'] = true;


30 October 2013

Digital Ocean: Snapshot dan Backup

1) Buat Snapshot.
2) Delete Droplet.
3) Bila nak pakai, create droplet, jgn cipta baru, tapi 'Select Image' --->    
4) Jimat...

Harga:
The pricing for backups is 20% of the cost of the virtual server. So if you want to enable backups for a $5/mo virtual server, the cost for backups will be $1/mo.

The price for snapshots will be $0.02 per GB of snapshot storage per month.


ref:
https://www.digitalocean.com/community/articles/digitalocean-backups-and-snapshots-explained

27 October 2013

python virtual thread

gevent

greenlet -> virtual thread instance



gevent.pool.Pool(3)                       # limit concurrent thread to 3,
                                                 #habis satu baru run satu lagi
pool.spawn(function_name)

url picasa


download:
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_DSGalZhpqGehh_BlolM3RBvodFFGvSaZb6TXqGVMqXAVF3AJ_WaTYLhaPiJD_6L3Ft7UVbBvx7FmsevbDN2tVI_p39-gye9GhSOekwPeKOnAkTFeuXNsT17tZnGiSs8yjh3DPcpfhnl1/s404-d/.facebook_1724220696.jpg


segiempat:
/_D-AQvdOCYc/s404-c/.facebook_1724220696.jpg


default:
/_D-AQvdOCYc/.facebook_1724220696.jpg


12 October 2013

masuk subtitle dalam video

mencoder tazkiah13.avi -sub tazkiah13.ass -o tazkiah13.hardsubs.avi -oac copy -ovc lavc -lavcopts vbitrate=1200


subtitle:
   subtitle_file.ass
   subtitle_file.srt

download streaming video



Next you need to download the realplayer feed you want to convert. First of all download the realvideo file you want and then view it to see the realtime streaming protocol (RTSP) url inside:
 
wget http://www.bbc.co.uk/england/realmedia/politicsshow/south/bb/politicsshow_16x9_bb.ram
 

cat politicsshow_16x9_bb.ram // displays something like rtsp://rm-acl.bbc.co.uk/england/politicsshow/south/bb/politicsshow_16x9_bb.rm



ref:
http://www.pyrosoft.co.uk/blog/2007/11/25/converting-realplayer-rm-files-to-mpeg-or-mp4-with-ubuntu-gutsy/

convert realMedia ke avi

ke Avi

mencoder input.rm -o output.avi -ovc xvid -xvidencopts bitrate=128 -oac mp3lame

 


ke Xvid
mencoder stream.dump -o bbc-10oclocknews.avi -ovc xvid -xvidencopts bitrate=128 -oac mp3lame


senaraikan codec :
   mencoder -ovc help



ref:
http://www.pyrosoft.co.uk/blog/2007/11/25/converting-realplayer-rm-files-to-mpeg-or-mp4-with-ubuntu-gutsy/

03 October 2013

transparent proxy

squid dan iptable(REDIRECT(same host) atau DNAT(different ip))



squid config
http_port 3128 transparent
http_port 80 vhost
ref http://www.cyberciti.biz/tips/linux-setup-transparent-proxy-squid-howto.html




IPTABLES
  /sbin/iptables -t nat -A PREROUTING  -p tcp --dport 80 -j DNAT --to $squid_server:$squid_port

  # nat perlu jika gw dan squid berlainan host.
  /sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

*maklumat tambahan*
DNAT akan tukar dst ip dari gw ke squid, tapi src ip tetap dari client(browser). 
Jadi masalah, kerana bila squid reply sync ack, alamat packet adalah kepada client. 
Client tak tahu menahu, so tcp handshake tak berjaya.

vSphere, ESXi, vCenter

vSphere adalah suite(kombinasi pelbagai software). Macam Microsoft Suite, yg dalamnya ada word, excel, powerpoint etc.

ESX adalah server utk virtualization, boleh store vmImage

vSphere Client adalah console utk connect dan control ESX

vCenter server is similar to vSphere client but it’s a server with more power.
(contohnya nak cloning image)


ref:

02 October 2013

vpn with .ovpn file

sudo openvpn --config vpn-config.ovpn 




converting .p12 -> seperate cert

Ok, it seems that we have to update network-manager-openvpn package to the latest version so it can understand p12 files. But there is a fairly simple way to generate the 3 .pem files needed at the old version using the original .p12 file:

openssl pkcs12 -nocerts -in file.p12 -out priv_key.pem

openssl pkcs12 -nokeys -clcerts -in file.p12 -out user_cert.pem

openssl pkcs12 -nokeys -cacerts -in file.p12 -out ca_cert.pem


Then use these 3 files at the OpenVPN configuration, mine is working fine now. I do not know if openssl is installed by default at Lucid, but it is in the repositories.

otrs erd

12 September 2013

truecrypt

http://ubuntuhandbook.org/index.php/2013/08/install-truecrypt-with-indicator-ubuntu-1304/

INSTALL
1) sudo add-apt-repository ppa:stefansundin/truecrypt
2) sudo apt-get update; sudo apt-get install truecrypt




REMOVE
sudo apt-get remove truecrypt 
sudo apt-add-repository --remove ppa:stefansundin/truecrypt 
sudo apt-get update

ubuntu hidden menu @applet

windows+alt + mouse right click

in case nak tambah/remove applet

29 August 2013

linux jadi wifi

http://dashohoxha.blogspot.com/2013/06/how-to-setup-wifi-access-point-on-ubuntu.html

test hostapd:
# hostapd -dd /etc/hostapd/hostapd.conf

above more better than below

http://blog.peacon.co.uk/ubuntu-13-04-server-wireless-access-point-hostapd-howto/

19 July 2013

Dalam Atom

Benda -> Molekul -> Atom -> Neutron -> xxx -> string

http://youtu.be/YtdE662eY_M?t=9m56s

20 June 2013

membengkokkan masa

time bending.
Kadar masa utk org berada dlam roket yg bergerak laju, lebih perlahan berbanding di bumi.


video yg mudah difahami


satu hari seperti 50,000(relativity)

kelajuan malaikat.

[70:4]
The angels and the Spirit will ascend to Him during a Day the extent of which is fifty thousand years.

http://www.speed-light.info/miracles_of_quran/time_relative.htm

29 May 2013

python list, dict, tuple


>>> list = ['satu', 'dua', 333, 456546, 'infinite']
>>> print list[1]
dua
>>> list
['satu', 'dua', 333, 456546, 'infinite']
ref >> http://www.tutorialspoint.com/python/python_lists.htm



>>> my_tuples = 'satu', 'dua', 333, 'infinite'
>>> my_tuples[1]
dua
>>> my_tuples
('satu', 'dua', 333, 'infinite')
ref >>> http://www.tutorialspoint.com/python/python_tuples.htm




>>> dict = {'Alice': '2341', 'Beth': '9102', 'Cecil': '3258'}
>>> dict['Beth']
9102
>>> dict
{'Alice': '2341', 'Beth': '9102', 'Cecil': '3258'}

ref >>> http://www.tutorialspoint.com/python/python_dictionary.htm

python pgp

$ sudo apt-get install python-pip
$ sudo pip install python-gnupg



ref >>> http://www.gefira.pl/blog/2011/04/11/securing-sec-walls-secrets-with-gnupg-and-python-gnupg/



import gnupg

gpg = gnupg.GPG(gnupghome='/home/testgpguser/gpghome')
with open('my-encrypted.txt.gpg', 'rb') as f:
    status = gpg.decrypt_file(f, passphrase='my passphrase', output='my-decrypted.txt')

print 'ok: ', status.ok
print 'status: ', status.status
print 'stderr: ', status.stderr
ref >> http://www.saltycrane.com/blog/2011/10/python-gnupg-gpg-example/

27 May 2013

python senarai method

dir(nama_module)

help(nama_module)

tipu helai gpg

senarai public keys:
  gpg --list-keys

senarai private keys:
  gpg --list-secret-keys

decrypt file:
  gpg -o outputfile -d myencrypted.file.asc

ref>>  http://irtfweb.ifa.hawaii.edu/~lockhart/gpg/

------------------------

to import a public key:
gpg --import public.key

This adds the public key in the file "public.key" to your public key ring.

to import a private key:
gpg --allow-secret-key-import --import private.key

This adds the private key in the file "private.key" to your private key ring. There's a note (*) at the bottom explaining why you may want to do this.

to delete a public key (from your public key ring):
gpg --delete-key "User Name"
This removes the public key from your public key ring.
NOTE! If there is a private key on your private key ring associated with this public key, you will get an error! You must delete your private key for this key pair from your private key ring first.

to delete an private key (a key on your private key ring):
gpg --delete-secret-key "User Name"
This deletes the secret key from your secret key ring.

To list the keys in your public key ring:
gpg --list-keys


To list the keys in your secret key ring:
gpg --list-secret-keys


To generate a short list of numbers that you can use via an alternative method to verify a public key, use:
gpg --fingerprint > fingerprint
This creates the file fingerprint with your fingerprint info.

12 April 2013

raid

RAID 0
-block strip - > laju (write)


RAID 1
- mirror




RAID 5
- block strip -> laju(write)
- satu harddisk rosak, still boleh recover





RAID 10
 - kombinasi RAID 1 dan RAID 0



ref:  http://www.thegeekstuff.com/2010/08/raid-levels-tutorial/

21 February 2013

18 January 2013

Masalah maximize pada crossover / wine

Isu office tak boleh unmaximised.

Pergi pada:

  Application -> Crossover -> [Manage Bottles]

Ambil tab [Control Panel]

Ambil [Wine Configuration]

Tab Graphics

Untick pada :
   1- Allow the window manager to decorate the windows
   2 - Allow the window manager to control the windows

Mungkin kena restart office tersebut.


vSphere Client

isu permission:


setting ada 2 level,
1- Globally
2- pada Image tertentu sahaja.
Utk global, klik pada ip yg terdapat pada kolum kiri
Utk image tertentu, klik pada image tersebut.


Untuk set kan access, perlu 2 perkara(dalam tab):
1- Users & Group
2- Permission

Pertama, add user pada tab 'Users & Group'.
Kedua, add permission pada tab 'Permission'