Skip to content

Instantly share code, notes, and snippets.

View algotrader-dotcom's full-sized avatar

Mai_Xoa algotrader-dotcom

View GitHub Profile
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 / i2_playbook.yml
Last active March 26, 2019 01:01
i2_playbook.yml
---
- 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 / status_ok.json
Last active March 22, 2019 16:58
status_ok.json
{
"notifications":{
"slack":{
"channel":"#business-listing",
"username":"statusok",
"channelWebhookURL":"https://hooks.slack.com/services/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"
}
},
"database":{
"influxDb":{
@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 / 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 / formatted-args.txt
Created January 23, 2019 03:24 — forked from solepixel/formatted-args.txt
ElasticPress arguments
Array
(
[from] => 0
[size] => 54
[sort] => Array
(
[0] => Array
(
[meta_value_num] => Array
(
@algotrader-dotcom
algotrader-dotcom / README.md
Created January 22, 2019 11:15 — forked from hofmannsven/README.md
How to create a Post Like System for WordPress.
@algotrader-dotcom
algotrader-dotcom / us_state_abbreviations.py
Created January 22, 2019 09:31 — forked from JeffPaine/us_state_abbreviations.py
A python list of all US state abbreviations.
states = ["AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DC", "DE", "FL", "GA",
"HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD",
"MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ",
"NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC",
"SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY"]
@algotrader-dotcom
algotrader-dotcom / us_state_abbrev.py
Created January 22, 2019 09:31 — forked from rogerallen/us_state_abbrev.py
A Python Dictionary to translate US States to Two letter codes
us_state_abbrev = {
'Alabama': 'AL',
'Alaska': 'AK',
'Arizona': 'AZ',
'Arkansas': 'AR',
'California': 'CA',
'Colorado': 'CO',
'Connecticut': 'CT',
'Delaware': 'DE',
'Florida': 'FL',
@algotrader-dotcom
algotrader-dotcom / pirewall.sh
Created November 27, 2018 08:59 — forked from sturadnidge/pirewall.sh
Script to setup a basic ruleset for iptables, used on my raspberrypi firewall.
#!/bin/sh
# * eth0 = Internet interface (DHCP)
# * eth1 = LAN interface (192.168.1.0/24)
# * eth2 = DMZ interface (172.16.0.0/16)
# * Traffic open from firewall to internet
# * Traffic open and translated from LAN and DMZ to internet
# * Traffic open from LAN to Firewall
# * Traffic open from LAN to DMZ
# * Traffic open from internet to a DMZ web server