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 | |
| //@see https://stackoverflow.com/questions/3531857/convert-var-dump-of-array-back-to-array-variable | |
| function unvar_dump($str) { | |
| if (strpos($str, "\n") === false) { | |
| //Add new lines: | |
| $regex = array( | |
| '#(\\[.*?\\]=>)#', | |
| '#(string\\(|int\\(|float\\(|array\\(|NULL|object\\(|})#', | |
| ); | |
| $str = preg_replace($regex, "\n\\1", $str); |
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
| char *get_uniqid() | |
| { | |
| char *uniqid; | |
| struct timeval tv; | |
| timerclear(&tv); | |
| gettimeofday(&tv, NULL); | |
| spprintf(&uniqid, 0, "%08x%05x", (int)tv.tv_sec, (int)tv.tv_usec % 0x100000); | |
| return uniqid; |
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 example.com; | |
| //mobile agent | |
| set $mobile_rewrite do_not_perform; | |
| if ($http_user_agent ~* "(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino") { | |
| set $mobile_rewrite perform; | |
| } |
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
| deb http://mirrors.163.com/ubuntu/ xenial main restricted universe multiverse | |
| deb http://mirrors.163.com/ubuntu/ xenial-security main restricted universe multiverse | |
| deb http://mirrors.163.com/ubuntu/ xenial-updates main restricted universe multiverse | |
| deb http://mirrors.163.com/ubuntu/ xenial-proposed main restricted universe multiverse | |
| deb http://mirrors.163.com/ubuntu/ xenial-backports main restricted universe multiverse | |
| deb-src http://mirrors.163.com/ubuntu/ xenial main restricted universe multiverse | |
| deb-src http://mirrors.163.com/ubuntu/ xenial-security main restricted universe multiverse | |
| deb-src http://mirrors.163.com/ubuntu/ xenial-updates main restricted universe multiverse | |
| deb-src http://mirrors.163.com/ubuntu/ xenial-proposed main restricted universe multiverse | |
| deb-src http://mirrors.163.com/ubuntu/ xenial-backports main restricted universe multiverse |
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
| deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse | |
| deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse | |
| deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse | |
| deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse | |
| deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse | |
| deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse | |
| deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse | |
| deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse | |
| deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse | |
| deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse |
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
| wget https://repo.percona.com/apt/percona-release_0.1-4.$(lsb_release -sc)_all.deb | |
| sudo dpkg -i percona-release_0.1-4.$(lsb_release -sc)_all.deb | |
| sudo apt-get update | |
| sudo apt-get install percona-xtrabackup-24 |
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
| # Aliyun mirror | |
| deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse | |
| deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse | |
| deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse | |
| deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse | |
| deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse | |
| deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse | |
| deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse | |
| deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse | |
| deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse |
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" | |
| "github.com/garyburd/redigo/redis" | |
| "strconv" | |
| "strings" | |
| "time" | |
| ) |
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
| func calcMd5(filePath string) string { | |
| f, err := os.Open(filePath) | |
| if err != nil { | |
| log.Fatal(err) | |
| } | |
| defer f.Close() | |
| h := md5.New() | |
| if _, err := io.Copy(h, f); err != nil { | |
| log.Fatal(err) |
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
| #!/bin/bash | |
| docker stats $(docker ps | awk '{if(NR>1) print $NF}') |