aruba ac
关于 SSH Aruba AC 提示 port 22:2: Too many authentication failures
添加选项 IdentitiesOnly=yes
1 | ssh -o IdentitiesOnly=yes xxx |
It works!
关于 SSH Aruba AC 提示 port 22:2: Too many authentication failures
添加选项 IdentitiesOnly=yes
1 | ssh -o IdentitiesOnly=yes xxx |
It works!
被 JavaScript 的 Promise 折磨了两三天后,终于有所收获,故此记录
实现在 Selenium WebDriver 中,封装一个实用函数,同时 wait until located & visible 并返回 the fisrt visible element,并保持 thenable,极大兼容性了
1 | driver.find = function (locator, timeout = 30000) { |
JavaScript 的 async, promise, await 快赶上 C 的指针了,真的头大
https://github.com/SeleniumHQ/selenium/blob/944aad294d14a13345ebaf0e64df3aa68218521f/javascript/node/selenium-webdriver/lib/webdriver.js#L2402 ↩︎
https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise/any ↩︎
https://github.com/SeleniumHQ/selenium/blob/944aad294d14a13345ebaf0e64df3aa68218521f/javascript/node/selenium-webdriver/lib/promise.js ↩︎
个人一直以来用的 Inconsolata 版本是一个好多年前的祖传版本,中间经过许多人个性定制,单双引号也早就变成了竖直的,后续又手动补充了 Powerline 系列字符,base 的版本已经不可考
https://fonts.google.com/specimen/Inconsolata
https://github.com/googlefonts/inconsolata
目前已经更新到 3.000,已经内置了更多的字符,包括 Braille Patterns(盲文), Geometric Shapes, Box Drawing, Block Elements 等,可以让你的 tui 更加炫酷,如 btop++ 等的进度条和统计图的显示
但似乎迟迟不添加 Powerline,也是迷惑
新版本还添加了对 ligatures 的支持,可以理解为连字,比如 >= 变成占一个字符的真正的大于等于号,=>, === 等也有变形,这个版本的字体叫 Ligconsolata
https://leonardo-m.livejournal.com/77079.html
早期的对官方 Inconsolata 的著名修改版,因为官方版长期不更新。主要修改包括,把单双引号变直;把点和逗号变得更明显;把加斜杠的 0 变成加点的 0;把 ^ 变得更宽等
但也很久没有更新了,没有现在这些乱七八糟字体的支持,也没有 Powerline
Powerline 是啥不用多说,官方放出了许多 patched 好的各种字体,其中也包括 Inconsolata, Inconsolata-g, InconsolataDz, 都命名为Inconsolata xxx for Powerline
优点自然是支持 Powerline 字符了,左右小三角啦,branch 图标啦
缺点就是官方 patched 基于的 Inconsolata 字体也是比较老的,不会随 googlefonts 的更新,自然也没有后续字符的加入
https://github.com/powerline/fontpatcher
Powerline 的项目中也带了一个 fontpatcher,基于 FontForge。但装起来麻烦,个人推荐另一款,可以 docker
Nerd Fonts
https://github.com/ryanoasis/nerd-fonts#font-patcher
提供docker pull nerdfonts/patcher
免去安装 FontForge 的麻烦
通过docker run --rm -v ~/myfont/patchme:/in -v ~/myfont/patched:/out nerdfonts/patcher
执行
常用参数有
1 | --mono: 代码用字体,mono 少不了 |
是目前用得最爽的一款 fontpatcher,让 Inconsolata 焕发新生!
一个程序员 = 一把键盘: HHKB + 一款字体: Inconsolata + 一套配色: Molokia
1 | curl 'wttr.in?format=3' |
macOS 上使用 iTerm2,字体安装的话很方便,可以brew install font-inconsolata
,其中的 inconsolata 是随 googlefonts 比较新的,inconsolata-for-powerline 等是上面提到的其它 repo 的比较旧的。
iTerm2 的 Powerline 支持可以直接,Preference > Profiles > Text,勾上 Use built-in Powerline glyphs,省去自己打 Inconsolata 补丁的麻烦。
macOS 还是适合程序员啊!
Windows 上就比较麻烦,需要先给 Inconsolata 打补丁以支持 Powerline 字符。nerdfonts 打出来的字体没有被标记为 fixed-width,所以默认不会被 SecureCRT 承认,需要修改 Global.ini,位置详见 SecureCRT 的 Global Options > Configuration Paths,修改 Allow Proportional Fonts 那行的值为 00000001,重新打开 SecureCRT 即可
关于Linux上DST,饥荒,Don’t Starve Together MOD打不上,不下载的问题
因为dedicated_server_mods_setup.lua内容会被重置
如果使用的的是别人写的run_dedicated_servers.sh
其中
1 | ./steamcmd.sh +force_install_dir "$install_dir" +login anonymous +app_update 343050 validate +quit |
在validate之后会重置dedicated_server_mods_setup.lua的内容,所以dst读不到
所以可以在steam更新及验证之后,dontstarve_dedicated_server_nullrenderer_x64启动之前,加上一句
1 | #备份一下你的dedicated_server_mods_setup.lua |
网上的水的论文不少,实际项目没看到,于是搞了一下,希望能有所参考
yum源里也有rpm,但release版隐藏我们需要的一个功能开关,这里我们自己编译
https://github.com/OpenPegasus/OpenPegasus
采用了rpmbuild方式,同时做了一些修改
准备好tar.gz和相关重命名,然后编译rpmbuild -bb tog-pegasus.spec
,rpm在rpmbuild/RPMS下,然后使用yum localinstall xxx
安装
/etc/Pegasus/access.conf,wbemNetwork中去掉了root,禁止root账号远程登录
yum完跑以下命令
1 | /usr/share/Pegasus/scripts/genOpenPegasusSSLCerts // 生成证书 |
由于开启了repositoryIsDefaultInstanceProvider,使得我们可以不用编写Provider,而对Class具有Create / Get / Enumerate操作
相关说明和更多配置见项目的doc/BuildAndReleaseOptions.html
instance以xxx.idx和xxx.instances文件的方法在于在[namespace]/instances/下
添加时只需cimmof -n[namespace] -aEV xxx.mof
提示没有相关qualifiers就去其它namespace下copy一堆来
给想进一步写Provider的一些tips
所以要注意注册provider时的cimmof -n参数
REF http://cvs.opengroup.org/pegasus-doc/CIMProvider.html
virtual void initialize(CIMOMHandle & cimom) = 0
Performs any setup required before normal operation of the provider.
The initialize() function allows the provider to conduct the necessary preparations to handle requests. The initialize function is called only once during the lifetime of the provider. Note, however, that with the Pegasus automatic unload function enabled, a provider many be unloaded and loaded many times during one cycle of the CIMOM. This function must complete before the CIM server invokes any other function of the provider, other than terminate.
virtual void terminate(void) = 0
Performs any cleanup required before termination.
The terminate function allows the provider to conduct the necessary preparations for termination. This function may be called by the CIM Server at any time, including initialization. Once invoked, no other provider functions are invoked until after a call to initialize.
如果你create出来的东西没有存在什么地方,provider.so是会被随时unload再load的,所以_instances中的实例不是持久的
可以参考在项目在SDK/samples/Providers/DefaultC++/InstanceProvider中给出的例子
因为initialize方法总是会在其它方法调用前执行
Linux下
1 | wmic -U [user]%[pass] //[IP] "select Name,PNPDeviceID from Win32_VideoController" |
通过wmic采集Win32_VideoController的PNPDeviceID
我们关注VEN_10DE&DEV_21C4&SUBSYS_13D310B0
这部分
参考: https://devicehunt.com/view/type/pci/vendor/10DE
参考: https://pcisig.com/membership/member-companies?combine=10B0
GPU-Z的Subvendor查询也是依赖于此
顺便也把PCI-SIG上的数据抓了一份,方便大家使用
开一个Linux监控Windows系列的大坑
先从不同版本的winexe搞起
这里选择的代码是 https://github.com/greenbone/openvas-smb
原因是最近还有在更新
1 | [/root/test/openvas-smb-21.4.0/winexe/winexe.c:90:parse_args()] winexe version 0.80 |
分别记录一下Fedora和CentOS7两种系统下的编译过程
搞了两套是因为
先说一下共有问题
dnf/yum出来的heimdal-devel不支持pkgconfig,后续许多操作都很麻烦,建议按下面的方法自己先compile一个
https://community.greenbone.net/t/full-gvm-11-build-guide-for-centos-8/5425
1 | ./configure --enable-otp=no --prefix=/opt/heimdal |
ld问题参考 https://www.hbspy.moe/2021/06/07/ld_cannot_find/
1 | ln -s /usr/lib64/libtspi.so.1 /usr/lib64/libtspi.so |
mingw can no longer be found in the Centos 7 EPEL Repository See bugzilla.redhat.com/show_bug.cgi?id=1807975 and pagure.io/fesco/issue/2333
1 | yum install gcc cmake pkg-config mingw64-gcc gnutls-devel \ |
https://wiki.videolan.org/Win32Compile_Under_Fedora/
CentOS7多一个popt的问题,类似heimdal,也是yum出来的包不支持pkgconfig
参照heimdal的处理自己先compile一个
1 | ./autogen.sh |
主要需要搞定mingw的问题
这里分享一个可用的repo: https://copr.fedorainfracloud.org/coprs/alonid/mingw-epel7/
使用的时候需要只enable它,yum install --disablerepo=* --enablerepo=mingw-epel7 xxx
smb1protocol
顺便分享一些远程安装启用的命令
是在Windows下使用的
首先利用SysinternalsSuite包中提供的PsExec拉Dism,用WMIC process call create
应该也行
NOTE 这里加了/NoRestart,主要是由于Dism提供的重启不够强力,可能造成卡住
后面用WMIC shutdown -r -f
强制重启
1 | .\PsExec.exe \\[IP] -u [user] -p [passwd] Dism /online /Enable-Feature /FeatureName:smb1protocol /NoRestart /ALL |
可以查看目前网络配置文件是公用还是专用。如果是公用,进一步查看是否开启了公用网络的防火墙
可以考虑直接切换到专用,关闭或配置专用网络的防火墙规则
这是一个32-bit/64-bit问题
winexe新一点的版本会有[–ostype=0|1|2]选项,来指定x86/x64
可以通过echo %programfiles%看判断
1 | C:\Windows\system32>echo %programfiles% |
这里%programfiles%会被认为是 (x86)
没有nvidia-smi.exe
我们可以直接拉"c:\windows\sysnative\cmd.exe"
1 | C:\Windows\system32>echo %programfiles% |
这样就正常了
/usr/bin/ld: cannot find -l
collect2: error: ld returned 1 exit status
1 | ld -l<xxx> --verbose |
如
/usr/bin/ld: cannot find -lhdb
则
1 | ld -lhdb --verbose |
可以看到ld在尝试从哪些地方寻找所需的文件
然后就方面通过文件名判断该安装什么包或者做软连接
1 | locate libhdb |
参考代码:https://github.com/HBSpy/music163
1 | ffmpeg -i input.flac -acodec alac -vn output.m4a |
从云音乐获取的FLAC有时封面会有问题
1 | [mjpeg @ 0x227f2c0] bits 223 is invalid |
这里使用-vn去掉封面图片,后续再通过其它方式添加
云音乐的FLAC备注中有163 key(Don’t modify):xxx,可以解密得出JSON
从albumPic字段获取封面图片地址
到目前为止,直接使用ffmpeg封入封面,iTunes还是不能识别的
有给视频添加Cover的方式
1 | ffmpeg -i input.m4a -i image.jpg -map 0 -map 1 -c copy -disposition:v:1 attached_pic output.m4a |
但iTunes是识别不了的
目前使用AtomicParsley封入封面,https://github.com/wez/atomicparsley
1 | ./AtomicParsley output.m4a --artwork cover.jpg |
–overWrite 参数有些编译版本似乎没有,手动重命名吧