小编J S*_*pen的帖子

使用 Azure Batch 中的托管标识在批处理池中使用 Python 对 Key Vault 进行身份验证

我正在尝试使用系统分配的 Azure 批处理托管标识来访问 Azure Key Vault。我在网上找到了一些代码,但我不知道这是否可能,或者证书路线是唯一的可能性。我已为批处理帐户启用托管标识并将其添加到密钥库。但是当我尝试从批处理池中的 python sdk 获取托管标识时,它失败了,我无法连接到密钥保管库。

我尝试过旧azure-keyvault包(1.1.0 版)和新的 4.0 版。

这是使用较旧的密钥保管库包,它给出了一个HTTPRequest错误:

from azure.keyvault import KeyVaultClient
from msrestazure.azure_active_directory import MSIAuthentication

credentials = MSIAuthentication(resource='https://vault.azure.net')

kvclient = KeyVaultClient(credentials)
res = kvclient.get_secret("https://kv.vault.azure.net/", "secret", "").value
Run Code Online (Sandbox Code Playgroud)

对于较新的 azure keyvault 包,我使用了这个:

import os
import cmd
from azure.keyvault.secrets import SecretClient
from azure.identity import ManagedIdentityCredential

keyVaultName = "kv"
KVUri = f"https://{keyVaultName}.vault.azure.net"

credential = DefaultAzureCredential()
client = SecretClient(vault_url=KVUri, credential=credential)

secretName = "secret"
retrieved_secret = client.get_secret(secretName)
Run Code Online (Sandbox Code Playgroud)

但它找不到ManagedIdentityCredential. 这是错误的一部分:

SharedTokenCacheCredential.get_token failed: Shared token …
Run Code Online (Sandbox Code Playgroud)

python azure-active-directory azure-keyvault azure-batch azure-managed-identity

3
推荐指数
1
解决办法
997
查看次数

在Ubuntu中编译Python 2.6.6并需要外部包wxPython,setuptools等

我使用google-perf工具(tcmalloc)库编译了Python 2.6.6,以消除我使用默认2.6.5时遇到的一些内存问题.在获得2.6.6之后它似乎无法工作,因为我认为在Ubuntu中存在默认2.6.5安装问题.从wxPython和setuptools这样的软件通道安装的二进制文件是否都不能正常使用2.6.6.这些需要重新编译吗?任何其他建议,以使其顺利运作.我可以在不更改路径的情况下将2.6.5设置为默认值吗?该路径首先在usr/local/bin中查找.

python rpath ld ipython tcmalloc

2
推荐指数
1
解决办法
1636
查看次数

使用emacsclient运行cron作业,但如果当前没有服务器打开运行emacs --batch模式

由于emacs互锁文件,我想通过cron运行org-mobile命令但是使用emacsclient:

emacsclient -nw --eval "(org-mobile-pull)" --eval "(org-mobile-push)"
Run Code Online (Sandbox Code Playgroud)

但是如果没有运行emacs服务器,我希望命令能够使用emacs批处理模式运行:

emacs --batch --eval "(org-mobile-pull)" --eval "(org-mobile-push)"
Run Code Online (Sandbox Code Playgroud)

如果有人有任何想法,我不知道怎么这么好奇.

emacs bash crontab org-mode emacs24

2
推荐指数
1
解决办法
684
查看次数

使用ido完成方法更改emacs商店中的recentf文件数

我正在使用此页面上列出的ido方法:http://www.emacswiki.org/emacs/RecentFiles .我希望能够选择它存储的最近文件的数量.它似乎不存储很多.是否有这样的设置或简单的方法.下面列出的功能供参考.干杯

    (defun recentf-interactive-complete ()
  "find a file in the recently open file using ido for completion"
  (interactive)
  (let* ((all-files recentf-list)
     (file-assoc-list (mapcar (lambda (x) (cons (file-name-nondirectory x) x)) all-files))
     (filename-list (remove-duplicates (mapcar 'car file-assoc-list) :test 'string=))
     (ido-make-buffer-list-hook
      (lambda ()
        (setq ido-temp-list filename-list)))
     (filename (ido-read-buffer "Find Recent File: "))
     (result-list (delq nil (mapcar (lambda (x) (if (string= (car x) filename) (cdr x))) file-assoc-list)))
     (result-length (length result-list)))
    (find-file 
     (cond 
      ((= result-length 0) filename)
      ((= result-length 1) (car result-list))
      ( …
Run Code Online (Sandbox Code Playgroud)

emacs elisp recent-file-list

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

更改自定义设置面以在certian emacs模式下显示这些设置(文本模式,LaTeX模式等)

我有一个自定义设置面,我曾在emacs启动文件中使用,特别是当我启动乳胶文件但我正在合并和更新我的.emacs文件,所以我没有启动单独启动乳胶文件的特写过程.我想设置它,以便仅在乳胶模式打开时设置此自定义面.因为它是一个自定义的面孔我不认为设置一个LaTeX模式钩子是明智的,但我知道应该有一种方法来做到这一点.我只是在输入时才更改字体和文本大小.如果可能的话,我也希望这能用于文本模式.附上下面的自定义面.

(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(default ((t (:inherit nil :stipple nil :background "white" :foreground "black" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 98 :width normal :foundry "unknown" :family "DejaVu Sans")))))
Run Code Online (Sandbox Code Playgroud)

emacs customization elisp dot-emacs emacs-faces

0
推荐指数
1
解决办法
3384
查看次数