This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Git and Github in 5 minutes | |
| 1. First of all, you need to create a git project like this: | |
| git init learn-git | |
| cd learn-git | |
| Then, once you are in a git repository, you start writing the initial draft of the code. | |
| file: helloword.php | |
| <?php echo "Hello World!\n"; ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ##What's 'Ansible' ? | |
| Ansible is configuration management tool like SaltStack, Puppet but it works through SSH, no need to install agent on managed nodes. | |
| ##Why's Ansible ? | |
| As my point, i love ansible for: | |
| - No need to install agent on agent nodes | |
| ##How's Ansible? | |
| ### Install Ansible on master node |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| There is an easy way to access to Instance information from within | |
| # Obtaining the Instance ID: | |
| wget -q -O - http://169.254.169.254/latest/meta-data/instance-id | |
| i-87eef4e2 | |
| # Public Hostname: | |
| wget -q -O - http://169.254.169.254/latest/meta-data/public-hostname | |
| ec2-50-17-85-234.compute-1.amazonaws.com |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| yum --exclude php*,httpd*,kernel* update |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # This rewrite http://domain.com/dl/121/abc.pdf to PHP as http://domain.com/dl.php?nid=121&url=abc.pdf | |
| # | |
| server { | |
| ... | |
| location /dl { | |
| rewrite ^/dl/(.*)/(.*)$ /dl.php?nid=$1&url=$2 last; | |
| break; | |
| } | |
| ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Install Solarium-Client | |
| $ yum install composer | |
| $ vi composer.json | |
| { | |
| "require": { | |
| "solarium/solarium": "2.4.0" | |
| } | |
| } | |
| $ composer install |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ... | |
| function mymodule_apachesolr_index_document_build_node(ApacheSolrDocument $document, $entity, $env_id) { | |
| if ($entity->type == 'company'){ | |
| $node_field_address = $entity->field_address['und'][0]['value']; | |
| // Add the image and description to the document in the solr index. | |
| $document->addField('ts_company_add', $node_field_address); | |
| } | |
| } | |
| ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Basic page with ID 123 | |
| page--node--123.tpl.php | |
| # Frontpage | |
| page--front.tpl.php | |
| # Default | |
| page.tpl.php |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| define('DRUPAL_ROOT', '/home/vhosts/domain.com'); | |
| require_once DRUPAL_ROOT . '/includes/bootstrap.inc'; | |
| drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); | |
| require_once( DRUPAL_ROOT . '/sites/all/libraries/simplehtmldom/simple_html_dom.php'); | |
| include("phpcrawler/libs/PHPCrawler.class.php"); | |
| set_time_limit(0); | |
| $vid = 10; // Category |