Skip to content

Instantly share code, notes, and snippets.

View nam178's full-sized avatar
🎯
Focusing

Nam Duong nam178

🎯
Focusing
  • Amazon Web Services
  • Melbourne, VIC, Australia
View GitHub Profile
@nam178
nam178 / Array2XML.php
Last active December 14, 2015 09:09
Array to XML DomDocument
<?php namespace xnz;
/**
* Array2XML
* This class helps you to convert a given array into a DomDocument;
* See public interface for usage;
*
* @author nam@xnz.com.au
*/
class Array2XML {
@nam178
nam178 / XML2Array.php
Last active December 14, 2015 13:58
Convert an XML document (SimpleXMLElement) to array
<?php
/**
* Convert a given SimpleXMLElement to array;
* Note that this function is not yet completed,
* nodes with the same name will be overriden;
*
* @author nam@xnz.com.au
* @return string[]|string
*/
function XML2Array (SimpleXMLElement $xml)
http://www.slideshare.net/ravipratapm/using-amazon-ec2-to-scale-your-web-application
// Getting started with Linux Web Application in the AWS Cloud
http://aws.amazon.com/web-applications/gsg-webapps-linux/
// about RDS
http://aws.amazon.com/rds/
// aboue EBS
@nam178
nam178 / Install_VirtualBox_GuestAddition_CentOS5.txt
Last active December 14, 2015 15:19
Install VirtualBox Guest Addition CentOS 6
log in as root and type in terminal
CentOS 6.4 + VBox 4.2
=====================
Try this first:
yum update -y
...
yum install dkms binutils gcc make patch libgomp glibc-headers glibc-devel kernel-headers kernel-devel -y
...
@nam178
nam178 / Virtuabox_Hostonly_Fix.txt
Last active December 14, 2015 17:29
Fix VirtualBox Host-only public network issue
Configure VB's centOS 5 "Host-Only" network
1 - Config virtual machine, add a "host-only" network
2 - Windows sees "Virtualbox Host-Only" network as a public network, so it blocks access.
Follow to fix:
1. Open regedit and navigate to HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}
2. Browse through the subkeys (named 0000, 0001, etc) until you find the subkey containing the virtualbox network adapter, this is the one where the “DriverDesc” key has “VirtualBox Host-Only Ethernet Adapter” as value.
3. Add a new DWORD value with a name of “*NdisDeviceType” and a value of “1”
4. Restart PC
3 - CentOS 5 iptables might have some firewall rules to prevent windows host to access services on the box;
So:
@nam178
nam178 / Mongo_CheatSheet.md
Last active December 14, 2015 17:39
Mongo CheatSheet

database

show current database, use a database, show all databases dbs use mydatabase show databases

show all collections, show all users for current database show collections show users

@nam178
nam178 / Virualbox_CentOS6_NetworkBootFix.txt
Created March 9, 2013 10:38
Virtualbox Centos6 no internet fix
If you are not using NetworkManager the same result can be obtained by editing the configuration file for the network interface ( normally /etc/sysconfig/network-scripts/ifcfg-eth0 ) and changing: ONBOOT=no to ONBOOT=yes Some setups seem to also require the addition of a line: BOOTPROTO=dhcp where a DHCP setup is in play; Static IP setups would take: BOOTPROTO=static of course
@nam178
nam178 / CentOS_Static_IP_eth0.txt
Last active December 14, 2015 17:39
CentOS Static IP address on eth0
vi /etc/sysconfig/network-scripts/ifcfg-eth0
NM_CONTROLLED="no" <!-- ???
ONBOOT="yes" <!-- should be yes
BOOTPROTO="static" <!-- Must be "static"
IPADDR=192.168.0.10 <!--- Add this
NETMASK=255.255.255.0 <!-- notice this also
GATEWAY=192.168.0.1 <!-- also this
@nam178
nam178 / gist:5126428
Created March 10, 2013 00:09
Virtualbox Hide Menu bar && status bar
“C:\Program Files\Oracle\VirtualBox\VBoxManage.exe” setextradata global GUI/Customizations noMenuBar,noStatusBar
@nam178
nam178 / Extend_LVM.txt
Last active December 14, 2015 17:59
Logical Volume Manager: How can I extend a Volume Group?
http://www.howtoforge.com/logical-volume-manager-how-can-i-extend-a-volume-group
OR
http://wiki.centos.org/TipsAndTricks/ExpandLV
-------------------------
/dev/sda is the hdd
--> partioned to /dev/sda1, /dev/sda2, /dev/sdd3, /dev/sda2 is a lvm,