Skip to content

Instantly share code, notes, and snippets.

@gexchai
gexchai / Laravel PHP7 LEMP AWS.md
Created May 26, 2017 12:18 — forked from santoshachari/Laravel PHP7 LEMP AWS.md
Laravel 5.x on Ubuntu 16.x, PHP 7.x, Nginx 1.9.x

#Steps to install latest Laravel, LEMP on AWS Ubuntu 16.4 version. This tutorial is the improvised verision of this tutorial on Digitalocean based on my experience.

Install PHP 7 on Ubuntu

Run the following commands in sequence.

sudo apt-get install -y language-pack-en-base
sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install zip unzip
@gexchai
gexchai / google-example.php
Created July 13, 2017 05:40 — forked from fillup/google-example.php
Example of using Google Admin SDK Directory API to get an individual or list of users.
<?php
/**
* Easiest to use composer to install google-api-php-client and generate autoloader
* If you dont want to use composer you can manually include any needed files
*/
include_once 'vendor/autoload.php';
/**
* Client ID from https://console.developers.google.com/
* Must be added in Google Apps Admin console under Security -> Advanced -> Manage API client access
@gexchai
gexchai / docker-cleanup-resources.md
Created August 28, 2017 05:10 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@gexchai
gexchai / soapclient.php
Created July 30, 2018 04:14
Prefix SOAP parameter tag name with namespace for EML payments destination ID
/**
* EML payments require destination ID to be included inside their request
* Example of how the soap look like for the destination ID
* <eml1:DestinationAccountId i:type="eml2:ExternalAccountIdentifier">
* <eml2:ExternalAccountId>ABCD1234</eml2:ExternalAccountId>
* </eml1:DestinationAccountId>
* In order to do this. we need to specify the soap evnalop like this
* <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:eml="http://schemas.datacontract.org/2004/07/EML.Services.Base" xmlns:eml1="http://schemas.datacontract.org/2004/07/EML.Services.External.Shared.DTO" xmlns:eml2="http://schemas.datacontract.org/2004/07/EML.DTO.Identifiers" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
*
* Pay attention to xmlns:i which is what require in order to do i:type="eml2:ExternalAccountIdentifier"
@gexchai
gexchai / Dockerfile
Created July 30, 2018 04:24
Dockerfile sample for Golang development
FROM golang:1.10
ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
# install gin for hot reload
RUN go get github.com/codegangsta/gin
# Download and install the latest release of dep
# Comment Line 11, 12, 16, 17 if you are not using dep
package main
import (
"fmt"
)
/**
* DB structure if we use Mysql
DROP TABLE IF EXISTS `employees`;
CREATE TABLE `employees` (