2022年4月

安装一个完整的 Ruby 开发环境:

sudo apt-get install ruby-full build-essential zlib1g-dev
echo '# Install Ruby Gems to ~/gems' >> ~/.bashrc
echo 'export GEM_HOME="$HOME/gems"' >> ~/.bashrc
echo 'export PATH="$HOME/gems/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

安装 jekyll

gem install jekyll bundler

创建项目示例:

jekyll new myblog
cd myblog
bundle exec jekyll serve

好了,打开浏览器,浏览网址:http://localhost:4000 看看吧

如果下载了项目,到项目下,修改配置文件 _config.yml
主要是 baseurl 及 url 前者表示项目路径,留空为根路径;后者是web服务侦听的协议、地址及端口
修改完后,下载依赖项:

bundle install

生成静态内容:

bundle exec jekyll build

后台运行服务:

bundle exec jekyll serve --detach

在使用正则前,需要启用系统高级选项的OLE自动化功能,启用过程如下:

exec sp_configure 'show advanced options',1
reconfigure
exec sp_configure 'Ole Automation Procedures',1
reconfigure

安全起见,使用完后记得关闭该高级功能:

exec sp_configure 'Ole Automation Procedures',0
reconfigure
exec sp_configure 'show advanced options',0
reconfigure

搜索 Function:

ALTER FUNCTION [dbo].[RegexMatch]
(
    @matchstring VARCHAR(4000),
    @pattern VARCHAR(200)
)
RETURNS BIT
AS BEGIN
    DECLARE @handle int, @result bit
    exec sp_oacreate 'vbscript.regexp', @handle output
    exec sp_oasetproperty @handle, 'pattern',@pattern
    exec sp_oasetproperty @handle, 'global', 'true'
    exec sp_oasetproperty @handle, 'ignorecase', 0
    exec sp_oamethod @handle, 'test', @result output,@matchstring
    exec sp_oadestroy @handle
    return @result
END

使用:

select dbo.RegexMatch(N'abc12345',N'\d{5}')

替换Function

CREATE FUNCTION [dbo].[RegReplace]
(
    @matchstring VARCHAR(4000),
    @pattern VARCHAR(200),
    @replace VARCHAR(200)
)
RETURNS VARCHAR(4000)
AS BEGIN
    DECLARE @handle int, @result VARCHAR(4000)
    exec sp_oacreate 'vbscript.regexp', @handle output
    exec sp_oasetproperty @handle, 'pattern',@pattern
    exec sp_oasetproperty @handle, 'global', 1 --全局替换
    exec sp_oasetproperty @handle, 'ignorecase', 1 --忽略大小写
    exec sp_oamethod @handle, 'Replace', @result output,@matchstring,@replace
    exec sp_oadestroy @handle
    return @result
END

使用:

select dbo.RegReplace('hello 123','\d{2}','world')

IOS版本,之前我们的APP没问题,最近IOS升级后,手机直接运行项目在某一个页面总是闪退。
错误信息是
NSInternalInconsistencyException reason: 'Corrupted standard message'
翻各种资料,各种 google 搜索没有找到答案
最后想了一下,那个页面就是多了一个保持屏幕不息屏的功能,于是升级 wakelock 包到最新版本,解决问题:

  wakelock: ^0.6.1+2

记录一下。

Net core 6.0 中,要开启 GcServer 模式,需要通过环境变量的方式。

Windows 系统

直接增加环境变量(用户或系统自己看着办)

DOTNET_gcServer=1

在 Linux 中

如果是直接运行的程序,直接 export DOTNET_gcServer=1 就行
要永久生效,可以将这句加入到 ~/.bashrc (当前用户) 和 /etc/profile (全局) 中。

如果是 service 方式运行的话,上面的方式就不生效了,就需要这样做:

systemctl edit <service>

写入以下内容:

[Service]
Environment="DOTNET_gcServer=1"

wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
dpkg -i google-chrome-stable_current_amd64.deb

如果是 root 启动,会无法运行。要修改配置:

vim /opt/google/chrome/google-chrome

找到 exec -a "$0" "$HERE/chrome" "$@" 这一行,在后面增加: --user-data-dir --no-sandbox

在 Kali Linux 安装 Google Chrome 最容易的方法就是使用 gdebi ,它会自动帮你下载所有的依赖包。

sudo apt-get update
sudo apt-get install gdebi
gdebi google-chrome-stable_current_amd64.deb