开发 Tips(8)

主要记录最近遇到的一些开发问题,解决方法。

1. Linux 下设置 Git 访问凭证

Windows 或 OS X 上有 keychain 工具管理账户凭证,在 Linux 系统上使用 Http/Https 协议访问 Git 仓库时,每次都需要输入账户密码。通过下面的配置,可以省略这一过程。
  • 新建凭证文件
  • 1
    
    touch ~/.git-credentials
    
  • 编辑文件,添加凭证信息
  • 1
    
    https://{username}:{password}@git-domain.com
    
  • 使凭证生效
  • 1
    
    git config --global credential.helper store
    
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    
    import timeit
    
    a = tuple(range(9999))
    
    def test_tuple():
        for i in a:
            i = i * i
    
    timeit.timeit('test_tuple()', 'from __main__ import test_tuple', number=1000)
    1. 0.3050811290740967