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 / elasticpress-polylang.php
Created January 23, 2019 03:25
ElasticPress - Polylang
<?php
/**
* Filter Elasticsearch posts by current language.
*/
add_filter( 'ep_formatted_args', function( $formatted_args, $args ) {
if ( function_exists( 'pll_current_language' ) ) {
$lang = pll_current_language();
if ( $lang !== false ) {
@algotrader-dotcom
algotrader-dotcom / install-jenkins.yaml
Last active January 4, 2023 17:57
Install jenkins on aws AMI linux
---
- hosts: 127.0.0.1
connection: local
become: true
tasks:
- name: install wget
yum:
name: wget
state: present
- name: install openjdk
@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 / Compile apache 2.4 + php from source
Last active December 1, 2022 21:23
Compile apache 2.4 + php from source
1. Requirements
yum install pcre*
yum install libxml*
yum install gdbm-devel
2. Download packages
apr-1.5.2.tar.gz
apr-util-1.5.2.tar.gz
@algotrader-dotcom
algotrader-dotcom / Selenium webdriver wait for ajax with Python
Created December 10, 2015 06:05
Selenium webdriver wait for ajax with Python
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.common.exceptions import WebDriverException
def ajax_complete(driver):
try:
return 0 == driver.execute_script("return jQuery.active")
except WebDriverException:
pass
@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 / Apache reverse proxy basic authentication with whitelist IPs
Created October 7, 2015 06:46
Apache reverse proxy basic authentication with whitelist IPs
## This conf will basic auth for all exept IP from graph.facebook, twitter..
<VirtualHost IP:443>
ServerName webapp.com
UseCanonicalName Off
ErrorLog /etc/httpd/logs/ssl_reverse_error_log
CustomLog /etc/httpd/logs/ssl_reverse_access_log combined env=!dontlog
RewriteLog "/etc/httpd/logs/ssl_rewrite.log"
RewriteLogLevel 3
@algotrader-dotcom
algotrader-dotcom / Ansible Kickstart
Last active October 21, 2021 23:08
Ansible Kickstart
##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
use Drupal\node\NodeInterface;
use Drupal\Core\Template\Attribute;
use Drupal\Core\Url;
/**
* Implements hook_preprocess_page() for page.html.twig.
*/
function THEME_preprocess_page(&$vars) {
// Add sitename and slogan to page.
$vars['site_name'] = \Drupal::config('system.site')->get('name');
@algotrader-dotcom
algotrader-dotcom / Git and Github in 5 minutes
Last active July 28, 2021 06:41
Git and Github in 5 minutes
# 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"; ?>