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 / __INDEX.txt
Created May 31, 2018 22:10 — forked from facine/__INDEX.txt
Drupal 8 - Examples
# Taxonomy terms:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_taxonomy_term-php
# Menu links:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_menu_link-php
# File items:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_file-php
# Nodes:
@algotrader-dotcom
algotrader-dotcom / update-d8-node-save
Created May 31, 2018 22:10 — forked from batigolix/update-d8-node-save
Update drupal 8 node and save
use Drupal\node\Entity\Node;
function _svv_tools_set_author() {
$user = user_load_by_name('test');
$query = \Drupal::entityQuery('node');
$nids = $query->execute();
dd($nids);
foreach ($nids as $nid) {
$node = Node::load($nid);
$node->uid->value = $user->id();
@algotrader-dotcom
algotrader-dotcom / script.php
Created May 20, 2018 18:11 — forked from logii/script.php
Create A Node Programmatically on Drupal 8
<?php
use Drupal\Core\DrupalKernel;
use Symfony\Component\HttpFoundation\Request;
$autoloader = require_once 'autoload.php';
$kernel = new DrupalKernel('prod', $autoloader);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
@algotrader-dotcom
algotrader-dotcom / parser.py
Last active January 3, 2018 16:33 — forked from hreeder/parser.py
Python nginx Log Parser
#!/usr/bin/env python
import gzip
import os
import sys
import re
os.system("mkdir nginx-logs")
os.system("cp /var/log/nginx/* nginx-logs/")
INPUT_DIR = "nginx-logs"
@algotrader-dotcom
algotrader-dotcom / mongodb_playbook.yml
Created December 29, 2017 13:20 — forked from ferromir/mongodb_playbook.yml
Ansible Playbook to setup MongoDB on Ubuntu 14.04 (ubuntu/trusty64)
---
- hosts: all
sudo: true
vars:
mongodb_version: 3.0.7
tasks:
- name: MongoDB | Import the public key used by the package management system
apt_key: keyserver=keyserver.ubuntu.com id=7F0CEB10
- name: MongoDB | Create a list file
lineinfile: dest=/etc/apt/sources.list.d/mongodb-org-3.0.list line="deb http://repo.mongodb.org/apt/ubuntu precise/mongodb-org/3.0 multiverse" state=present create=yes
@algotrader-dotcom
algotrader-dotcom / curl.md
Created December 27, 2017 15:11 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

# 10_basic.py
# 15_make_soup.py
# 20_search.py
# 25_navigation.py
# 30_edit.py
# 40_encoding.py
# 50_parse_only_part.py
@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:

@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 / 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