Code Monkey home page Code Monkey logo

blog's Introduction

🇭🇮, I'm huid

  • 🤩 keep it simple, stupid
  • 😍 love php, python, js, go

blog's People

Contributors

zhanghuid avatar

Watchers

 avatar  avatar

blog's Issues

生成 issue blog 的脚本

<?php

function httGet($url) {
    $opts = array(
        'http' => array(
            'method' => 'GET',
            "header" => "User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36"

        ),
        'ssl' => array(
            'verify_peer' => false,
            'verify_peername' => false
            // Ideally use instead
            // 'cafile' => 'path Certificate Authority file on local filesystem'
        ),
    );

    $context = stream_context_create($opts);
    $result = file_get_contents($url, false, $context);

    if ($result === false) {
        return [];
    }

    return json_decode($result, true);
}

$url = 'https://api.github.com/repos/zhanghuid/blog/issues?page=1&per_page=300';

$data = httGet($url);
$ret = [];
foreach($data as $d1) {
    $createdAt = date_create($d1['created_at'])->format('Y-m');
    $ret[$createdAt][] = [
        'title' => $d1['title'],
        'url' => $d1['html_url']
    ];
}

$html = "";
$total = count($ret);
foreach ($ret as $date => $r1) {
    $html .= "# {$date}" . PHP_EOL;
    $html .= PHP_EOL;
    $html .= PHP_EOL;

    $secTotal = count($r1);
    foreach ($r1 as $step => $r11) {

        $html .= "- [{$r11['title']}]({$r11['url']})" . PHP_EOL;
        
        echo "{$total}_{$secTotal}_{$step}" . PHP_EOL;
    }

    $html .= PHP_EOL;
}

file_put_contents('./readme.md', $html);

echo 'done';

解决SSH连接时有关ECDSA主机密钥的警告

本教程将介绍如何在SSH连接时解决有关ECDSA主机密钥的警告
建立新的SSH连接时,指纹会被缓存。因此,如果您为多台机器使用相同的IP地址,则可能会出现警告消息。

$ ssh [email protected]
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:Z90qjsBvFhvvCUFACZ53npyey4uXvjDuJl67qaTiI/A.
Please contact your system administrator.
Add correct host key in /c/Users/mixmedia/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /c/Users/mixmedia/.ssh/known_hosts:4
ECDSA host key for 192.168.33.149 has changed and you have requested strict checking.
Host key verification failed.

解决方案:

  1. 删除本地机器上IP地址的缓存密钥:
    $ ssh-keygen -R 192.168.33.149
  2. 然后,再次尝试SSH连接:
    ssh [email protected]

参考

谷歌插件

下载:

插件id指:

1. 谷歌地址栏输入:chrome://extensions/
2. 勾选开发者模式
3. 每个插件都会出现ID
   eg: ID:eimadpbcbfnmbkopoojfekhnkhdbieeh

插件列表

  • uBlock-Origin:一款高效的请求过滤工具
  • tampermonkey: is the most popular userscript manager
  • Insight.io:IDE like code intelligence and code search for GitHub
  • adblock-plus:is the most popular ad blocker available for Firefox, Chrome...
  • vimium:provides keyboard shortcuts for navigation and control in the spirit of Vim.
  • JSONView:json格式化输出
  • awesome-Screenshot: 网页截图(注释跟录屏)
  • dark-Reader:提供夜间模式的主题
  • octotree: github的侧边菜单

replace-tencent-sourec-list.sh

file="/etc/apt/sources.list.bak"
if [ ! -f "$file" ]; then
    echo '修改中。。。\n'
    sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak
    block="
deb http://mirrors.cloud.tencent.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.cloud.tencent.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.cloud.tencent.com/ubuntu/ xenial-updates main restricted universe multiverse
#deb http://mirrors.cloud.tencent.com/ubuntu/ xenial-proposed main restricted universe multiverse
#deb http://mirrors.cloud.tencent.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.cloud.tencent.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.cloud.tencent.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.cloud.tencent.com/ubuntu/ xenial-updates main restricted universe multiverse
#deb-src http://mirrors.cloud.tencent.com/ubuntu/ xenial-proposed main restricted universe multiverse
#deb-src http://mirrors.cloud.tencent.com/ubuntu/ xenial-backports main restricted universe multiverse
    "
    sudo echo "$block" > "/tmp/sources.list"
    sudo mv /tmp/sources.list /etc/apt/sources.list ##修改成功了
else
    echo '已经是腾讯的了\n'
fi

apt-get clean all
apt-get update

php 堆栈 跟 队列

// 先进先出

    $obj = new \SplQueue();
    $obj->enqueue('aaa');
    $obj->enqueue('bbb');
    $expected = 'aaa';
    $this->assertEquals($expected, $obj->dequeue()); // 绿灯

// 后进先出

    $obj = new \SplStack();
    $obj->push('aaa');
    $obj->push('bbb');
    $obj->rewind();
    
    $expected2 = 'bbb';
    $this->assertEquals($expected2, $obj->current()); // 绿灯

闲侃CPU

CPU利用率(utilization)是指CPU在一段时间内用于做“有用功”的时间和整个这段时间的百分比值。所谓的“有用功”即CPU没有运行内核(kernel)IDLE线程,而是运行用户级(user-level)应用程序线程,或是其它的内核(kernel)线程,或是处理中断。

CPU用来执行用户级(user-level)应用程序的时间称之为user-time,而运行内核级(kernel-level)程序的时间称之为kernel-time。

计算密集型(computation-intensive)程序也许会把几乎所有的时间用来执行用户级(user-level)程序代码。而I/O密集型(I/O-intensive)程序有相当多的时间用来执行系统调用(system call),这些系统调用将会执行内核代码产生I/O。

当一个CPU利用率达到100%时,称之为饱和(saturated)。在这种情况下,线程在等待获得CPU时,将会面临调度延迟(scheduler latency)的问题。

出处

docker 删除镜像小记

一,情景重现

  1. docker image
REPOSITORY                 TAG                 IMAGE ID            CREATED             SIZE
dalan/php7.1               latest              1cfa4075bd78        20 minutes ago      855MB
laradock/php-fpm           2.2-7.0             71c07385bc62        3 days ago          414MB
mysql                      5.7                 5195076672a7        3 weeks ago         371MB
shincoder/homestead        php7.1              47c8ee96a406        5 months ago        855MB
docker4w/nsenter-dockerd   latest              cae870735e91        5 months ago        187kB
shincoder/homestead        php7.0              9d1ea3920d06        15 months ago       830MB
laraedit/laraedit          latest              42d78c084a84        20 months ago       1.18GB
tutum/mariadb              latest              df9904aa3e74        2 years ago         366MB
  1. docker rmi 1cfa4075bd78
Error response from daemon: conflict: unable to delete 1cfa4075bd78 (must be forced) - image is being used by stopped container f8f2d1d0a71e

二,解决方法

  1. docker ps -as
CONTAINER ID        IMAGE                        COMMAND                  CREATED             STATUS                      PORTS               NAMES                     SIZE 
f8f2d1d0a71e        dalan/php7.1                 "/usr/bin/supervisord"   24 minutes ago      Exited (0) 6 minutes ago                        homesteaddocker_web_1     7.62kB (virtual 855MB)
b205e0449a9d        mysql:5.7                    "docker-entrypoint.s…"   15 hours ago        Exited (0) 6 minutes ago                        homesteaddocker_mysql_1   0B ( virtual 371MB)
0f36d22d4a20        shincoder/homestead:php7.1   "bash"                   15 hours ago        Exited (0) 15 hours ago                         zen_feynman               83B (virtual 855MB)
f399e73edf27        shincoder/homestead:php7.1   "bash"                   16 hours ago        Exited (127) 15 hours ago                       heuristic_leavitt         129B (virtual 855MB)
c9dcb1b14a34        laraedit/laraedit:latest     "/bin/bash -c /usr/b…"   17 hours ago        Exited (0) 16 hours ago                         laraedit                  2.65 MB (virtual 1.18GB)
  1. 找到当前要删除的镜像(1cfa4075bd78)的容器名称(homesteaddocker_web_1),执行
    docker rm homesteaddocker_web_1
  2. 删除docker rmi dalan/php7.1
  3. docker images
REPOSITORY                 TAG                 IMAGE ID            CREATED             SIZE
laradock/php-fpm           2.2-7.0             71c07385bc62        3 days ago          414MB
mysql                      5.7                 5195076672a7        3 weeks ago         371MB
shincoder/homestead        php7.1              47c8ee96a406        5 months ago        855MB
docker4w/nsenter-dockerd   latest              cae870735e91        5 months ago        187kB
shincoder/homestead        php7.0              9d1ea3920d06        15 months ago       830MB
laraedit/laraedit          latest              42d78c084a84        20 months ago       1.18GB
tutum/mariadb              latest              df9904aa3e74        2 years ago         366MB

birdso
stackoverflow

docker push 小记

  1. 列出所有的镜像
$ docker images
REPOSITORY                 TAG                 IMAGE ID            CREATED             SIZE
huid/homestead             7.0                 69cd01741a9d        About an hour ago   961MB
  1. 对镜像进行打标签
情况1:若前面在 Docker Hub 上创建了仓库,推送镜像名称必须要和 Docker Hub上的仓库名称一致

## 打标签
docker tag huid/homestead:7.0 zhanghuidee/homestead
## docker images
REPOSITORY                 TAG                 IMAGE ID            CREATED             SIZE
huid/homestead             7.0                 69cd01741a9d        About an hour ago   961MB
zhanghuidee/homestead      latest              69cd01741a9d        About an hour ago   961MB

## 推送
docker push zhanghuidee/homestead

情况2:没有情况1的前提【报错:denied: requested access to the resource is denied】
docker push huid/homestead

【参考】

npm-composer-package

composer

1. init composer

# 1. mkdir php-composer
# 2. cd php-composer
# 3. composer init
{
    "name": "huid/php-composer",
    "authors": [
        {
            "name": "zhanghuide",
            "email": "[email protected]"
        }
    ],
    "require": {}
}

2. test

  1. preset the env
# 1. create flarum project
composer create-project flarum/flarum your-path --stability=beta= -vvv
# 2. in current project root path, make dir && name called packages
cd your-path
mkdir packages && cd packages
# mkdir dir like tree
#|__vendor
#|____projectName
#|______composer.json # like first step

# example
packages
│   └── dl
│       └── login
│           ├── composer.json
│           ├── extend.php
│           ├── js
│           │   ├── admin.js
│           │   ├── forum.js
│           │   ├── package.json
│           │   ├── src
│           │   │   ├── admin
│           │   │   │   └── index.js
│           │   │   └── forum
│           │   │       └── index.js
│           │   └── webpack.config.js
│           ├── LICENSE.md
│           ├── README.md
│           ├── resources
│           │   ├── less
│           │   │   ├── admin.less
│           │   │   └── forum.less
│           │   └── locale
│           │       └── en.yml
│           └── src
│               └── Api
│                   └── HelloWorldController.php
  1. rum the command
  • write the segment into the composer.json
"repositories": [{
    "type": "path",
    "url": "packages/dl/login"
}]
  • composer require "dl/login @dev" -vvv

NPM

  1. npm init
mkdir your-lib-project && cd your-lib-project
npm init

#{
#  "name": "demo",
#  "version": "1.0.0",
#  "description": "",
#  "main": "index.js",
#  "scripts": {
#    "test": "echo \"Error: no test specified\" && exit 1"
#  },
#  "author": "",
#  "license": "ISC"
#}
#
  1. cd your-main-project
npm install your-lib-project-path
  1. example
# in macos
cd ~/Library/Application\ Support/picgo/
npm install /usr/home/picgo-plugin-<your-plugin-name>

picgo插件

rc.local 日志查看

常用方法

1. sudo cat /var/log/syslog | grep -i rc.local
2. journalctl -e -u rc-local.service
3. systemctl status rc-local.service

不建议啥都往rc.local里扔,建议用systemd service 脚本,例如:

sudo systemctl edit --foce frpc.service

[Unit]
Description=frpc service
After=network.target
Wants=network.target
[Service]
Type=simple
ExecStart=/usr/local/frp/frpc -c /etc/frpc.ini
Restart=on-failure
[Install]
WantedBy=multi-user.target

sudo systemctl enable frpc

配置rc.local开机自启动文件的疑问?

replace-aliyun-source-list.sh

file="/etc/apt/sources.list.bak"
if [ ! -f "$file" ]; then
    echo '修改中。。。\n'
    sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak
    block="
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
    "
    sudo echo "$block" > "/tmp/sources.list"
    sudo mv /tmp/sources.list /etc/apt/sources.list ##修改成功了
else
    echo '已经是阿里的了\n' ##已经是阿里的了
fi

apt-get clean all
apt-get update

数据更新维护

问题描述

大多数情况下,第一次新增的记录,在第二次会修改【体现在 修改值删除记录】,维护最新数据大体有两种方法

方案

  1. 维护updated_at字段,更新的记录的updated_at字段的数据是当前时间,所以,只要删除旧的【time<updated_at】就可以了。
  2. 维护version字段,每次update的时候,递增version的值,所以,只要删除version不是最新的就可以了

window command下,执行".cmd"文件

window 10下的命令行界面,执行.cmd文件的方法

  • error way :
F:\webpack-learning> ./node_modules/.bin/webpack.cmd
  • success way :
F:\webpack-learning> node_modules\.bin\webpack.cmd

第二种路径表示的话,按 tab 键是会自动补全的

laravel jwt 的多用户认证

  1. 在composer.json里配置
"require": {
        "tymon/jwt-auth": "1.0.0-rc.2"
    },
  1. 在auth.php里配置
// 在guards数组里配置 
    'guards' => [
        'web' => [
            'driver' => 'session',
            'provider' => 'users',
        ],

        'api' => [
            'driver' => 'jwt',
            'provider' => 'users',
        ],
        'customer_api' => [
            'driver' => 'jwt',
            'provider' => 'customers',
        ],
    ],
// 在providers数组里配置
    'providers' => [
        'users' => [
            'driver' => 'eloquent',
            'model' => App\User::class,
        ],
        'customers' => [
            'driver' => 'eloquent',
            'model' => App\Customer::class,
        ],
    ],
  1. 新建jwt中介件跟customer.jwt中介件
// jwt 中介件

class RefreshToken extends BaseMiddleware
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        $guard = auth()->guard('api');
        $token = $request->input('token');
        try {
            $this->checkForToken($request); // Check presence of a token.
            // 检测用户的登录状态,如果正常则通过
            $id = $guard->setToken($token)->getPayload()->get('sub');

            if (! $guard->byId($id)) {
                throw new UnauthorizedHttpException('jwt-auth', '用户不存在');
            }
            return $next($request);  // Token is valid. User logged. Response without any token.
        } catch (TokenExpiredException $t) { // Token expired. User not logged.
            // 此处捕获到了 token 过期所抛出的 TokenExpiredException 异常,我们在这里需要做的是刷新该用户的 token 并将它添加到响应头中
            try {
                // 刷新用户的 token
                $token = $guard->refresh();
                // 使用一次性登录以保证此次请求的成功
                $guard->onceUsingId($guard->manager()->getPayloadFactory()->buildClaimsCollection()->toPlainArray()['sub']);

            } catch (JWTException $exception) {
                // 如果捕获到此异常,即代表 refresh 也过期了,用户无法刷新令牌,需要重新登录。
                throw new UnauthorizedHttpException('jwt-auth', $exception->getMessage());
            }
        }
        return $this->setAuthenticationHeader($next($request), $token); // Response with new token on header Authorization.
    }
}

// customer.jwt中介件
class CustomerRefreshToken extends BaseMiddleware
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        $guard = auth()->guard('customer_api');
        $token = $request->input('token');
        try {
            $this->checkForToken($request); // Check presence of a token.
            // 检测用户的登录状态,如果正常则通过
            $id = $guard->setToken($token)->getPayload()->get('sub');
            if (! $guard->byId($id)) {
                throw new UnauthorizedHttpException('jwt-auth', '用户不存在');
            }
            return $next($request);  // Token is valid. User logged. Response without any token.
        } catch (TokenExpiredException $t) { // Token expired. User not logged.
            // 此处捕获到了 token 过期所抛出的 TokenExpiredException 异常,我们在这里需要做的是刷新该用户的 token 并将它添加到响应头中
            try {
                // 刷新用户的 token
                $token = $guard->refresh();
                // 使用一次性登录以保证此次请求的成功
                $guard->onceUsingId($guard->manager()->getPayloadFactory()->buildClaimsCollection()->toPlainArray()['sub']);

            } catch (JWTException $exception) {
                // 如果捕获到此异常,即代表 refresh 也过期了,用户无法刷新令牌,需要重新登录。
                throw new UnauthorizedHttpException('jwt-auth', $exception->getMessage());
            }
        }
        return $this->setAuthenticationHeader($next($request), $token); // Response with new token on header Authorization.
    }
}
  1. 注册中介件
// app\Http\Kernel.php
 protected $routeMiddleware = [
        'refresh.token' => \App\Http\Middleware\RefreshToken::class,
        'refresh.customer.token' => \App\Http\Middleware\CustomerRefreshToken::class,
    ];
  1. 新建控制器
  • AuthController,并加入authenticate方法
public function authenticate(\Illuminate\Http\Request $request)
{
    $credentials = $request->only('email', 'password'); // grab credentials from the request
    try {
        if (!$token = \Auth::guard('api')->attempt($credentials)) { // attempt to verify the credentials and create a token for the user
            return response()->json(['error' => 'invalid_credentials'], 401);
        }
    } catch (JWTException $e) {
        return response()->json(['error' => 'could_not_create_token'], 500); // something went wrong whilst attempting to encode the token
    }
    return response()->json(['token' => "Bearer $token"]);
}
  • CustomerAuthController,并加入authenticate方法
public function authenticate(\Illuminate\Http\Request $request)
{
    $credentials = $request->only('email', 'password'); // grab credentials from the request
    try {
        if (!$token = \Auth::guard('customer_api')->attempt($credentials)) { // attempt to verify the credentials and create a token for the user
            return response()->json(['error' => 'invalid_credentials'], 401);
        }
    } catch (JWTException $e) {
        return response()->json(['error' => 'could_not_create_token'], 500); // something went wrong whilst attempting to encode the token
    }
    return response()->json(['token' => "Bearer $token"]);
}
  1. 在api.php里配置路由
// 第一个用户
Route::post('auth/signin', 'AuthController@authenticate');
Route::group(['middleware' => [['auth:api'], 'jwt']], function () {
    // Protected routes
    Route::get('user', 'IndexController@user');
});
// 第二个用户
Route::post('auth/customer/signin', 'CustomerAuthController@authenticate');
Route::group(['middleware' => ['auth:customer_api', 'customer.jwt']], function () {
    // Protected routes
    Route::get('customer', 'IndexController@customer');
});

这里需要注意的是:

  • 需要添加auth:api中间件在jwt中介件前
  • 需要添加auth:customer_api中间件在customer.jwt中介件前
  1. 处理Exception 的Handle.php
/**
  * Render an exception into an HTTP response.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Exception  $exception
  * @return \Illuminate\Http\Response
  */
public function render($request, Exception $e)
{
    if ($e instanceof UnauthorizedHttpException) {  // 这里是 refresh 过期了,用户无法刷新令牌,需要重新登录。
        return response()->json([
            'message' => '登录已过期,请重新登录',
        ], 401);
    }

    return parent::render($request, $e);
}
  1. 测试

[1]. 新建IndexController,并添加两个方法

public function user()
{
    $user = auth()->guard('api')->user();
    return $user;
}

public function customer()
{
    $customer = auth()->guard('customer_api')->user();
    return $customer;
}

[1]. 测试路由:http://localhost:8000/auth/signin,得到token

[2]. 测试路由:http://localhost:8000/user,得到user的信息。

docker commit 小记

情景:当你ssh进去容器时,你可以安装zsh,但....你stop了容器。然后你再up容器,此时你会发现,你的zsh不见了。

解决方案:

使用docker commit

# 命令
docker ps -as
# 结果
CONTAINER ID        IMAGE 
1811a435152a        ubuntu:16.04 
# 命令
docker commit (contaner-id) -m "xxx" --author "xxx" new-image-name
example: docker commit -m "add aa.txt" --author "zhanghuid" 1811a435152a demo
# 结果
CONTAINER ID        IMAGE 
22b8d1e20877        demo
  • -m:指注释
  • --author:指作者
  • contaner-id:指你当时安装zsh时ssh进去的容器id,比如:root@61422c0aabb;其中61422c0aabb就是容器id
  • new-image-name:指的是根据当前容器id,所构建的新的镜像名字
  • docker ps -as 可以查看容器的id

ssh connect remote server: WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!

一,情景重现

  1. homestead的docker-compose.yml文件
  2. 执行docker-compose up -d ,此时的配置文件如下
web:
    image: shincoder/homestead:php7.0

ssh homestead@localhost // success
3. 执行docker-compose up -d,此时的配置文件如下

web:
    image: shincoder/homestead:php7.1

ssh homestead@localhost //fail

二,解决方案:

ssh-keygen -R localhost // 这里localhost指的是远程的主机的ip

三,原因猜想:

  1. 当第一次执行docker-compose up -d 时,将开启一个web容器,此时ssh homestead@localhost时,会在客户端跟服务端同时记录一点东西,在客户端记录为 /c/Users/huid/.ssh/known_hosts文件下的:
 localhost ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBL6GQ+kHZsnKdxqKKNYyJFts0fmdsYb3AGWyBL4kkLqerFnonQVG6FuUncYpKlcBwNjQK9
    wyDamugIvFhknqg7Q=
  1. 当第二次执行docker-compose up -d时,也开启了一个web容器(之前那个停掉了),此时ssh homestead@localhost时,由于之前know_hosts文件记录的签名跟现在的不一样了。

【参考】

db sql

1. 创建数据库,并指定字符集

CREATE DATABASE
IF
	NOT EXISTS RUNOOB DEFAULT CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci;

wamp的安装及升级

安装


  • 下载wamp地址:官网
  • 可能需要下载vc++

升级


  • 地址
  • 升级单个:下载Addons Wampserver 3(php/apache/mysql)的可执行程序
  • 升级整个:下载wampserver updates的可执行程序

fish bash

fish


preset

  1. github

install fish

sudo yum install fish

install oh-my-fish

You can also install Oh My Fish with Git or with an offline source tarball downloaded from the releases page:

$ git clone https://github.com/oh-my-fish/oh-my-fish 
$ cd oh-my-fish
$ bin/install --offline
# with a tarball
$ curl -L https://get.oh-my.fish > install
$ fish install --offline=omf.tar.gz

upgrade your git

if show message like : Install aborted: Git version 1.9.5 or greater required;
link

choose one you like

like

Links

Oh My Fish! 让你的 Shell 漂亮起来

防盗链的简单做法

  • nginx,针对目录的
location /images/ {
  alias /data/images/;
  valid_referers none blocked *.xx.com xx.com;
  if ($invalid_referer) {
     return 403;
  }
}
  • laravel 内置的加解密
// 加密
$url = url(env('APP_URL') . 'api/image?hash=' . encrypt($this->image));
// 解密
$hash = \request()->input('hash');
$path = decrypt($hash);
// 渲染图片
$ext = pathinfo(storage_path($path), PATHINFO_EXTENSION);
$file = Storage::get($path);

response($file, 200)->header('Content-Type', 'image/'. $ext);

Docker for windows设置Shared Disk不成功

  1. 运行gpedit.msc
  2. 进行如下设置
window设置
│
└───安全设置
│   │
│   └───本地策略
│            │
│            └───安全选项
│                      │
│                      └───网络访问:本地账户的共享跟安全模型
│                               │
│                               └───经典 - 对本地用户进行身份验证,不改变其本来身份
│
│ 

【参考】

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.