Skip to content

Instantly share code, notes, and snippets.

View algotrader-dotcom's full-sized avatar

Mai_Xoa algotrader-dotcom

View GitHub Profile
@algotrader-dotcom
algotrader-dotcom / 17111_troubleshooting_search.php
Created June 20, 2016 11:43
A script to help evaluate search problems, using drush.
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();
@algotrader-dotcom
algotrader-dotcom / search-api-example.php
Last active June 21, 2016 16:35 — forked from alanmackenzie/search-api-example.php
Drupal Search Api Custom Search Example
<?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');
@algotrader-dotcom
algotrader-dotcom / search-api-redhen-contact-autocomplete.php
Created June 21, 2016 15:40 — forked from wxactly/search-api-redhen-contact-autocomplete.php
Drupal Search API - Simple RedHen contact autocomplete
<?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',
@algotrader-dotcom
algotrader-dotcom / mysql_pwd_reset.sh
Created August 6, 2016 18:24 — forked from thomasmb/mysql_pwd_reset.sh
A shell script for resetting the root MySQL password
# Please confirm that you want to reset the MySQL passwords
CONFIRM="n"
echo -n "Please confirm MySQL password reset. Continue? (y/N): "
read -n 1 CONFIRM_INPUT
if [ -n "$CONFIRM_INPUT" ]; then
CONFIRM=$CONFIRM_INPUT
fi
echo
@algotrader-dotcom
algotrader-dotcom / deploy.yml
Created August 9, 2016 07:21 — forked from mig5/deploy.yml
Ansible playbook to deploy Drupal
---
- hosts: all
gather_facts: no
tasks:
- name: Backup database
shell: "{{ item }}"
with_items:
- mkdir -p ~jenkins/dbbackups
- drush @{{ shortname }}_{{ env }} sql-dump --skip-tables-key=common | gzip > ~jenkins/dbbackups/{{ shortname }}_{{ env }}_prior_to_{{ build }}.sql.gz
@algotrader-dotcom
algotrader-dotcom / ftpFileserveUploader.py
Created August 11, 2016 06:38 — forked from slok/ftpFileserveUploader.py
Python script to upload various files to fileserve with FTP.
# Copyright (c) 2011, Xabier (slok) Larrakoetxea
# Copyright (c) 2011, Iraide (Sharem) Diaz
#
# 3 clause/New BSD license:
# opensource: http://www.opensource.org/licenses/BSD-3-Clause
# wikipedia: http://en.wikipedia.org/wiki/BSD_licenses
#
#-----------------------------------------------------------------------
# This script allows to upload to Fileserve with FTP various files at the same time
#
@algotrader-dotcom
algotrader-dotcom / README.md
Created August 15, 2016 04:23 — forked from magnetikonline/README.md
Nginx FastCGI cache configuration example.

Nginx FastCGI cache

Example /etc/nginx/nginx.conf using FastCGI (e.g. to PHP-FPM) with FastCGI cache enabled. This will capture returned data and persist it to a disk based cache store for a configurable amount of time, great for robust full page caching.

Will need to create a directory to hold cache files, for the example given here that would be:

$ sudo mkdir -p /var/cache/nginxfastcgi
$ chown www-data: /var/cache/nginxfastcgi
@algotrader-dotcom
algotrader-dotcom / slackpost
Created October 7, 2016 04:45 — forked from dopiaza/slackpost
Post a message to a Slack channel
#!/bin/bash
# Usage: slackpost <token> <channel> <message>
# Enter the name of your slack host here - the thing that appears in your URL:
# https://slackhost.slack.com/
slackhost=PUT_YOUR_HOST_HERE
token=$1
@algotrader-dotcom
algotrader-dotcom / terraform-2tier-vpc
Created November 1, 2016 11:21 — forked from bluemalkin/terraform-2tier-vpc
Terraform 2 tier VPC with nat
# define some variables
variable "aws_ubuntu_ami" {
default = "ami-972444ad"
}
variable "aws_keypair" {
default = "xxxx"
}
# AWS account details
@algotrader-dotcom
algotrader-dotcom / README.md
Created January 13, 2017 17:32 — forked from leonardofed/README.md
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.


Index: