This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"io/ioutil" | |
"os" | |
"path/filepath" | |
"strings" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function gen_uuid(){ | |
return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', | |
// 32 bits for "time_low" | |
mt_rand(0, 0xffff), mt_rand(0, 0xffff), | |
// 16 bits for "time_mid" | |
mt_rand(0, 0xffff), | |
// 16 bits for "time_hi_and_version", | |
// four most significant bits holds version number 4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Use docker-compose | |
1. Dockerfile | |
FROM php:5.6-fpm | |
RUN docker-php-ext-install pdo pdo_mysql mysql mysqli | |
EXPOSE 9000 | |
2. docker-compose.yml | |
php: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:trusty | |
ENV HOME /root | |
ENV LC_ALL C.UTF-8 | |
ENV LANG en_US.UTF-8 | |
ENV LANGUAGE en_US.UTF-8 | |
RUN add-apt-repository ppa:ondrej/php && \ | |
apt-get update |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server{ | |
listen 80; | |
server_name abc.com; | |
index index.html index.htm index.php default.html default.htm default.php; | |
location / { | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_set_header X-NginX-Proxy true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var magic_code = { | |
NUMBER: '0123456789', | |
ALPHPA: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', | |
ALL: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', | |
/** | |
* 生成编码。其中‘数’代表0-9,‘字’代表A-Z,‘全’代表0-9A-Z。其它字符照常显示 | |
* @param 模版字符串 | |
* @return string 字符串 | |
*/ | |
gen_code: function (str_fmt) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class MagicCode{ | |
const NUMBER = '0123456789'; | |
const ALPHPA = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; | |
const ALL = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; | |
/** | |
* 生成编码。其中‘数’代表0-9,‘字’代表A-Z,‘全’代表0-9A-Z。其它字符照常显示 | |
* @param string 模版字符串 | |
* @return string 字符串 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* data为数组 | |
*/ | |
private function _download_excel($filename,$data){ | |
require_once __DIR__ . '/Lib/Excel/PHPExcel.php'; | |
$objPHPExcel=new \PHPExcel(); | |
$alphas = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; | |
foreach($data as $line_index => $line){ | |
$column_index = 0; | |
foreach($line as $key => $filed){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var newman = require('newman'); // require newman in your project | |
var nodemailer = require('nodemailer'); | |
var fs = require('fs'); | |
var export_file = './htmlResults_for_mail.html'; | |
var collection_file = './postman_echo.postman_collection.json'; | |
// call newman.run to pass `options` object and wait for callback | |
newman.run({ | |
collection: require(collection_file), | |
reporters: ['cli','html'], |
NewerOlder