Vim Skill

vim 是一个很好用的编辑器,应用十分广泛。但关于 vim,总有一些你不知道的事情,我们需要持续不断的学习。

我经常使用 vim,也经常在各大社区、论坛看到 vim 专家用户分享经验,今天我们就总结其中常用的一部分,分享给大家。

1,使用内置帮助(built-in help)

使用 vim 的内置帮助是一个好习惯(虽然很多朋友更喜欢在网上搜索相关的使用方法)。查看帮助的语法如下表格所示:

:help :w	有关 :w 命令的帮助

:help j	有关“j”键在正常模式上下文中的帮助

:help v_J	有关在上下文中使用“J”键到视觉模式的帮助

:help i_<Esc>	有关在上下文中使用“Esc”键插入模式的帮助

:help /\n	有关搜索模式“\n”的帮助

2,以普通用户身份打开,以 root 用户身份保存

在编辑系统文件或者受权限保护的文件的时候,很容易会忘记在 vim 编辑之前添加 sudo,这样将会以只读模式打开文件,也就是编辑后不能保存。

但是这时候,你可能已经对文件做了一些修改(尚未保存),很显然,强制退出不是一个好选择。

在这些情况下,在 vim 中键入以下命令: :w !sudo tee % 键入此命令后,将要求您输入sudo命令的密码,然后文件就可以保存了。

注:我们应该使用 sudo edit 命令而不是 sudo vim 来编辑需要超级用户权限的文件。

我们将上述命令拆解来看下:


:w - 这是写入命令。由于没有给出参数,vim 将把整个文件写入标准输出;

!sudo - 将 sudo 命令作为 shell 命令而不是 vim 命令运行;

tee - tee命令用于读取标准输入并将其写入标准输出或文件;

% - vim 将其替换为您正在编辑的当前文件的名称。

:w 命令将整个文件写入 STDOUT(标准输出);然后,我们使用sudo命令(因为我们编辑的毕竟是一个系统文件)来获得临时权限。

百分号(%)表示文件名,tee 命令从 STDOUT 获取 vim 的输出并将其写入 % 文件。

这基本上适用于 <Vim’s STDOUT> | sudo tee /etc/ssh/sshd_config,有点复杂…

3,将所有空格转为制表符(或者反过来)

我们都喜欢使用制表符(tab)或者空格,但是,如果我们正在编辑的文本其缩进使用的符号正好与我们的习惯相反,该怎么办?

3.1 将所有空格转换为制表符

如果当前文件使用空格缩进文本,希望将它们转换为制表符时,需要运行如下两个 vim 命令:

:set noexpandtab :retab! 这样做会将所有空格转换为其等效的制表符。如果文档使用两个空格作为缩进宽度,它们将转换为1个制表符。如果 4 个空格用作单个缩进宽度时,这 4 个制表位将替换为 1 个制表字符。 3.2 将所有制表符转换为空格

如果要编辑的文件使用制表符缩进,并且要将制表符转换为空格,则需要运行如下4个 vim 命令:

:set expandtab :set tabstop=4 :set shiftwidth=4 :retab 第一个命令(expandtab)告诉 vim 使用空格展开 tab,第二个命令(tabstop)设置使用多少个空格用作一个“缩进块”。 在我们的例子中,我们定义了“1个tab=4个空格”;当使用»运算符时,shiftwidth 命令用于控制缩进,这也被设置为4个空格。

最后,retab 命令将所有制表符(用于缩进)转换为空格。

4,缩进所有行

错误的缩进,在 python 或者 YAML 程序中会报错,导致程序不能正确运行。

要缩进所有行,按 gg 键到达文件顶部,然后按 = 键表示“缩进”,最后按 G 键表示到“最后一行”。

这样将会自动缩进,从第一行到最后一行。

如下图所示,我使用 :gg=G命令缩进的演示: 图片

正如你所看到的(从这个有限的预览中),所有行都正确缩进。

5,粘贴代码时保留缩进

我们都有过在互联网上复制代码的时候。当将代码粘贴到文件中时,缩进都给弄乱了,这时候需要怎样做呢?

为了避免这种情况,请在 .vimrc 文件中添加以下代码:

set pastetoggle= 对 vimrc 文件进行如上更改后,在粘贴代码之前按 F2 键,这样做将确保代码粘贴正确的缩进。 6,以正确的缩进深度开始书写

假设光标在第一行第一列,但是所要写的内容需要缩进,那在不按下制表符(tab)和空格键的情况下,应该怎样做呢?

答案是在正常模式下按下 S 键。

当光标位于行的第一列时,按 Esc 键进入正常模式。然后按 S(大写)键,这会将光标移动到适当的缩进深度,并自动进入“插入”模式,以便开始键入。 图片

上图,我的光标位于第一列,通过按S键,光标移动到正确的缩进深度,Vim从正常模式切换到插入模式。

7,保存文件前显示差异

我们可能遇到过这样的情况:我修改了这个文件,但是忘记都做了哪些修改了,并且我担心其中有些地方可能修改错了。

解决此问题的方法是查看缓冲区和文件之间的差异。可在 vim 中执行如下命令:

:w !diff % - 我们将上述命令拆解来看:

:w 用于保存/写入,在这个特定场景中,如果命令中没有指定文件名,则输出将写入STDIN(标准输入)文件;

:! 是执行 shell 命令的语法,在这个例子中,我们在 shell 中运行 diff 命令;

% 表示未修改的当前文件的名称;试试这个::!echo %

  • 是 diff 命令的 STDIN 文件。

因此,该命令首先将所有[未保存]内容写入STDIN文件。然后diff命令读取当前文件(%)并将其与STDIN(-)文件进行比较。

这个命令大致等同于这个shell命令:diff <Vim’s STDOUT>

8,显示拼写错误

我们应该都使用过 Microsoft word,其拼写检查器在拼写错误的单词下会有一条红色的波浪线。

vim 也内置了拼写检查器,但默认情况下是关闭的。我们可以使用如下命令启用它:

:set spell 这样,你可能会看到拼写错误的单词被突出显示,其突出显示的方式取决于你的 vim 颜色方案。我在拼写错误的单词下面有一条白色下划线,如下图所示: 图片 要将这设置为 vim 的默认,可在 .vimrc 文件中添加如下配置:

set spell 9,显示行号 与许多 vim 用户一样,你可能喜欢在 vim 中显示行号。

有两种方法可以显示行号。一种是绝对行编号,在这种情况下,每行显示绝对行号,就像任何其他代码编辑器或IDE一样。

第二种是相对行号。在这种情况下,当前行的行号为0,其他行的行号为相比于光标所在行的相对数字。

这两种情况,也并不是只能选择一个,事实上,可以两种都要。

通过在 .vimrc 中添加以下行,可以在 vim 中启用“混合行编号”:

set number relativenumber 这将在光标所在行显示绝对行号,在其他行显示相对行号。如下图所示:

图片

当前光标位于第44行,因此该行显示绝对行号;其他行(光标上方和下方的行)显示相对行号。

10,使用 vim 打开文件的同时将光标定位在某一行

默认情况下,我们使用 vim 打开文件,光标总会在第一行。在某些时候,我们希望光标能够定位在我们指定的某一行,而不是第一行。

可以通过使用 +n(n为行号)选项来实现这一点,当然前提是你需要知道打开的文件总行数应大于或等于 n,如下:

vim +n 11,使用可读的配色方案 当谈到使用配色方案时,人们通常会选择他们觉得最吸引人或最美观的配色方案。但是,当你作为一个代码编辑器兼 IDE 的 vim 时,最好放弃一些引人注目的东西,转而使用具有更好视觉指导的配色方案。

一个好的配色方案看起来很好,但是一个优秀的配色可以帮助你在颜色的帮助下轻松识别关键词、变量和其他标识符。

当然,每个人的喜好是不同的,配色当然也是不同的。我们在下图中贴出几个大家都觉得顺眼的方案,可以作为参考:

图片

图片

图片

12,在插入模式下删除文本

我们都知道,在正常模式(normal mode)下,可以使用 d 和 x 键删除文本,那么在插入模式下如何执行相同的操作(比如 dd)呢?

以下是常用的一些方案: ctrl + w 删除前一个单词(字)(相当于正常模式下的 db);

ctrl + h 删除前一个字符;

ctrl + u 删除当前行所有前面的字符(相当于正常模式下的 d0 );

ctrl + k 删除当前行中所有主要字符(相当于正常模式下的 d$)。

Protothreads

主要特点:

  • 非常小的RAM开销-每个protothread只有两个字节,没有额外的堆栈
  • 高度可移植性-protothreads库是100%纯C,没有特定于体系结构的汇编代码
  • 可以与操作系统一起使用,也可以不使用操作系统
  • 提供阻塞等待,无需完全多线程或堆栈切换
  • 在类似BSD的开源许可证下免费提供

使用场景

  • 内存受限系统
  • 事件驱动协议栈
  • 小型嵌入式系统
  • 传感器网络节点
  • 便携式C应用程序

注意事项:

由于原线程不会在阻塞调用中保存堆栈上下文,因此当原线程阻塞时,不会保留局部变量。这意味着应该非常小心地使用局部变量——如果有疑问,不要在protothread中使用局部变量! 一个原线程是由对运行该原线程的函数的重复调用驱动的。每次调用函数时,原线程都会运行,直到它阻塞或退出。因此,原线程的调度由使用原线程的应用程序完成。

相关头文件

  1. lc-addrlabels.h 用GCC语法扩展实现的协程基础
  2. lc-switch.h 用switch语句实现的协程基础
  3. lc.h 该文件存在的意义仅仅为了选择以上两者之一
  4. pt.h 基于lc.h的协程设施的真正实现
  5. pt-sem.h 协程间通信(信号量)的实现

相关API:

  • void PT_INIT(struct pt *pt);//初始化一个protothread。
  • void PT_BEGIN(struct pt *pt);// C函数中声明协程的开始。
  • void PT_WAIT_UNTIL(struct pt *pt, condition);//阻塞并等待条件为真。
  • void PT_WAIT_WHILE(struct pt *pt, condition);//条件为真时,阻塞并等待。
  • void PT_WAIT_THREAD(struct pt *pt, thread);//阻塞并等待协程完成。
  • void PT_SPAWN(struct pt *pt, struct pt *child, thread);//生成一个协程并等待它退出。
  • void PT_RESTART(struct pt *pt);//重新启动协程。
  • void PT_EXIT(struct pt *pt);//退出协程序
  • void PT_END(struct pt *pt);//声明协程的结束。
  • int PT_SCHEDULE(protothread);//创建一个协程
  • void PT_YIELD(struct pt *pt);//当前原线程的产量。

Linux nohup用法

nohup不输出日志文件

只输出错误信息到日志文件

nohup ./program >/dev/null 2>log &

什么信息都不输出

nohup ./program >/dev/null 2>&1 &

Linux的重定向

  • 0:表示标准输入;
  • 1:标准输出,在一般使用时,默认的是标准输出;
  • 2:表示错误信息输出。

关于/dev/null

/dev/null属于字符特殊文件,它属于空设备,是一个特殊的设备文件,它会丢弃一切写入其中的数据, 写入它的内容都会永远丢失,而且没有任何可以读取的内容。它就像一个黑洞, 我们一般会把/dev/null当成一个垃圾站,不要的东西丢进去。比如来清除文件中的内容。

Springboot Sbscan Test

SBSCAN是一款专注于spring框架的渗透测试工具

可以对指定站点进行spring boot敏感信息扫描以及进行spring相关漏洞的扫描与验证。

  • 最全的敏感路径字典:最全的spring boot站点敏感路径字典,帮你全面检测站点是否存在敏感信息泄漏
  • 支持指纹检测:
    • 检测是否为spring站点:支持指纹识别,只有存在spring指纹的站点才进行下一步扫描,节约资源与时间
    • 敏感路径页面指纹检测:最大程度解决误报情况,达到同类型工具检出准确率最高,不用再人工确认是否为真的敏感页面而不是首页或者其他跳转的页面
  • 最全的spring漏洞检测POC: spring相关cve漏洞的检测poc全部给你集成到这款工具里,同类型最全
  • 无回显漏洞解决: 无回显漏洞检测光看响应状态码不太靠谱?支持–dnslog参数指定dnslog域名,看到dnslog记录才是真的成功验证漏洞存在
  • 其他一些常规支持:单个url扫描/ url文件扫描 / 支持指定代理 / 支持多线程

kotlin学习之ktor(2.3.6)-ApplicationCall

ApplicationCall 简介

当处理路由或直接拦截管道时,将获得ApplicationCall的上下文。 ApplicationCall提供对两个主要属性ApplicationRequest和ApplicationResponse的访问。对应于传入的请求和传出的响应。 除此之外,它还提供了一个应用程序环境和一些有用的功能来帮助响应客户端请求。鉴于管道可以异步执行,ApplicationCall还表示带有属性的逻辑执行上下文,以在管道的各个部分之间传递数据。 将拦截器安装到管道中是改变ApplicationCall处理的主要方法。几乎所有Ktor功能都是拦截器,在应用程序调用处理的不同阶段执行各种操作。

intercept(ApplicationCallPipeline.Call) { 
    if (call.request.uri == "/")
        call.respondText("Test String")
}

上述代码将拦截器安装到ApplicationCall处理的呼叫阶段,并在请求根页面时以纯文本响应。

这只是一个例子,通常,页面请求不会以这种方式处理,因为有一个路由机制可以做到这一点,还有更多。此外,如前所述,定义拦截器通常使用具有安装功能的功能完成。 ApplicationCall上可用的大多数函数(如上面的响应文本)都是暂停函数,表明它们可能会异步执行。

处理HTTP请求

在处理路由或直接拦截管道时,您可以使用ApplicationCall获得上下文。该调用包含一个名为request的属性,该属性包含有关请求的信息。 此外,调用本身具有一些有用的便利属性和方法,这些属性和方法依赖于请求。

介绍

当使用路由功能或拦截请求时,可以访问 call 内部的调用属性。该调用包括一个带有 request 相关信息的请求属性:

routing {
    get("/") {
        val uri = call.request.uri
        call.respondText("Request uri: $uri")
    } 
}

intercept(ApplicationCallPipeline.Call) { 
    if (call.request.uri == "/") {
        call.respondText("Test String")
    }
}

Request 信息

作为request的一部分,您可以访问其内部上下文:

URL, method, scheme, protocol, host, path, httpVersion, remoteHost, clientIp

val version: String = request.httpVersion // "HTTP/1.1"
val httpMethod: HttpMethod = request.httpMethod // GET, POST... 
val uri: String = request.uri // Short cut for `origin.uri`
val scheme: String = request.origin.scheme // "http" or "https"
val host: String? = request.host() // The host part without the port 
val port: Int = request.port() // Port of request
val path: String = request.path() // The uri without the query string
val document: String = request.document() // The last component after '/' of the uri
val remoteHost: String = request.origin.remoteHost // The IP address of the client doing the request

反向代理支持:源和本地(origin and local)

当在反向代理(例如nginx或负载均衡器)后面时,接收到的请求不是由最终用户执行的,而是由该反向代理执行的。 这意味着连接的客户端IP地址将是代理的IP地址,而不是客户端的IP地址。 此外,反向代理可能通过HTTPS提供服务,并通过HTTP向服务器请求。流行的反向代理发送X-Forwarded-头, 以便能够访问这些信息。

请注意,为了在反向代理下工作,您必须安装XForwardedHeaderSupport功能。

处理 GET / Query parameters

如果需要访问查询参数?param1=value&param2=value作为一个集合,您可以使用queryParameters。 它实现了StringValues接口,其中每个键都可以有一个与其关联的字符串列表。

val queryParameters: Parameters = request.queryParameters
val param1: String? = request.queryParameters["param1"] // To access a single parameter (first one if repeated)
val repeatedParam: List<String>? = request.queryParameters.getAll("repeatedParam") // Multiple values

您还可以访问原始queryString (param1=value&param2=value)

val queryString: String = request.queryString()

处理 POST PUT PATCH

所有的接收方法都会消耗客户端发送的全部有效负载,因此尝试两次接收请求正文将导致RequestAlreadyConsumedException错误, 除非您安装了DoubleReceive功能。install(DoubleReceive)

接收类型化对象、内容类型和JSON

该调用还支持接收通用对象:

val obj: T = call.receive<T>()
val obj: T? = call.receiveOrNull<T>()

为了从负载中接收自定义对象,您必须使用ContentNegotiation功能。例如,这对于在RESTAPI中接收和发送JSON有效载荷非常有用。

这里需要注意导入gson时要注意ktor版本大于2.0和之前的不同,这里是迁移注意事项

  1. 使用gson
implementation("io.ktor:ktor-server-content-negotiation:$ktor_version")
implementation("io.ktor:ktor-serialization-gson:$ktor_version")

import io.ktor.server.plugins.contentnegotiation.*
import io.ktor.serialization.gson.*
install(ContentNegotiation) {
    gson {
        setDateFormat(DateFormat.LONG)
        setPrettyPrinting()
    }
}
  1. 使用json
implementation("io.ktor:ktor-server-content-negotiation:$ktor_version")

import io.ktor.serialization.kotlinx.json.*
import io.ktor.server.plugins.contentnegotiation.*
install(ContentNegotiation) {
    json()
}

记一次pod install 错误解决方案

错误展示

执行完pod install 后的报错信息

[//]: # (pod install)

[//]: # (Analyzing dependencies)

[//]: # ()
[//]: # (――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――)

[//]: # ()
[//]: # (### Command)

[//]: # ()
[//]: # (```)

[//]: # (/opt/homebrew/Cellar/cocoapods/1.14.3/libexec/bin/pod install)

[//]: # (```)

[//]: # ()
[//]: # (### Report)

[//]: # ()
[//]: # (* What did you do?)

[//]: # ()
[//]: # (* What did you expect to happen?)

[//]: # ()
[//]: # (* What happened instead?)

[//]: # ()
[//]: # ()
[//]: # (### Stack)

[//]: # ()
[//]: # (```)

[//]: # (   CocoaPods : 1.14.3)

[//]: # (        Ruby : ruby 3.2.2 &#40;2023-03-30 revision e51014f9c0&#41; [arm64-darwin22])

[//]: # (    RubyGems : 3.4.10)

[//]: # (        Host : macOS 13.6 &#40;22G120&#41;)

[//]: # (       Xcode : 14.3.1 &#40;14E300c&#41;)

[//]: # (         Git : git version 2.39.2 &#40;Apple Git-143&#41;)

[//]: # (Ruby lib dir : /opt/homebrew/Cellar/ruby/3.2.2_1/lib)

[//]: # (Repositories : trunk - CDN - https://cdn.cocoapods.org/)

[//]: # (```)

[//]: # ()
[//]: # (### Plugins)

[//]: # ()
[//]: # (```)

[//]: # (cocoapods-deintegrate : 1.0.5)

[//]: # (cocoapods-plugins     : 1.0.0)

[//]: # (cocoapods-search      : 1.0.1)

[//]: # (cocoapods-trunk       : 1.6.0)

[//]: # (cocoapods-try         : 1.2.0)

[//]: # (```)

[//]: # ()
[//]: # (### Podfile)

[//]: # ()
[//]: # (```ruby)

[//]: # (target 'iosApp' do)

[//]: # (  use_frameworks!)

[//]: # (  platform :ios, '12.0')

[//]: # (  pod 'shared', :path => '../shared')

[//]: # (end)

[//]: # (```)

[//]: # ()
[//]: # (### Error)

[//]: # ()
[//]: # (```)

[//]: # (NoMethodError - undefined method `[]' for nil:NilClass)

[//]: # (/opt/homebrew/Cellar/cocoapods/1.14.3/libexec/gems/xcodeproj-1.23.0/lib/xcodeproj/project.rb:232:in `initialize_from_file')

[//]: # (/opt/homebrew/Cellar/cocoapods/1.14.3/libexec/gems/xcodeproj-1.23.0/lib/xcodeproj/project.rb:113:in `open')

[//]: # (/opt/homebrew/Cellar/cocoapods/1.14.3/libexec/gems/cocoapods-1.14.3/lib/cocoapods/installer/analyzer.rb:1194:in `block &#40;2 levels&#41; in inspect_targets_to_integrate')

[//]: # (/opt/homebrew/Cellar/cocoapods/1.14.3/libexec/gems/cocoapods-1.14.3/lib/cocoapods/installer/analyzer.rb:1193:in `each')

[//]: # (/opt/homebrew/Cellar/cocoapods/1.14.3/libexec/gems/cocoapods-1.14.3/lib/cocoapods/installer/analyzer.rb:1193:in `block in inspect_targets_to_integrate')

[//]: # (/opt/homebrew/Cellar/cocoapods/1.14.3/libexec/gems/cocoapods-1.14.3/lib/cocoapods/user_interface.rb:64:in `section')

[//]: # (/opt/homebrew/Cellar/cocoapods/1.14.3/libexec/gems/cocoapods-1.14.3/lib/cocoapods/installer/analyzer.rb:1188:in `inspect_targets_to_integrate')

[//]: # (/opt/homebrew/Cellar/cocoapods/1.14.3/libexec/gems/cocoapods-1.14.3/lib/cocoapods/installer/analyzer.rb:107:in `analyze')

[//]: # (/opt/homebrew/Cellar/cocoapods/1.14.3/libexec/gems/cocoapods-1.14.3/lib/cocoapods/installer.rb:422:in `analyze')

[//]: # (/opt/homebrew/Cellar/cocoapods/1.14.3/libexec/gems/cocoapods-1.14.3/lib/cocoapods/installer.rb:244:in `block in resolve_dependencies')

[//]: # (/opt/homebrew/Cellar/cocoapods/1.14.3/libexec/gems/cocoapods-1.14.3/lib/cocoapods/user_interface.rb:64:in `section')

[//]: # (/opt/homebrew/Cellar/cocoapods/1.14.3/libexec/gems/cocoapods-1.14.3/lib/cocoapods/installer.rb:243:in `resolve_dependencies')

[//]: # (/opt/homebrew/Cellar/cocoapods/1.14.3/libexec/gems/cocoapods-1.14.3/lib/cocoapods/installer.rb:162:in `install!')

[//]: # (/opt/homebrew/Cellar/cocoapods/1.14.3/libexec/gems/cocoapods-1.14.3/lib/cocoapods/command/install.rb:52:in `run')

[//]: # (/opt/homebrew/Cellar/cocoapods/1.14.3/libexec/gems/claide-1.1.0/lib/claide/command.rb:334:in `run')

[//]: # (/opt/homebrew/Cellar/cocoapods/1.14.3/libexec/gems/cocoapods-1.14.3/lib/cocoapods/command.rb:52:in `run')

[//]: # (/opt/homebrew/Cellar/cocoapods/1.14.3/libexec/gems/cocoapods-1.14.3/bin/pod:55:in `<top &#40;required&#41;>')

[//]: # (/opt/homebrew/Cellar/cocoapods/1.14.3/libexec/bin/pod:25:in `load')

[//]: # (/opt/homebrew/Cellar/cocoapods/1.14.3/libexec/bin/pod:25:in `<main>')

[//]: # (```)

[//]: # ()
[//]: # (――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――)

[//]: # ()
[//]: # ([!] Oh no, an error occurred.)

[//]: # ()
[//]: # (Search for existing GitHub issues similar to yours:)

[//]: # (https://github.com/CocoaPods/CocoaPods/search?q=undefined+method+%60%5B%5D%27+for+nil%3ANilClass&type=Issues)

[//]: # ()
[//]: # (If none exists, create a ticket, with the template displayed above, on:)

[//]: # (https://github.com/CocoaPods/CocoaPods/issues/new)

[//]: # ()
[//]: # (Be sure to first read the contributing guide for details on how to properly submit a ticket:)

[//]: # (https://github.com/CocoaPods/CocoaPods/blob/master/CONTRIBUTING.md)

[//]: # ()
[//]: # (Don't forget to anonymize any private data!)

[//]: # ()
[//]: # (Looking for related issues on cocoapods/cocoapods...)

[//]: # (- pod list throw NoMethodError - undefined method `version' for nil:NilClass)

[//]: # (  https://github.com/CocoaPods/CocoaPods/issues/11780 [open] [1 comment])

[//]: # (  10 May 2023)

[//]: # ()
[//]: # (- Searching for inspections failed: undefined method `map' for nil:NilClass)

[//]: # (  https://github.com/CocoaPods/CocoaPods/issues/11584 [open] [4 comments])

[//]: # (  14 Nov 2022)

[//]: # ()
[//]: # (- Intel cpu  undefined method `map' for nil:NilClass)

[//]: # (  https://github.com/CocoaPods/CocoaPods/issues/11366 [open] [3 comments])

[//]: # (  18 May 2022)

[//]: # ()
[//]: # (and 345 more at:)

[//]: # (https://github.com/cocoapods/cocoapods/search?q=undefined%20method%20%60%5B%5D%27%20for%20nil&type=Issues&utf8=✓)

[//]: # (tong@tongMacBook-Pro &#40;master&#41; [1] % pod update                                                                                                                                                      ~/work/code/weeder-app/iosApp)

[//]: # (Update all pods)

[//]: # (Updating local specs repositories)

[//]: # (Analyzing dependencies)

[//]: # ()
[//]: # (――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――)

[//]: # ()
[//]: # (### Command)

[//]: # ()
[//]: # (```)

[//]: # (/opt/homebrew/Cellar/cocoapods/1.14.3/libexec/bin/pod update)

[//]: # (```)

[//]: # ()
[//]: # (### Report)

[//]: # ()
[//]: # (* What did you do?)

[//]: # ()
[//]: # (* What did you expect to happen?)

[//]: # ()
[//]: # (* What happened instead?)

[//]: # ()
[//]: # ()
[//]: # (### Stack)

[//]: # ()
[//]: # (```)

[//]: # (   CocoaPods : 1.14.3)

[//]: # (        Ruby : ruby 3.2.2 &#40;2023-03-30 revision e51014f9c0&#41; [arm64-darwin22])

[//]: # (    RubyGems : 3.4.10)

[//]: # (        Host : macOS 13.6 &#40;22G120&#41;)

[//]: # (       Xcode : 14.3.1 &#40;14E300c&#41;)

[//]: # (         Git : git version 2.39.2 &#40;Apple Git-143&#41;)

[//]: # (Ruby lib dir : /opt/homebrew/Cellar/ruby/3.2.2_1/lib)

[//]: # (Repositories : trunk - CDN - https://cdn.cocoapods.org/)

[//]: # (```)

[//]: # ()
[//]: # (### Plugins)

[//]: # ()
[//]: # (```)

[//]: # (cocoapods-deintegrate : 1.0.5)

[//]: # (cocoapods-plugins     : 1.0.0)

[//]: # (cocoapods-search      : 1.0.1)

[//]: # (cocoapods-trunk       : 1.6.0)

[//]: # (cocoapods-try         : 1.2.0)

[//]: # (```)

[//]: # ()
[//]: # (### Podfile)

[//]: # ()
[//]: # (```ruby)

[//]: # (target 'iosApp' do)

[//]: # (  use_frameworks!)

[//]: # (  platform :ios, '12.0')

[//]: # (  pod 'shared', :path => '../shared')

[//]: # (end)

[//]: # (```)

[//]: # ()
[//]: # (### Error)

[//]: # ()
[//]: # (```)

[//]: # (NoMethodError - undefined method `[]' for nil:NilClass)

[//]: # (/opt/homebrew/Cellar/cocoapods/1.14.3/libexec/gems/xcodeproj-1.23.0/lib/xcodeproj/project.rb:232:in `initialize_from_file')

[//]: # (/opt/homebrew/Cellar/cocoapods/1.14.3/libexec/gems/xcodeproj-1.23.0/lib/xcodeproj/project.rb:113:in `open')

[//]: # (/opt/homebrew/Cellar/cocoapods/1.14.3/libexec/gems/cocoapods-1.14.3/lib/cocoapods/installer/analyzer.rb:1194:in `block &#40;2 levels&#41; in inspect_targets_to_integrate')

[//]: # (/opt/homebrew/Cellar/cocoapods/1.14.3/libexec/gems/cocoapods-1.14.3/lib/cocoapods/installer/analyzer.rb:1193:in `each')

[//]: # (/opt/homebrew/Cellar/cocoapods/1.14.3/libexec/gems/cocoapods-1.14.3/lib/cocoapods/installer/analyzer.rb:1193:in `block in inspect_targets_to_integrate')

[//]: # (/opt/homebrew/Cellar/cocoapods/1.14.3/libexec/gems/cocoapods-1.14.3/lib/cocoapods/user_interface.rb:64:in `section')

[//]: # (/opt/homebrew/Cellar/cocoapods/1.14.3/libexec/gems/cocoapods-1.14.3/lib/cocoapods/installer/analyzer.rb:1188:in `inspect_targets_to_integrate')

[//]: # (/opt/homebrew/Cellar/cocoapods/1.14.3/libexec/gems/cocoapods-1.14.3/lib/cocoapods/installer/analyzer.rb:107:in `analyze')

[//]: # (/opt/homebrew/Cellar/cocoapods/1.14.3/libexec/gems/cocoapods-1.14.3/lib/cocoapods/installer.rb:422:in `analyze')

[//]: # (/opt/homebrew/Cellar/cocoapods/1.14.3/libexec/gems/cocoapods-1.14.3/lib/cocoapods/installer.rb:244:in `block in resolve_dependencies')

[//]: # (/opt/homebrew/Cellar/cocoapods/1.14.3/libexec/gems/cocoapods-1.14.3/lib/cocoapods/user_interface.rb:64:in `section')

[//]: # (/opt/homebrew/Cellar/cocoapods/1.14.3/libexec/gems/cocoapods-1.14.3/lib/cocoapods/installer.rb:243:in `resolve_dependencies')

[//]: # (/opt/homebrew/Cellar/cocoapods/1.14.3/libexec/gems/cocoapods-1.14.3/lib/cocoapods/installer.rb:162:in `install!')

[//]: # (/opt/homebrew/Cellar/cocoapods/1.14.3/libexec/gems/cocoapods-1.14.3/lib/cocoapods/command/update.rb:63:in `run')

[//]: # (/opt/homebrew/Cellar/cocoapods/1.14.3/libexec/gems/claide-1.1.0/lib/claide/command.rb:334:in `run')

[//]: # (/opt/homebrew/Cellar/cocoapods/1.14.3/libexec/gems/cocoapods-1.14.3/lib/cocoapods/command.rb:52:in `run')

[//]: # (/opt/homebrew/Cellar/cocoapods/1.14.3/libexec/gems/cocoapods-1.14.3/bin/pod:55:in `<top &#40;required&#41;>')

[//]: # (/opt/homebrew/Cellar/cocoapods/1.14.3/libexec/bin/pod:25:in `load')

[//]: # (/opt/homebrew/Cellar/cocoapods/1.14.3/libexec/bin/pod:25:in `<main>')

[//]: # (```)

[//]: # ()
[//]: # (――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――)

[//]: # ()
[//]: # ([!] Oh no, an error occurred.)

[//]: # ()
[//]: # (Search for existing GitHub issues similar to yours:)

[//]: # (https://github.com/CocoaPods/CocoaPods/search?q=undefined+method+%60%5B%5D%27+for+nil%3ANilClass&type=Issues)

[//]: # ()
[//]: # (If none exists, create a ticket, with the template displayed above, on:)

[//]: # (https://github.com/CocoaPods/CocoaPods/issues/new)

[//]: # ()
[//]: # (Be sure to first read the contributing guide for details on how to properly submit a ticket:)

[//]: # (https://github.com/CocoaPods/CocoaPods/blob/master/CONTRIBUTING.md)

[//]: # ()
[//]: # (Don't forget to anonymize any private data!)

[//]: # ()
[//]: # (Looking for related issues on cocoapods/cocoapods...)

[//]: # (- pod list throw NoMethodError - undefined method `version' for nil:NilClass)

[//]: # (  https://github.com/CocoaPods/CocoaPods/issues/11780 [open] [1 comment])

[//]: # (  10 May 2023)

[//]: # ()
[//]: # (- Searching for inspections failed: undefined method `map' for nil:NilClass)

[//]: # (  https://github.com/CocoaPods/CocoaPods/issues/11584 [open] [4 comments])

[//]: # (  14 Nov 2022)

[//]: # ()
[//]: # (- Intel cpu  undefined method `map' for nil:NilClass)

[//]: # (  https://github.com/CocoaPods/CocoaPods/issues/11366 [open] [3 comments])

[//]: # (  18 May 2022)

[//]: # ()
[//]: # (and 345 more at:)

[//]: # (https://github.com/cocoapods/cocoapods/search?q=undefined%20method%20%60%5B%5D%27%20for%20nil&type=Issues&utf8=✓)

最终解决方法

前几天修改了下面两个文件,把这两个文件修改回来就可以正常了,具体原因不清楚

iosApp/iosApp.xcodeproj/xcshareddata/xcschemes/iosApp.xcscheme iosApp/iosApp.xcodeproj/project.pbxproj

Nginx部署前后端项目配置

server {
  listen  8000;
  server_name localhost;
  
  # ssl配置
  ssl on;
  ssl_certificate     /opt/ssl/xxxx.pem;
  ssl_certificate_key /opt/ssl/xxxx.key;
  ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
  ssl_ciphers "ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-SHA384:DHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA256";
  ssl_prefer_server_ciphers on;
  
  location / {
    root /opt/html;
    index index.html index.htm;
    try_files $uri $uri/ @router;
  }
  
  location @router {
    rewrite ^.*$ /index.html last;
  }
  
  location /api {	
    proxy_pass http://127.0.0.1:8085;
    proxy_connect_timeout	3;
    proxy_send_timeout		30;
    proxy_read_timeout		30;			
    proxy_set_header Host $proxy_host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Forwarded-Server $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
    client_max_body_size	100m;		
	}
}

wget https://daxingfire.htcxcloud.com/ –user-agent=“Mozilla/5.0 (X11;U;Linux i686;en-US;rv:1.9.0.3) Geco/2008092416 Firefox/3.0.3” –no-check-certificate

Linux_lvm挂在磁盘

  • 磁盘格式化(创建分区)
  • 转换类型为 LinuxLVM
  • 创建物理卷
  • 扩展卷组
  • 扩展逻辑卷
  • 查看磁盘卷组信息
  • 调整文件系统大小
  • 创建卷组

fdisk -l

fdisk /dev/vdb

操作:n(添加新分区)→→p(打印分区表)→→1(选择分区号1)→→回车(起始扇区默认最小)→→回车(终止扇区默认最大)→→t(更改分区类型)→→8e(分区“Linux”的类型更改为“Linux LVM”)→→p(打印分区表)→→w(将分区表写入磁盘并退出)

Kylin Server 10 SP2 安装MySql

系统基于什么版本开发

麒麟系统KylinV10SP系列内核版本与主流的redhat/centos内核版本有以下映射关系:

  • 麒麟系统KylinV10SP1的内核版本对应的是Red Hat Enterprise Linux 7.6的内核版本。
  • 麒麟系统KylinV10SP2的内核版本对应的是Red Hat Enterprise Linux 7.7的内核版本。
  • 麒麟系统KylinV10SP3的内核版本对应的是Red Hat Enterprise Linux 7.8的内核版本。

需要注意的是,虽然麒麟系统是基于Red Hat Enterprise Linux开发的,但是麒麟系统并不是纯粹的Red Hat Enterprise Linux,因此在使用过程中可能会存在一些差异。此外,国产操作系统和麒麟操作系统在保险行业中的应用也需要根据具体的业务场景和需求进行评估和选择。

下载MySql安装包,使用red hat

安装顺序

rpm -ivh mysql-community-common-8.0.35-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-plugins-8.0.35-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-8.0.35-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-compat-8.0.35-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-8.0.35-1.el7.x86_64.rpm
rpm -ivh mysql-community-icu-data-files-8.0.35-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-8.0.35-1.el7.x86_64.rpm

启动mysql

service mysqld start

查看默认数据库密码

cat /var/log/mysqld.log | grep password

RPM 包的安装

rpm -ivh 包全名

此命令中各选项参数的含义为:

  • -i:安装(install);
  • -v:显示更详细的信息(verbose);
  • -h:打印 #,显示安装进度(hash);

RPM包的升级

rpm -Uvh 包全名

linux解压tar文件的命令

tar tar -xvf xxx.tag -C 指定目录

tar.gz tar -zxvf xxx.tar.gz -C 指定目录 tar.bz2 tar -jxvf xxxx.tar.bz2 -C 指定目录

Docker使用 Mysql5.6

操作失败

x-S+*dri0+ZhcT6

拉去镜像

docker pull mysql:5.6

启动操作

docker run --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD="设置你的mysql的密码"-d mysql:5.6

解析:

--name   给容器取名字为mysql
-p   端口1:端口2     端口1是对外暴露的端口(即宿主机的端口),端口2 使我们的mysql端口
-e MYSQL_ROOT_PASSWORD=密码   即root用户的密码
-d mysql:5.6     代表后台运行我们的mysql
docker run  --privileged=true --name mysql -p 3306:3306 -v /mysql/data:/var/lib/mysql -v /mydata/mysql/conf:/etc/mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.6