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 / Geos installation on centos 6
Last active December 20, 2021 08:36
Geos installation on centos 6
## GeoOS written in C++ (port from Java) great on peformance improve https://geophp.net/geos.html
sudo yum install php-devel
cd /usr/share
sudo wget http://download.osgeo.org/geos/geos-3.3.9.tar.bz2 # Note this changes
sudo tar -xvjf geos-3.3.9.tar.bz2
cd geos-3.3.9
sudo ./configure --enable-php && sudo make clean && sudo make
sudo make install
sudo ldconfig
@algotrader-dotcom
algotrader-dotcom / github error: unable to read askpass response from gnome-ssh-askpass
Created October 29, 2015 16:51
github error: unable to read askpass response from gnome-ssh-askpass
# Root Cause
$cat /etc/profile.d/gnome-ssh-askpass.sh
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
# Fixed
$unset SSH_ASKPASS
then
$git push origin master
@algotrader-dotcom
algotrader-dotcom / Upgrade php 5.4 to 5.6 on Centos 6.x
Created October 30, 2015 07:15
Upgrade php 5.4 to 5.6 on Centos 6.x
# Install Requirements (if normal installed failed)
yum install libicu*
ftp://195.220.108.108/linux/centos/6.7/os/x86_64/Packages/libicu-4.2.1-12.el6.x86_64.rpm
# Step install
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
yum remove php-common
yum install -y php56w php56w-mbstring php56w-opcache php56w-xml php56w-mcrypt php56w-gd php56w-devel php56w-mysql php56w-intl php56w-mbstring php56w-soap php56w-interbase php56w-pgsql php56w-xml php56w-cli php56w-fpm php56w-pear
pecl install memcache
@algotrader-dotcom
algotrader-dotcom / Woocommerce Notes
Created November 2, 2015 07:04
Woocommerce Notes
1. Tranlation: Colo Translate
2. Customize Billing/Shipping: WooCommerce Poor Guys Swiss Knife
@algotrader-dotcom
algotrader-dotcom / Git & Github for current directory to remote
Last active August 7, 2016 12:57
Git & Github for current directory to remote
1. Login github.com, create repositotory with url https://github.com/thuannvn/buddypress.git
2. On local server, cd to buddypress dir
git init
git add .
git commit -m "Import all code"
git remote add origin https://github.com/thuannvn/buddypress.git
git push -u origin master
Enter username/password of github.com
@algotrader-dotcom
algotrader-dotcom / sensei customization
Created November 2, 2015 15:16
sensei customization
1. Change image course
/home/vhosts/noon.vn/wp-content/plugins/Sensei-v1.8.5/classes --> function sensei_course_image
2.
@algotrader-dotcom
algotrader-dotcom / Drupal 7: Alter apache solr query with custom module
Last active November 4, 2015 04:06
Drupal 7: Alter apache solr query with custom module
# Add the following function in MyModule to override $query solr object
# This will change q param to sm_field_location:ha noi
function mymodule_apachesolr_query_alter(DrupalSolrQueryInterface $query) {
// print_r($query)
// print $query->getParam('q');
$query->replaceParam('q', 'sm_field_location:ha noi');
print $query->getParam('q');
//print $query->q;
}
@algotrader-dotcom
algotrader-dotcom / Drupal 7: Apache solr search programtically
Last active November 4, 2015 06:20
Drupal 7: Apache solr search programtically
# Create file solr-test.php
<?php
define('DRUPAL_ROOT', '/home/vhosts/domain.com');
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
$q = 'label:nhan vien kinh doanh '.'AND'.' sm_field_location:ha noi';
$query = apachesolr_drupal_query(); // Get current solr query object
$query->addParam(q, $q);
@algotrader-dotcom
algotrader-dotcom / Drupal 7 : Page template for content type
Created November 5, 2015 09:44
Drupal 7 : Page template for content type
# Step One
---------
create a content type for example: my content type is "fullwidthpage"
# Step Two
------------
copy page.tpl.php and rename to page--fullwidthpage.tpl in template folder.
# Step Three
@algotrader-dotcom
algotrader-dotcom / Apache Solr: Filter query in solr by date
Last active November 9, 2015 07:34
Apache Solr: Filter query in solr by date
If you want to get last week publications you can do somehting like:
&fq=published_date:[NOW-7DAY/DAY TO NOW]
But if you want a concrete date you must do it in the SOLR date format:
&fq=published_date:[2013-07-17T00:00:00Z TO NOW]
I hope that helps
http://server-ip:8984/solr/kiemviecinfo/select?q=label:nhan vien kinh doanh&fq=ds_created:[NOW-3DAY/DAY TO NOW]&wt=xml&indent=true&facet=true&facet.field=sm_vid_Job_Type