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 | |
| /** | |
| * Implements hook_menu(). | |
| */ | |
| function MY_MODULE_menu() { | |
| $items['MY_MODULE/redhen/contact/autocomplete'] = array( | |
| 'title' => 'Autocomplete for RedHen Contacts', | |
| 'page callback' => 'MY_MODULE_contact_autocomplete', | |
| 'access callback' => 'redhen_contact_access', |
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 | |
| # http://drupal.stackexchange.com/questions/135918/return-other-indexed-fields-using-searchapiqueryindex | |
| # http://www.phponwebsites.com/2015/12/drupal-7-add-custom-fields-to-search-api-solr-index.html | |
| # https://gist.github.com/acquialibrary/572acdbc4004fbfca02b | |
| # http://drupal.stackexchange.com/questions/115878/search-snippet-does-not-appear-in-search-api-search-page | |
| # Remember disable Tokenizer in Filter (This causes a lot of troubles in highlighting keyword) | |
| $server = search_api_server_load('acquia_search_solr_server'); | |
| $index = search_api_index_load('node_index'); |
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
| drush ev ' | |
| $keys = "*:*"; | |
| $rows = 5; | |
| $fields = "score,label,id,entity_id,site,bundle,ss_type,tm_title,content"; // * == All fields | |
| $facets = explode(",", "site,hash,bundle,access__all,entity_type,index_id,ss_language,is_status,ss_type"); | |
| // Get Solr. | |
| $solr = false; | |
| if (function_exists("apachesolr_get_solr")) { | |
| // apachesolr.module | |
| $solr = apachesolr_get_solr(); |
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
| #!/bin/bash | |
| # Script to Install JAVA 8 (JDK 8u40) on CentOS/RHEL 7/6/5 and Fedora | |
| # http://tecadmin.net/install-java-8-on-centos-rhel-and-fedora/ | |
| # Requirements: $yum install wget -y | |
| echo "Installing Java 8 (64bit)" | |
| cd /opt/ | |
| wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u40-b25/jdk-8u40-linux-x64.tar.gz" |
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
| 1. List all ec2 running with output table | |
| $aws ec2 describe-instances --filters "Name=instance-state-name,Values=running" --output table | |
| 2. List all ec2 running with output table, with some fields only | |
| $aws ec2 describe-instances --filters "Name=instance-state-name,Values=running" --query 'Reservations[].Instances[].[Placement.AvailabilityZone, State.Name, InstanceId,InstanceType,Platform,Tags.Value,State.Code,Tags.Values]' --output table | |
| ------------------------------------------------------------------------------------------- | |
| | DescribeInstances | | |
| +---------------+----------+-------------+-------------+----------+-------+------+--------+ | |
| | eu-central-1a| running | i-0afd59b7 | m3.xlarge | None | None | 16 | None | | |
| | eu-central-1a| running | i-dfff5b62 | m4.xlarge | windows | None | 16 | None | |
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
| $ curl http://169.254.169.254/latest/dynamic/instance-identity/document | |
| { | |
| "version" : "2010-08-31", | |
| "architecture" : "x86_64", | |
| "instanceType" : "t1.micro", | |
| ... | |
| "region" : "us-west-2", | |
| "availabilityZone" : "us-west-2b", | |
| ... | |
| } |
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
| 1.Install | |
| $pip install --upgrade awscli | |
| 2. Configure | |
| $aws configure | |
| AWS Access Key ID: foo | |
| AWS Secret Access Key: bar | |
| ... | |
| 3. Verify | |
| $aws iam list-users |
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
| 0. Requirements | |
| - Ansible latest version | |
| - AWS access key | |
| - SSH key | |
| 1. Install ansible | |
| cd /opt | |
| git clone https://github.com/ansible/ansible.git | |
| cd ansible | |
| source ./hacking/env-setup |
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
| # Requirments | |
| Jenkins, Ansible on the same machine | |
| $docker run -p 8080:8080 -p 50000:50000 -v /opt/jenkins:/var/jenkins_home thuannvn/my-jenkins | |
| Dockerfile can be found here https://github.com/thuannvn/docker-jenkins-extended | |
| # Setup for java project (traditional) | |
| GIT: https://github.com/thuannvn/hello-world-java | |
| Open jenkins -> Create new job -> Choose Freestyle -> Choose Git (Source code management) -> Build (Execute shell) with content: | |
| javac HelloWorld.java | |
| java HelloWorld |
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
| local 192.168.2.0 # SWAP THIS NUMBER WITH YOUR RASPBERRY PI IP ADDRESS | |
| dev tun | |
| proto udp #Some people prefer to use tcp. Don't change it if you don't know. | |
| port 1194 | |
| ca /etc/openvpn/easy-rsa/keys/ca.crt | |
| cert /etc/openvpn/easy-rsa/keys/Server.crt # SWAP WITH YOUR CRT NAME | |
| key /etc/openvpn/easy-rsa/keys/Server.key # SWAP WITH YOUR KEY NAME | |
| dh /etc/openvpn/easy-rsa/keys/dh1024.pem # If you changed to 2048, change that here! | |
| server 10.8.0.0 255.255.255.0 | |
| # server and remote endpoints |