小编Det*_*rer的帖子

两个python脚本之间的通信

方法论问题:

我有一个"主"python脚本在我的系统上运行无限循环,我想偶尔发送信息(例如json数据字符串),其他一些python脚本将由我自己或其他程序稍后启动并将在发送字符串后结束.

我不能在这里使用子进程,因为我的主脚本不知道对方何时运行以及它们将执行什么代码.

我正在考虑让主脚本侦听本地端口,并让其他脚本在该端口上发送字符串,但是有更好的方法吗?

python inter-process-communicat

10
推荐指数
3
解决办法
2万
查看次数

Vim langmap打破插件(bépo)

我正在使用bépo键映射(http://bepo.fr)并寻求完美的vim映射.

到目前为止,我使用了很长的noremap列表,但是对于许多绑定(例如,运动awCtrl+ r),第一次击键很好地重新映射而不是其他的,我认为这是预期的行为,但这不是我需要的.

理想情况下,map除了键入文本(在插入模式下和键入替换例程)时,我的键盘将在更高级别(命令之前)完全重新映射.我正在寻找的似乎是langmap,但我使用它有问题.

我将这个langmap添加到我的.vimrc中,看起来很完美,但它破坏了我的一些插件.SuperTab现在插入<Plug>SuperTabForwardTab在插入模式下按下,我t<SNR>24_SelectCompletion(1)按下回车键时.

有人知道如何解决这个langmap问题或更好地重新映射我的键盘吗?

vim keymapping supertab

6
推荐指数
1
解决办法
915
查看次数

除非详细,否则使用ssh remote的git push会失败

我有一个带有远程的git(版本2.1.2)存储库ssh:

$ git remote -v
origin  ssh://dettorer@dettorer.net:/home/dettorer/my_project (fetch)
origin  ssh://dettorer@dettorer.net:/home/dettorer/my_project (push)
Run Code Online (Sandbox Code Playgroud)

哪个没能推:

$ git push
Bad port ''
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Run Code Online (Sandbox Code Playgroud)

除非......我使用--verbose开关:

$ git push --verbose
Pushing to ssh://dettorer@dettorer.net:/home/dettorer/my_project
Enter passphrase for key '/home/dettorer/.ssh/id_rsa': 
Counting objects: 7, done.
...
To ssh://dettorer@dettorer.net:/home/dettorer/my_project
   e633fe9..5d2e9de  master -> master
updating local tracking ref 'refs/remotes/origin/master'
Run Code Online (Sandbox Code Playgroud)

在该答案中ssh提示增加了日志级别,但(没有)的输出完全相同.git …

git ssh

6
推荐指数
1
解决办法
2394
查看次数

Makefile 中的复杂模式规则

我有以下 makefile 用于从某些模板生成文件,生成的文件有两种可能的扩展名:

%.tex: %.tex*_tpl
    ./generate $@_tpl -o $@

%.xml: %.xml*_tpl
    ./generate $@_tpl -o $@
Run Code Online (Sandbox Code Playgroud)

依赖列表将在这里匹配类似的东西 a.tex_tpl, a.tex-subpart1_tpl, 之类的内容a.tex-subpart2_tpl

虽然这有效,但有没有办法避免重复?例如通过匹配*.{tex,xml}规则名称并在依赖项列表中使用整个匹配的名称?看起来像这样的东西:

%.{tex,xml}: $@_tpl
    ./generate $< -o $@
Run Code Online (Sandbox Code Playgroud)

(虽然我知道 %.{tex,xml}这不是一个有效的规则名称,您不能$@在依赖项列表中使用)

或任何其他(更清洁?)方式。

makefile

4
推荐指数
1
解决办法
1048
查看次数