<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[blog.sarame.cn]]></title><description><![CDATA[Thoughts, stories and ideas.]]></description><link>http://blog.sarame.cn/</link><image><url>http://blog.sarame.cn/favicon.png</url><title>blog.sarame.cn</title><link>http://blog.sarame.cn/</link></image><generator>Ghost 3.11</generator><lastBuildDate>Wed, 01 Apr 2026 19:16:16 GMT</lastBuildDate><atom:link href="http://blog.sarame.cn/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[ghost、joplin 部署记录]]></title><description><![CDATA[<pre><code class="language-bash">ghost 启动
#n 切换 node 至少14.14以上
#切换到 ghost 用户
#执行 /usr/local/bin/ghost start

</code></pre><pre><code class="language-bash">joplin
#docker 部署 -- 参考官网
#修改配置文件
cp docker-compose.server.yml docker-compose.yml                                                                                                                                                             
vim docker-compose.yml 
</code></pre><pre><code class="language-vim">version: '3'

services:
    db:
        image: postgres:16
        volumes:
            - ./data/postgres:/var/lib/postgresql/data
        ports:
            - "5432:5432"</code></pre>]]></description><link>http://blog.sarame.cn/ghostjoplin-bu-shu-ji-lu/</link><guid isPermaLink="false">66c70ba1e4f0cb4bee7971e2</guid><dc:creator><![CDATA[zhuanghd]]></dc:creator><pubDate>Thu, 22 Aug 2024 09:57:53 GMT</pubDate><content:encoded><![CDATA[<pre><code class="language-bash">ghost 启动
#n 切换 node 至少14.14以上
#切换到 ghost 用户
#执行 /usr/local/bin/ghost start

</code></pre><pre><code class="language-bash">joplin
#docker 部署 -- 参考官网
#修改配置文件
cp docker-compose.server.yml docker-compose.yml                                                                                                                                                             
vim docker-compose.yml 
</code></pre><pre><code class="language-vim">version: '3'

services:
    db:
        image: postgres:16
        volumes:
            - ./data/postgres:/var/lib/postgresql/data
        ports:
            - "5432:5432"
        restart: unless-stopped
        environment:
            - POSTGRES_PASSWORD=xxxx
            - POSTGRES_USER=xxxxx
            - POSTGRES_DB=joplin
            - TZ=Asia/Shanghai
    app:
        image: joplin/server:latest
        depends_on:
            - db
        ports:
            - "22300:22300"
        restart: unless-stopped
        environment:
            - APP_PORT=22300
            - APP_BASE_URL=https://www.xxxxx.cn
            - DB_CLIENT=pg
            - POSTGRES_PASSWORD=xxx
            - POSTGRES_DATABASE=joplin
            - POSTGRES_USER=xxxx
            - POSTGRES_PORT=5432
            - POSTGRES_HOST=db
            - TZ=Asia/Shanghai
            - MAX_TIME_DRIFT=0 # 可选，部分云服务器需要设置比如腾讯云，阿里云则不用设置 主要是跟 ntp 有关系

#启动

#配置 nginx https 参考如下

# ssl 相关内容 申请好证书之后 下载到 nginx 安装目录即可
server {
     listen 443 ssl;
     server_name www.sarame.cn;
     ssl_certificate sarame.cn_bundle.crt;
     ssl_certificate_key sarame.cn.key;
     ssl_session_timeout 5m;
     ssl_protocols TLSv1.2 TLSv1.3;
     ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
     ssl_prefer_server_ciphers on;
     location / {
        proxy_pass http://127.0.0.1:22300;
        proxy_set_header Host $host;
     }
 }
 
</code></pre>]]></content:encoded></item><item><title><![CDATA[学习 php 的一些必知必会]]></title><description><![CDATA[<hr><p>## PHP 匿名函数与作用域：https://laravelacademy.org/post/21633 闭包和匿名函数：https://laravelacademy.org/post/4341 静态属性和静态方法：https://laravelacademy.org/post/21648 PHP 继承、封装与多态：https://laravelacademy.org/post/21638 抽象类与接口：https://laravelacademy.org/post/21640 trait：https://laravelacademy.org/post/21646</p><p>要求：掌握这些内容的使用方式、使用限制、使用场景。</p><hr><p>## Laravel框架![737276-20181005182255861-926106710](media/16099918192190/737276-20181005182255861-926106710.png)</p><h3 id="-">要点：</h3>]]></description><link>http://blog.sarame.cn/202101202102/</link><guid isPermaLink="false">66c708ece4f0cb4bee7971db</guid><dc:creator><![CDATA[zhuanghd]]></dc:creator><pubDate>Thu, 22 Aug 2024 09:46:20 GMT</pubDate><content:encoded><![CDATA[<hr><p>## PHP 匿名函数与作用域：https://laravelacademy.org/post/21633 闭包和匿名函数：https://laravelacademy.org/post/4341 静态属性和静态方法：https://laravelacademy.org/post/21648 PHP 继承、封装与多态：https://laravelacademy.org/post/21638 抽象类与接口：https://laravelacademy.org/post/21640 trait：https://laravelacademy.org/post/21646</p><p>要求：掌握这些内容的使用方式、使用限制、使用场景。</p><hr><p>## Laravel框架![737276-20181005182255861-926106710](media/16099918192190/737276-20181005182255861-926106710.png)</p><h3 id="-">要点：</h3><p>【核心概念】<br>服务容器：<a href="https://laravelacademy.org/post/8695.html">https://laravelacademy.org/post/8695.html</a><br>服务提供者：<a href="https://laravelacademy.org/post/8697.html">https://laravelacademy.org/post/8697.html</a><br>门面：<a href="https://laravelacademy.org/post/8708.html">https://laravelacademy.org/post/8708.html</a><br>契约：<a href="https://laravelacademy.org/post/8710.html">https://laravelacademy.org/post/8710.html</a><br>中间件：<a href="https://laravelacademy.org/post/19561.html">https://laravelacademy.org/post/19561.html</a><br>控制反转（IoC）和依赖注入（DI）：<a href="https://laravelacademy.org/post/769">https://laravelacademy.org/post/769</a></p><p>要求：了解框架的几个核心概念与使用，在当前广告后台代码中（也可以是框架代码中）找出使用到这些内容的地方，知道他们的执行逻辑。</p><p>【框架知识点】<br>框架自带辅助函数：<a href="https://laravelacademy.org/post/8967.html">https://laravelacademy.org/post/8967.html</a><br>缓存：<a href="https://laravelacademy.org/post/8953.html">https://laravelacademy.org/post/8953.html</a><br>广播：<a href="https://laravelacademy.org/post/8945.html">https://laravelacademy.org/post/8945.html</a><br>事件：<a href="https://laravelacademy.org/post/8962.html">https://laravelacademy.org/post/8962.html</a><br>通知：<a href="https://laravelacademy.org/post/8979.html">https://laravelacademy.org/post/8979.html</a><br>队列：<a href="https://laravelacademy.org/post/8993.html">https://laravelacademy.org/post/8993.html</a><br>任务调度：<a href="https://laravelacademy.org/post/9000.html">https://laravelacademy.org/post/9000.html</a></p><p>要求：了解laravel框架的这几个基本知识点，重点学会存、事件、队列、任务调度的使用，可以自己在框架中书写demo并且调用成功。</p><hr><p>## THINKPHP5 进阶：根据TP的框架结构图，逐步自学tp框架。 ![tp2](media/16099918192190/tp2.png)</p><figure class="kg-card kg-image-card"><img src="http://blog.sarame.cn/content/images/2024/08/tp1.png" class="kg-image" alt="tp1"></figure><h2 id="mysql">Mysql</h2><h3 id="-sql-">基础sql应用</h3><figure class="kg-card kg-image-card"><img src="http://blog.sarame.cn/content/images/2024/08/mysql1.png" class="kg-image" alt="mysq"></figure><figure class="kg-card kg-image-card"><img src="http://blog.sarame.cn/content/images/2024/08/mysql2.png" class="kg-image" alt="mysq"></figure><h3 id="mysql-">mysql一些高级应用</h3><figure class="kg-card kg-image-card"><img src="http://blog.sarame.cn/content/images/2024/08/MySQL3.png" class="kg-image" alt="MySQ"></figure>]]></content:encoded></item><item><title><![CDATA[Python 使用protobuf]]></title><description><![CDATA[<pre><code class="language-plain_text">pip install protobuf

# 编写格式文件 toutiao_dmp.proto
syntax = "proto2";
package toutiao.dmp;
option java_outer_classname = "DmpDataProto";
message DmpData { 
  repeated IdItem idList         = 1; 
}
message IdItem {
    optional uint32 timestamp  = 1;  
    required DataType dataType = 2; 
    required string id         = 3;
    repeated string tags       = 4; 
    enum DataType {
        IMEI               = 0;
        IDFA               = 1;
        UID                = 2;
        IMEI_</code></pre>]]></description><link>http://blog.sarame.cn/python-shi-yongprotobuf/</link><guid isPermaLink="false">66c5eb80e4f0cb4bee7971d3</guid><category><![CDATA[技术文档]]></category><dc:creator><![CDATA[zhuanghd]]></dc:creator><pubDate>Wed, 21 Aug 2024 13:28:32 GMT</pubDate><content:encoded><![CDATA[<pre><code class="language-plain_text">pip install protobuf

# 编写格式文件 toutiao_dmp.proto
syntax = "proto2";
package toutiao.dmp;
option java_outer_classname = "DmpDataProto";
message DmpData { 
  repeated IdItem idList         = 1; 
}
message IdItem {
    optional uint32 timestamp  = 1;  
    required DataType dataType = 2; 
    required string id         = 3;
    repeated string tags       = 4; 
    enum DataType {
        IMEI               = 0;
        IDFA               = 1;
        UID                = 2;
        IMEI_MD5           = 4;
        IDFA_MD5           = 5;
        MOBILE_HASH_SHA256 = 6;
        OAID               = 7;
        OAID_MD5           = 8;
    }
}


#本地安装 protoc 详细安装自行百度

#执行命令生成包文件
/usr/local/protoc4/bin/protoc --python_out=. toutiao_dmp.proto


#python 生成protobuf文件示例代码

# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import time
import base64
import toutiao_dmp_pb2
import sys
import zipfile
import os

# 转化生成pb2格式文件
def generate_valid_file(file_path, pb2_file_name, device_type):
	dmp_data = toutiao_dmp_pb2.DmpData()
	target_file = open(pb2_file_name,'wb')
	index = 1
	for line in open(file_path,"r"):
		device_id = line.strip('\n')
		id_item = dmp_data.idList.add()
		if device_type == 'IMEI':
		    id_item.dataType = toutiao_dmp_pb2.IdItem.IMEI
		else:
		    id_item.dataType = toutiao_dmp_pb2.IdItem.IDFA
		id_item.id = device_id
		if index % 100 == 0:#100条一行
			binary_string = dmp_data.SerializeToString()
			result_string = base64.b64encode(binary_string)
			target_file.write(result_string)
			target_file.write('\n'.encode('utf-8'))
			dmp_data = toutiao_dmp_pb2.DmpData()
		index = index + 1
	binary_string = dmp_data.SerializeToString()
	result_string = base64.b64encode(binary_string)
	target_file.write(result_string)
	target_file.write('\n'.encode('utf-8'))
	target_file.close()
	print("pb2 file done:" + pb2_file_name)
	#打包成zip
	f = zipfile.ZipFile(pb2_file_name + ".zip", 'w', zipfile.ZIP_DEFLATED)
	path_list = pb2_file_name.split("/")
	f.write(pb2_file_name, path_list[-1])
	f.close()
	print("zip file done:" + pb2_file_name + ".zip")

if __name__ == '__main__':
	if len(sys.argv) &lt; 4:
		print("参数不全！");
		exit()
	txt_file = sys.argv[1]
	pb2_file = sys.argv[2]
	device_type = sys.argv[3]
	generate_valid_file(txt_file, pb2_file, device_type)

</code></pre>]]></content:encoded></item><item><title><![CDATA[vmware虚拟机与宿主机共享盘方法--- samba]]></title><description><![CDATA[<figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://cloud.tencent.com/developer/article/1999443"><div class="kg-bookmark-content"><div class="kg-bookmark-title">如何通过Samba共享Linux文件夹-腾讯云开发者社区-腾讯云</div><div class="kg-bookmark-description">Samba（SMB是其缩写） 是一个网络服务器，用于Linux和Windows共享文件之用；Samba 即可以用于Windows和Linux之间的共享文件，也一样用于Linux和Linux之间的共享文件。</div><div class="kg-bookmark-metadata"></div></div><div class="kg-bookmark-thumbnail"><img src="https://cloudcache.tencentcs.com/open_proj/proj_qcloud_v2/gateway/shareicons/cloud.png"></div></a></figure>]]></description><link>http://blog.sarame.cn/vmwarexu-ni-ji-yu-su-zhu-ji-gong-xiang-pan-fang-fa-2/</link><guid isPermaLink="false">664d8f11b412c61be5578375</guid><dc:creator><![CDATA[zhuanghd]]></dc:creator><pubDate>Wed, 22 May 2024 06:26:26 GMT</pubDate><content:encoded><![CDATA[<figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://cloud.tencent.com/developer/article/1999443"><div class="kg-bookmark-content"><div class="kg-bookmark-title">如何通过Samba共享Linux文件夹-腾讯云开发者社区-腾讯云</div><div class="kg-bookmark-description">Samba（SMB是其缩写） 是一个网络服务器，用于Linux和Windows共享文件之用；Samba 即可以用于Windows和Linux之间的共享文件，也一样用于Linux和Linux之间的共享文件。</div><div class="kg-bookmark-metadata"></div></div><div class="kg-bookmark-thumbnail"><img src="https://cloudcache.tencentcs.com/open_proj/proj_qcloud_v2/gateway/shareicons/cloud.png"></div></a></figure>]]></content:encoded></item><item><title><![CDATA[vmware虚拟机与宿主机共享盘方法--- vmhgfs-fuse]]></title><description><![CDATA[<pre><code class="language-shell"># vmware虚拟机 增加共享盘挂载，将宿主机盘符挂载到虚拟机
vim /etc/systemd/system/vmhgfs-fuse.service
# 输入一下内容，目录自行替换</code></pre><p>[Unit]<br>Description=VMware Host-Guest Filesystem<br>DefaultDependencies=no<br>Requires=local-fs.target<br>After=local-fs.target</p><p>[Service]<br>ExecStart=/usr/bin/vmhgfs-fuse .host:/ /data/web/ -o subtype=vmhgfs-fuse,allow_other,big_writes,large_read,kernel_cache,auto_cache -o uid=1000 -o gid=</p>]]></description><link>http://blog.sarame.cn/vmwarexu-ni-ji-yu-su-zhu-ji-gong-xiang-pan-fang-fa/</link><guid isPermaLink="false">664d8cfbb412c61be5578349</guid><dc:creator><![CDATA[zhuanghd]]></dc:creator><pubDate>Wed, 22 May 2024 06:22:00 GMT</pubDate><content:encoded><![CDATA[<pre><code class="language-shell"># vmware虚拟机 增加共享盘挂载，将宿主机盘符挂载到虚拟机
vim /etc/systemd/system/vmhgfs-fuse.service
# 输入一下内容，目录自行替换</code></pre><p>[Unit]<br>Description=VMware Host-Guest Filesystem<br>DefaultDependencies=no<br>Requires=local-fs.target<br>After=local-fs.target</p><p>[Service]<br>ExecStart=/usr/bin/vmhgfs-fuse .host:/ /data/web/ -o subtype=vmhgfs-fuse,allow_other,big_writes,large_read,kernel_cache,auto_cache -o uid=1000 -o gid=1000 -o umask=022<br>ExecStop=/bin/fusermount -u /data/web/<br>RemainAfterExit=yes</p><p>[Install]<br>WantedBy=multi-user.target</p><pre><code>#设置开机自启动即可</code></pre>]]></content:encoded></item><item><title><![CDATA[docker for mac 无法使用 --net host 问题]]></title><description><![CDATA[<figure class="kg-card kg-image-card"><img src="http://blog.sarame.cn/content/images/2023/09/--.png" class="kg-image"></figure><figure class="kg-card kg-image-card"><img src="http://blog.sarame.cn/content/images/2023/09/---1.png" class="kg-image"></figure><p><a href="http://blog.sarame.cn/mac-docker-net-host-wen-ti/docker.for.mac.host.internal">docker.for.mac.host.internal</a> </p><p><a href="http://blog.sarame.cn/mac-docker-net-host-wen-ti/docker.for.mac.localhost">docker.for.mac.localhost</a></p>]]></description><link>http://blog.sarame.cn/mac-docker-net-host-wen-ti/</link><guid isPermaLink="false">650af2a3b412c61be5578331</guid><dc:creator><![CDATA[zhuanghd]]></dc:creator><pubDate>Wed, 20 Sep 2023 13:29:23 GMT</pubDate><content:encoded><![CDATA[<figure class="kg-card kg-image-card"><img src="http://blog.sarame.cn/content/images/2023/09/--.png" class="kg-image"></figure><figure class="kg-card kg-image-card"><img src="http://blog.sarame.cn/content/images/2023/09/---1.png" class="kg-image"></figure><p><a href="http://blog.sarame.cn/mac-docker-net-host-wen-ti/docker.for.mac.host.internal">docker.for.mac.host.internal</a> </p><p><a href="http://blog.sarame.cn/mac-docker-net-host-wen-ti/docker.for.mac.localhost">docker.for.mac.localhost</a></p>]]></content:encoded></item><item><title><![CDATA[VUE 分片上传大文件]]></title><description><![CDATA[<!--kg-card-begin: markdown--><p>前端参考：<a href="https://gitee.com/GaoWeiQiang1996/element-chunk-upload">https://gitee.com/GaoWeiQiang1996/element-chunk-upload</a></p>
<p>上述开源项目在上传超过2.5G的文件的时候 前端会报错，经过排查发现是获取文件md5的方法出问题导致的，故针对大文件获取md5也需要分片获取，<br>
得知原因后对获取大文件md5的方法做了修改，修改后方法如下：</p>
<pre><code>import SparkMD5 from 'spark-md5'
//获取文件MD5
function getFileMD5(file) {
  return new Promise((resolve, reject) =&gt; {
    let that = this
    var blobSlice = File.prototype.slice || File.prototype.mozSlice || File.prototype.webkitSlice,
      chunkSize = 2097152*100, // Read in chunks of 200MB
      chunks</code></pre>]]></description><link>http://blog.sarame.cn/vue-2/</link><guid isPermaLink="false">60ab42c192b82c08445e6bbf</guid><dc:creator><![CDATA[zhuanghd]]></dc:creator><pubDate>Mon, 24 May 2021 06:17:27 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><p>前端参考：<a href="https://gitee.com/GaoWeiQiang1996/element-chunk-upload">https://gitee.com/GaoWeiQiang1996/element-chunk-upload</a></p>
<p>上述开源项目在上传超过2.5G的文件的时候 前端会报错，经过排查发现是获取文件md5的方法出问题导致的，故针对大文件获取md5也需要分片获取，<br>
得知原因后对获取大文件md5的方法做了修改，修改后方法如下：</p>
<pre><code>import SparkMD5 from 'spark-md5'
//获取文件MD5
function getFileMD5(file) {
  return new Promise((resolve, reject) =&gt; {
    let that = this
    var blobSlice = File.prototype.slice || File.prototype.mozSlice || File.prototype.webkitSlice,
      chunkSize = 2097152*100, // Read in chunks of 200MB
      chunks = Math.ceil(file.size / chunkSize),
      currentChunk = 0,
      spark = new SparkMD5.ArrayBuffer(),
      fileReader = new FileReader()
    fileReader.onload = function (e) {
      console.log('read chunk nr', currentChunk + 1, 'of', chunks)
      spark.append(e.target.result) // Append array buffer
      currentChunk++
      if (currentChunk &lt; chunks) {
        loadNext()
      } else {
        resolve(spark.end())
      }
    }
    fileReader.onerror = function () {
      reject(&quot;&quot;)
    }
    function loadNext () {
      var start = currentChunk * chunkSize,
        end = ((start + chunkSize) &gt;= file.size) ? file.size : start + chunkSize
      fileReader.readAsArrayBuffer(blobSlice.call(file, start, end))
    }
    loadNext()
  })
}
</code></pre>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><p>PHP后端接收分片代码如下：</p>
<pre><code>   $postData = $request-&gt;post();
        $filename =  base_path() . '/'.$postData['filename'];//确定上传的文件名
        file_put_contents(&quot;uploadpath&quot;,$filename);
        //第一次上传时没有文件，就创建文件，此后上传只需要把数据追加到此文件中
        if(!file_exists($filename)){
            move_uploaded_file($_FILES['file']['tmp_name'], $filename);
        }else{
            file_put_contents($filename, file_get_contents($_FILES['file']['tmp_name']),FILE_APPEND);
        }
</code></pre>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[VUE调试代码提升更新速度配置]]></title><description><![CDATA[<p>npm install babel-plugin-dynamic-import-node --save-dev<br></p><!--kg-card-begin: markdown--><pre><code>vim .babelrc #编辑该文件 添加如下代码

&quot;development&quot;:{	&quot;plugins&quot;: [&quot;dynamic-import-node&quot;]}
</code></pre>
<!--kg-card-end: markdown--><figure class="kg-card kg-image-card"><img src="http://blog.sarame.cn/content/images/2020/10/image.png" class="kg-image"></figure>]]></description><link>http://blog.sarame.cn/vue/</link><guid isPermaLink="false">5f8013a992b82c08445e6b8f</guid><category><![CDATA[WEB前端技术]]></category><dc:creator><![CDATA[zhuanghd]]></dc:creator><pubDate>Fri, 09 Oct 2020 07:43:59 GMT</pubDate><content:encoded><![CDATA[<p>npm install babel-plugin-dynamic-import-node --save-dev<br></p><!--kg-card-begin: markdown--><pre><code>vim .babelrc #编辑该文件 添加如下代码

&quot;development&quot;:{	&quot;plugins&quot;: [&quot;dynamic-import-node&quot;]}
</code></pre>
<!--kg-card-end: markdown--><figure class="kg-card kg-image-card"><img src="http://blog.sarame.cn/content/images/2020/10/image.png" class="kg-image"></figure>]]></content:encoded></item><item><title><![CDATA[Mysql导出字段结构]]></title><description><![CDATA[<!--kg-card-begin: markdown--><pre><code>SELECT  
    TABLE_NAME 表名,
    COLUMN_NAME 列名,  
    COLUMN_TYPE 数据类型,  
    DATA_TYPE 字段类型,  
    CHARACTER_MAXIMUM_LENGTH 长度,  
    IS_NULLABLE 是否为空,  
    COLUMN_DEFAULT 默认值,  
    COLUMN_COMMENT 备注   
FROM  
    INFORMATION_SCHEMA.COLUMNS  
WHERE  
-- test_database为数据库名称，到时候只需要修改成你要导出表结构的数据库即可  
table_schema ='adcenter'  
AND  
-- test_table为表名，到时候换成你要导出的表的名称  
-- 如果不写的话，默认会查询出所有表中的数据  
table_name  = 'admins'
</code></pre>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><pre><code>SELECT</code></pre>]]></description><link>http://blog.sarame.cn/untitled-2/</link><guid isPermaLink="false">5ef9e8bd92b82c08445e6b78</guid><category><![CDATA[Mysql相关]]></category><dc:creator><![CDATA[zhuanghd]]></dc:creator><pubDate>Fri, 09 Oct 2020 07:43:44 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><pre><code>SELECT  
    TABLE_NAME 表名,
    COLUMN_NAME 列名,  
    COLUMN_TYPE 数据类型,  
    DATA_TYPE 字段类型,  
    CHARACTER_MAXIMUM_LENGTH 长度,  
    IS_NULLABLE 是否为空,  
    COLUMN_DEFAULT 默认值,  
    COLUMN_COMMENT 备注   
FROM  
    INFORMATION_SCHEMA.COLUMNS  
WHERE  
-- test_database为数据库名称，到时候只需要修改成你要导出表结构的数据库即可  
table_schema ='adcenter'  
AND  
-- test_table为表名，到时候换成你要导出的表的名称  
-- 如果不写的话，默认会查询出所有表中的数据  
table_name  = 'admins'
</code></pre>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><pre><code>SELECT
	a.TABLE_NAME 表名,
	b.TABLE_COMMENT 表备注,
	a.COLUMN_NAME 列名,
	a.COLUMN_TYPE 数据类型,
	a.DATA_TYPE 字段类型,
	a.CHARACTER_MAXIMUM_LENGTH 长度,
	a.IS_NULLABLE 是否为空,
	a.COLUMN_DEFAULT 默认值,
	a.COLUMN_COMMENT 备注 
FROM
	INFORMATION_SCHEMA.COLUMNS AS a
	LEFT JOIN INFORMATION_SCHEMA.TABLES AS b ON a.TABLE_NAME = b.TABLE_NAME 
WHERE
	a.table_schema = 'ad_center' and b.TABLE_SCHEMA = 'ad_center'
</code></pre>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[快速安装shadowsockets]]></title><description><![CDATA[<p>yum -y update # 这个是升级命令 效果如下图 <br>有些VPS 没有wget <br>这种要先装 <br>yum -y install wget</p><p>2.安装ss</p><p>wget –no-check-certificate <a href="https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocks.sh">https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocks.sh</a> #每条命令单独操作 <br>chmod +x shadowsocks.sh #第二条命令 <br>./shadowsocks.sh 2&gt;&amp;1 | tee shadowsocks.log #第三条命令 <br>第三条命令执行后就如下图 <br>ps:第二条命令执行以后看起来没有反映，这个不用管。执行后接着执行第三条命令</p>]]></description><link>http://blog.sarame.cn/kuai-su-an-zhuang-sha-do-w-so-c-ke-t-s/</link><guid isPermaLink="false">5ea84d9192b82c08445e6b47</guid><category><![CDATA[其他]]></category><dc:creator><![CDATA[zhuanghd]]></dc:creator><pubDate>Fri, 09 Oct 2020 07:43:32 GMT</pubDate><content:encoded><![CDATA[<p>yum -y update # 这个是升级命令 效果如下图 <br>有些VPS 没有wget <br>这种要先装 <br>yum -y install wget</p><p>2.安装ss</p><p>wget –no-check-certificate <a href="https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocks.sh">https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocks.sh</a> #每条命令单独操作 <br>chmod +x shadowsocks.sh #第二条命令 <br>./shadowsocks.sh 2&gt;&amp;1 | tee shadowsocks.log #第三条命令 <br>第三条命令执行后就如下图 <br>ps:第二条命令执行以后看起来没有反映，这个不用管。执行后接着执行第三条命令</p>]]></content:encoded></item><item><title><![CDATA[过滤nginx访问日志]]></title><description><![CDATA[<p>cat apithird.52ywan.com.log |grep 'click_ks' | sed -n '/03/Jun/2020:10:56/,/03/Jun/2020:15:50/p' &gt; ~/zhd.txt</p>]]></description><link>http://blog.sarame.cn/guo-lu-ngin-x/</link><guid isPermaLink="false">5ed7739092b82c08445e6b62</guid><category><![CDATA[Linux相关]]></category><category><![CDATA[Nginx相关]]></category><dc:creator><![CDATA[zhuanghd]]></dc:creator><pubDate>Fri, 09 Oct 2020 07:43:18 GMT</pubDate><content:encoded><![CDATA[<p>cat apithird.52ywan.com.log |grep 'click_ks' | sed -n '/03/Jun/2020:10:56/,/03/Jun/2020:15:50/p' &gt; ~/zhd.txt</p>]]></content:encoded></item><item><title><![CDATA[mac unzip Illegal byte sequence]]></title><description><![CDATA[<p>mac解压文件：</p><p>直接双击，即命令行的 open，失败了，报错：</p><p>无法将"xxx.zip"解压到"xx"<br>(错误22 - 无效的参数)</p><p></p><p>命令行unzip，失败，报错：</p><p>➜ unzip Interface.zip<br>Archive:  Interface.zip<br>checkdir error:  cannot create i-�++��+<br>Illegal byte sequence<br>unable to process i-�+/�𦷦��-����_+�+��-�_i-�+�_+�+��+���+����_V1.2_2018120411.xlsx.</p><p> 该用ditto</p><p># 后面两个参数，xxx.zip是文件名， xx为解压后的文件夹名称 </p><p>ditto -V -x</p>]]></description><link>http://blog.sarame.cn/mac-unzip-illegal-byte-sequence/</link><guid isPermaLink="false">5ed262e292b82c08445e6b4d</guid><category><![CDATA[Linux相关]]></category><dc:creator><![CDATA[zhuanghd]]></dc:creator><pubDate>Fri, 09 Oct 2020 07:42:38 GMT</pubDate><content:encoded><![CDATA[<p>mac解压文件：</p><p>直接双击，即命令行的 open，失败了，报错：</p><p>无法将"xxx.zip"解压到"xx"<br>(错误22 - 无效的参数)</p><p></p><p>命令行unzip，失败，报错：</p><p>➜ unzip Interface.zip<br>Archive:  Interface.zip<br>checkdir error:  cannot create i-�++��+<br>Illegal byte sequence<br>unable to process i-�+/�𦷦��-����_+�+��-�_i-�+�_+�+��+���+����_V1.2_2018120411.xlsx.</p><p> 该用ditto</p><p># 后面两个参数，xxx.zip是文件名， xx为解压后的文件夹名称 </p><p>ditto -V -x -k --sequesterRsrc --rsrc xxx.ZIP xx</p>]]></content:encoded></item><item><title><![CDATA[mac os 10.15.3 php7.2.10 安装mo ngodb 拓展报错解决。]]></title><description><![CDATA[<p>编译安装make时报错如下</p><!--kg-card-begin: markdown--><pre><code> /usr/local/include/Block.h:16:3: error: Never include this file directly. Use &lt;lzma.h&gt; instead.
    #       error Never include this file directly. Use &lt;lzma.h&gt; instead.
            ^
    /usr/local/include/Block.h:93:2: error: unknown type name 'lzma_check'
            lzma_check check;
            ^
    /usr/local/</code></pre>]]></description><link>http://blog.sarame.cn/mac/</link><guid isPermaLink="false">5e95bdc592b82c08445e6b0f</guid><category><![CDATA[PHP相关]]></category><dc:creator><![CDATA[zhuanghd]]></dc:creator><pubDate>Tue, 14 Apr 2020 13:47:38 GMT</pubDate><content:encoded><![CDATA[<p>编译安装make时报错如下</p><!--kg-card-begin: markdown--><pre><code> /usr/local/include/Block.h:16:3: error: Never include this file directly. Use &lt;lzma.h&gt; instead.
    #       error Never include this file directly. Use &lt;lzma.h&gt; instead.
            ^
    /usr/local/include/Block.h:93:2: error: unknown type name 'lzma_check'
            lzma_check check;
            ^
    /usr/local/include/Block.h:148:2: error: unknown type name 'lzma_vli'
            lzma_vli compressed_size;
            ^
    /usr/local/include/Block.h:172:2: error: unknown type name 'lzma_vli'
            lzma_vli uncompressed_size;
            ^
    /usr/local/include/Block.h:200:2: error: unknown type name 'lzma_filter'
            lzma_filter *filters;
         ^
    /usr/local/include/Block.h:217:20: error: use of undeclared identifier 'LZMA_CHECK_SIZE_MAX'
            uint8_t raw_check[LZMA_CHECK_SIZE_MAX];
                              ^
    /usr/local/include/Block.h:231:2: error: unknown type name 'lzma_vli'
            lzma_vli reserved_int3;
            ^
    /usr/local/include/Block.h:232:2: error: unknown type name 'lzma_vli'
            lzma_vli reserved_int4;
            ^
    /usr/local/include/Block.h:233:2: error: unknown type name 'lzma_vli'
            lzma_vli reserved_int5;
            ^
    /usr/local/include/Block.h:234:2: error: unknown type name 'lzma_vli'
            lzma_vli reserved_int6;
            ^
/usr/local/include/Block.h:235:2: error: unknown type name 'lzma_vli'
        lzma_vli reserved_int7;
        ^
/usr/local/include/Block.h:236:2: error: unknown type name 'lzma_vli'
        lzma_vli reserved_int8;
        ^
/usr/local/include/Block.h:237:2: error: unknown type name 'lzma_reserved_enum'
        lzma_reserved_enum reserved_enum1;
        ^
/usr/local/include/Block.h:238:2: error: unknown type name 'lzma_reserved_enum'
        lzma_reserved_enum reserved_enum2;
        ^
/usr/local/include/Block.h:239:2: error: unknown type name 'lzma_reserved_enum'
        lzma_reserved_enum reserved_enum3;
        ^
/usr/local/include/Block.h:240:2: error: unknown type name 'lzma_reserved_enum'
        lzma_reserved_enum reserved_enum4;
        ^
/usr/local/include/Block.h:261:2: error: unknown type name 'lzma_bool'
        lzma_bool ignore_check;
        ^
/usr/local/include/Block.h:263:2: error: unknown type name 'lzma_bool'
        lzma_bool reserved_bool2;
        ^
/usr/local/include/Block.h:264:2: error: unknown type name 'lzma_bool'
        lzma_bool reserved_bool3;
        ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
1 warning and 20 errors generated.
make: *** [src/libmongoc/src/libmongoc/src/mongoc/mongoc-rand-common-crypto.lo] Error 1
</code></pre>
<!--kg-card-end: markdown--><p>解决方法：</p><p>brew doctor </p><p>rm /usr/local/include/block.h</p><p>然后重新make即可</p>]]></content:encoded></item><item><title><![CDATA[Docker一些常用命令记录]]></title><description><![CDATA[<h6 id="-">查看镜像构建历史</h6><pre><code class="language-shell">docker history xxxxx
</code></pre><h6 id="-centos6-5-">搜索centos6.5的镜像</h6><pre><code class="language-shell">docker search centos6.5 
</code></pre><h6 id="-hasedon-centos6-5">拉取到本地 这里用了hasedon/centos6.5</h6><pre><code class="language-shell">docker pull hasedon/centos6.5
</code></pre><h6 id="--1">使用该镜像运行一个容器</h6><pre><code class="language-shell">docker run -i -t -d 镜像名/ID
</code></pre><h6 id="-shell-">命令行模式进入改容器,或者执行某些shell命令</h6><pre><code class="language-shell">docker exec -it 容器ID /bin/bash
</code></pre><h6 id="docker-top-id-">Docker 使用著名的 top 命令作为子命令的名称，来查看容器产生的进程。它采用容器的名称或 ID 作为参数.</h6><pre><code class="language-shell">docker top containerID
</code></pre><h6 id="--2">容器内外数据共享、拷贝，挂载共享目录到镜像中，运行容器</h6>]]></description><link>http://blog.sarame.cn/untitled/</link><guid isPermaLink="false">5e7d669f92b82c08445e6960</guid><category><![CDATA[Docker相关]]></category><dc:creator><![CDATA[zhuanghd]]></dc:creator><pubDate>Fri, 27 Mar 2020 03:19:04 GMT</pubDate><content:encoded><![CDATA[<h6 id="-">查看镜像构建历史</h6><pre><code class="language-shell">docker history xxxxx
</code></pre><h6 id="-centos6-5-">搜索centos6.5的镜像</h6><pre><code class="language-shell">docker search centos6.5 
</code></pre><h6 id="-hasedon-centos6-5">拉取到本地 这里用了hasedon/centos6.5</h6><pre><code class="language-shell">docker pull hasedon/centos6.5
</code></pre><h6 id="--1">使用该镜像运行一个容器</h6><pre><code class="language-shell">docker run -i -t -d 镜像名/ID
</code></pre><h6 id="-shell-">命令行模式进入改容器,或者执行某些shell命令</h6><pre><code class="language-shell">docker exec -it 容器ID /bin/bash
</code></pre><h6 id="docker-top-id-">Docker 使用著名的 top 命令作为子命令的名称，来查看容器产生的进程。它采用容器的名称或 ID 作为参数.</h6><pre><code class="language-shell">docker top containerID
</code></pre><h6 id="--2">容器内外数据共享、拷贝，挂载共享目录到镜像中，运行容器</h6><pre><code class="language-shell">docker run -it -v ~/Downloads/:/home/ hasedon/centos6.5 /bin/bash
</code></pre><h6 id="--3">导出该镜像</h6><pre><code class="language-shell">docker export containerid &gt; new_img.tar
</code></pre><h6 id="--4">导入镜像</h6><pre><code class="language-shell">docker import - xxx &lt; new_img.tar
</code></pre><h6 id="--5">运行一个容器</h6><pre><code class="language-shell">docker run -it -d -p xx:80 —-name 
</code></pre><h6 id="--6">提交容器到镜像</h6><pre><code class="language-shell">docker commit containerid foo/live
</code></pre><h6 id="--7">导出容器镜像到文件</h6><pre><code class="language-shell">docker export containerid &gt; new_img.tar
</code></pre><h6 id="--8">根据导入的文件创建一个新的镜像</h6><pre><code class="language-shell">docker import - new_img_name &lt; new_img.tar
</code></pre><h6 id="--9">从容器内拷贝文件到主机上，主机上拷贝到容器中</h6><pre><code class="language-shell">docker cp &lt;containerId&gt;:/file/path/within/container /host/path/target  
docker cp /host/path/target  &lt;containerId&gt;:/file/path/within/container 
</code></pre><h6 id="--10">用输入输出符</h6><pre><code class="language-shell">docker exec -it &lt;container_id&gt; bash -c 'cat &gt; /path/to/container/file' &lt; /path/to/host/file/  
</code></pre><h6 id="docker-docker-">Docker 容器内外拷贝数据,docker可以支持把一个宿主机上的目录挂载到镜像里。</h6><pre><code class="language-shell">#通过-v参数，冒号前为宿主机目录，必须为绝对路径，冒号后为镜像内挂载的路径。
docker run -it -v /home/dock/Downloads:/usr/Downloads ubuntu64 /bin/bash
#默认挂载的路径权限为读写。如果指定为只读可以用：ro
docker run -it -v /home/dock/Downloads:/usr/Downloads:ro ubuntu64 /bin/bash
</code></pre><h6 id="docker-">docker还提供了一种高级的用法。叫数据卷。</h6><pre><code class="language-shell">#数据卷：“其实就是一个正常的容器，专门用来提供数据卷供其它容器挂载的”。看示例：
docker run -v /home/dock/Downloads:/usr/Downloads  --name dataVol ubuntu64 /bin/bash
#创建一个普通的容器。用--name给他指定了一个名（不指定的话会生成一个随机的名子）。
#再创建一个新的容器，来使用这个数据卷。
docker run -it --volumes-from dataVol ubuntu64 /bin/bash
--volumes-from用来指定要从哪个数据卷来挂载数据。
</code></pre><h6 id="-mac-">直接在主机上拷贝到容器物理存储系统，MAC上貌似不能这么操作。</h6><pre><code class="language-shell">$ docker ps  

CONTAINER ID      IMAGE    COMMAND       CREATED      STATUS       PORTS        NAMES    
d8e703d7e303   solidleon/ssh:latest      /usr/sbin/sshd -D                      cranky_pare  
 $ docker inspect -f   '{{.Id}}' cranky_pare  
	or   
 $ docker inspect -f   '{{.Id}}' d8e703d7e303  
d8e703d7e3039a6df6d01bd7fb58d1882e592a85059eb16c4b83cf91847f88e5  
$ sudo cp file.txt /var/lib/docker/aufs/mnt/**d8e703d7e3039a6df6d01bd7fb58d1882e592a85059eb16c4b83cf91847f88e5
</code></pre>]]></content:encoded></item><item><title><![CDATA[Docker 使用SQL SERVER 还原sql server的.bak备份文件]]></title><description><![CDATA[<!--kg-card-begin: markdown--><h3 id>一、镜像安装</h3>
<h5 id="1docker">1、从Docker库中拉取镜像</h5>
<pre><code class="language-shell">docker pull microsoft/mssql-server-linux:latest
</code></pre>
<h6 id="dockerimages">执行完毕执行 docker images 查看镜像文件，显示如下：</h6>
<p><img src="http://blog.sarame.cn/wp-content/uploads/2019/04/1.png" alt></p>
<h5 id="2imageid">2、拉取完之后，通过image id运行该镜像</h5>
<pre><code class="language-shell">docker run -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=1234qwer!' \
   -p 1401:1433 --name sql1 \
   -d 314918ddaedf
   
   ## 或者 通过镜像名称跟版本号运行该镜像
docker run -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=1234qwer!</code></pre>]]></description><link>http://blog.sarame.cn/docker-shi-yong-sql-server-huan-yuan-sql-serverde-bakbei-fen-wen-jian/</link><guid isPermaLink="false">5e7d671492b82c08445e696a</guid><category><![CDATA[Docker相关]]></category><dc:creator><![CDATA[zhuanghd]]></dc:creator><pubDate>Fri, 27 Mar 2020 03:19:00 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><h3 id>一、镜像安装</h3>
<h5 id="1docker">1、从Docker库中拉取镜像</h5>
<pre><code class="language-shell">docker pull microsoft/mssql-server-linux:latest
</code></pre>
<h6 id="dockerimages">执行完毕执行 docker images 查看镜像文件，显示如下：</h6>
<p><img src="http://blog.sarame.cn/wp-content/uploads/2019/04/1.png" alt></p>
<h5 id="2imageid">2、拉取完之后，通过image id运行该镜像</h5>
<pre><code class="language-shell">docker run -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=1234qwer!' \
   -p 1401:1433 --name sql1 \
   -d 314918ddaedf
   
   ## 或者 通过镜像名称跟版本号运行该镜像
docker run -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=1234qwer!' \
   -p 1401:1433 --name sql1 \
   -d microsoft/mssql-server-linux:latest

#-e 'ACCEPT_EULA=Y' 表示 将ACCEPT_EULA 变量设置为任何值以确认你接受最终用户许可协议，sql server 镜像必须设置。
#-e 'MSSQL_SA_PASSWORD=1234qwer!'  指定至少8个字符的强密码，sql server 镜像必须设置。
# 这里可以在run的时候通过-v 指定共享目录，这样后面就不用通过docker cp 拷贝数据库文件到容器中了。
</code></pre>
<h5 id="3dockerdockerps">3、要查看您的Docker容器，请使用该docker ps命令。</h5>
<pre><code class="language-shell">docker ps -a 
</code></pre>
<p><img src="http://blog.sarame.cn/wp-content/uploads/2019/04/2.png" alt></p>
<h5 id="4sa">4、更改SA密码</h5>
<pre><code class="language-shell">docker exec -it sql1 /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P '1234qwer!' -Q 'ALTER LOGIN sa WITH PASSWORD=&quot;1234qwer!&quot;'
</code></pre>
<h5 id="5sqlserver">5、连接到SQL Server</h5>
<h6 id="dockerexecitbashshellsql1name">使用该docker exec -it命令在正在运行的容器中启动交互式bash shell。在以下示例sql1中–name，创建容器时由参数指定的名称。</h6>
<pre><code class="language-shell"> sudo docker exec -it sql1 bin/bash
</code></pre>
<h6 id="sqlcmdsqlcmd">一旦进入容器，用sqlcmd本地连接。Sqlcmd默认不在路径中，因此您必须指定完整路径。</h6>
<pre><code class="language-shell">/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P '1234qwer!'
</code></pre>
<h6 id="sqlcmd1">如果成功，您应该到达sqlcmd命令提示符：1&gt;,结果参考如下截图：</h6>
<p><img src="http://blog.sarame.cn/wp-content/uploads/2019/04/3.png" alt></p>
<h5 id="6navicat">6、在外部使用navicat来连接数据库，</h5>
<p><img src="http://blog.sarame.cn/wp-content/uploads/2019/04/4.png" alt></p>
<h3 id>二、还原数据库</h3>
<h5 id="1sql1">1、创建镜像sql1的文件目录</h5>
<pre><code class="language-shell">docker exec -it sql1 mkdir /var/opt/mssql/backup
</code></pre>
<h5 id="2dockercp">2、使用docker cp 命令拷贝文件</h5>
<pre><code class="language-shell">docker cp test.bak sql1:/var/opt/mssql/backup
</code></pre>
<p><img src="http://blog.sarame.cn/wp-content/uploads/2019/04/6.png" alt></p>
<h5 id="3bak">3、还原bak数据库文件</h5>
<pre><code class="language-shell">docker exec -it sql1 /opt/mssql-tools/bin/sqlcmd -S localhost \
   -U SA -P '1234qwer!' \
   -Q 'RESTORE FILELISTONLY FROM DISK = &quot;/var/opt/mssql/backup/test.bak&quot;' \
   | tr -s ' ' | cut -d ' ' -f 1-2
</code></pre>
<h6 id>你应看到类似于下面的输出：</h6>
<p><img src="http://blog.sarame.cn/wp-content/uploads/2019/04/7.png" alt></p>
<h5 id="4restoredatabase">4、调用RESTORE DATABASE命令还原在容器内的数据库。 为每个文件上一步中指定新路径。</h5>
<pre><code class="language-shell">docker exec -it sql1 /opt/mssql-tools/bin/sqlcmd \
   -S localhost -U SA -P '1234qwer!' \
   -Q 'RESTORE DATABASE TESTDB FROM DISK = &quot;/var/opt/mssql/backup/test.bak&quot; WITH MOVE &quot;linshi&quot; TO &quot;/var/opt/mssql/data/linshi.mdf&quot;, MOVE &quot;linshi_log&quot; TO &quot;/var/opt/mssql/data/shifenzheng_log.ldf&quot;'
</code></pre>
<h6 id>你应看到类似于下面的输出：</h6>
<p><img src="http://blog.sarame.cn/wp-content/uploads/2019/04/10.png" alt><br>
<img src="http://blog.sarame.cn/wp-content/uploads/2019/04/11.png" alt></p>
<h5 id>注：可能会遇到以下问题</h5>
<p><img src="http://blog.sarame.cn/wp-content/uploads/2019/04/8.png" alt></p>
<h6 id>解决方法：执行如下命令，查看相关文件分析结果</h6>
<pre><code class="language-shell">docker exec -it sql1 /opt/mssql-tools/bin/sqlcmd \
   -S localhost -U SA -P '1234qwer!' \
   -Q 'RESTORE FILELISTONLY FROM DISK =&quot;/var/opt/mssql/backup/test.bak&quot;'
</code></pre>
<p><img src="http://blog.sarame.cn/wp-content/uploads/2019/04/9.png" alt></p>
<h6 id>查看关键文件的名称与关系，然后替换命令中相关字符。</h6>
<h5 id="navicat">再次连接数据库，通过navicat可以看到：</h5>
<p><img src="http://blog.sarame.cn/wp-content/uploads/2019/04/12.png" alt></p>
<!--kg-card-end: markdown-->]]></content:encoded></item></channel></rss>