- basic build.gradle directory using flatDir
repositories {
mavenCentral()
flatDir {
dirs 'libs'| // 前端做数据分页 | |
| function pagination(pageNo, pageSize, array) { | |
| var offset = (pageNo - 1) * pageSize; | |
| return (offset + pageSize >= array.length) ? array.slice(offset, array.length) : array.slice(offset, offset + pageSize); | |
| } | |
| // 后端django做分页 | |
| from django.core.paginator import Paginator |
| import base64 | |
| import json | |
| from Crypto import Random | |
| from Crypto.Cipher import AES | |
| from star_site import settings | |
| class AESCrypt: |
| # Check if a Python list item contains a string inside another string | |
| # If you only want to check for the presence of abc in any string in the list, you could try | |
| some_list = ['abc-123', 'def-456', 'ghi-789', 'abc-456'] | |
| if any("abc" in s for s in some_list): | |
| # whatever | |
| # If you really want to get all the items containing abc, use | |
| matching = [s for s in some_list if "abc" in s] |
| import os | |
| import sys | |
| import base64 | |
| import json | |
| from Crypto import Random | |
| from Crypto.Cipher import AES | |
| class AESCrypt: |
add to ~/.zshrc
alias setproxy="export ALL_PROXY=socks5://127.0.0.1:1080"
alias unsetproxy="unset ALL_PROXY"
alias ip="curl -i http://httpbin.org/ip"
then restart termainl
| # get current dir size! | |
| $ du -sh | |
| >>> 224M . | |
| # get specific file (logs) size! | |
| $ du -sh logs | |
| >>> 2.7M logs | |
| # get disk useage | |
| $ df -h |
| $ docker pull mongo:3.0.15-wheezy | |
| $ docker run --name mongo -itd -p 27017:27017 mongo:3.0.15-wheezy --auth | |
| # 增加admin管理账号 | |
| $ docker exec -it mongo mongo admin | |
| > use admin | |
| switched to db admin |
| -- get now | |
| select DATE(NOW()); | |
| -- date between | |
| WHERE CONVERT(start_date, DATE) => DATE(NOW()) AND CONVERT(end_date, DATE) => DATE(NOW(); | |
| -- 7天前 2017-10-25 | |
| select convert(NOW(), DATE) - interval 7 day; | |
| -- 今天 |
| Had a similar problem with my reverse proxy. | |
| This is the configuration that finally did it for me: | |
| location / { | |
| proxy_http_version 1.1; | |
| proxy_set_header Upgrade $http_upgrade; | |
| proxy_set_header Connection "upgrade"; | |
| proxy_set_header Host $http_host; | |
| proxy_set_header X-Real-IP $remote_addr; | |
| proxy_set_header X-Forward-For $proxy_add_x_forwarded_for; | |
| proxy_set_header X-Forward-Proto http; |