Skip to content

Instantly share code, notes, and snippets.

引言
作用一名程序员,我们会经常混迹与不同的代码仓库,时常不同仓库会有作者信息验证。比如公司内建的gitlab一般会要求统一使用公司内部的域账号签名;github要求使用github账号签名等。因此,很容易犯在不同库中提交代码发现默认配置的author信息没有变更,结果push被拒绝。
下面介绍几种常用的解决方式,当然最终还是需要养成切换代码库检查author信息的习惯,主动配置
```
// 设置全局
git config --global user.name "Author Name"
git config --global user.email "Author Email"
@Jhenxu
Jhenxu / gist:dbbe5cfcb45a46f8a0a0
Created November 27, 2015 09:12
apk和jar方法数脚本
这两天被Unable to excute DX的问题缠身,工程太大,方法数量超过65536限制,开发正常build都是you有问题的!纳闷儿为什么Google要搞这个64K方法数的限制?一般大点儿的工程,引入的jar包不少的话,都会超过这个限制。
今天弄了两个小工具,分别用于统计jar包和apk中java方法的数量,工具名称分别为:jarmethod.sh 和 apkmethod.sh,两个工具在Linux环境下跑,分享给大家:
1、jarmethod.sh工具,用于统计jar包中的方法数,脚本内容如下,将其保存为jarmethod.sh即可:
#! /bin/sh
# 获得输入的jar文件
JAR_FILE=$1;
# 这里直接使用dx命令,是因为我已经提前配置好了环境变量,dx目录位于:
# $ANDROID_HOME/sdk/build-tools/android-4.3.1/dx
import pymongo
from pymongo import Connection
from bson.dbref import DBRef
from pymongo.database import Database
# connect
connection = Connection()
db = Database(connection, "things")
# clean up
#! /usr/bin/env python3
'''pyCookieCheat.py
20140518 v 2.0: Now works with Chrome's new encrypted cookies
Use your browser's cookies to make grabbing data from login-protected sites easier.
Intended for use with Python Requests http://python-requests.org
Accepts a URL from which it tries to extract a domain. If you want to force the domain,
just send it the domain you'd like to use instead.
@Jhenxu
Jhenxu / gist:8620915
Created January 25, 2014 18:15
rm all
We often get strange errors with python. When you changing the source and cannot figure out why files are used from past. So if you ever get this dejavu feeling, try using this command:
```
find . -type f -name '*.pyc' -exec rm {} \;
```
It will delete all precompiled python sources. (Because with python you have ability to distribute your files in binaries in fact.) Those errors usually appear if you move/delete *.py files with version control. You usually exclude *.pyc files from list. Old links used this way. Debugger does not suggest wrong imports because your files are in fact there, just precompiled.
Anyway I've just put this command to my blog for memorizing. It often helps me. Maybe it can for you.
" auto add file header
autocmd BufNewFile *.py 0r /Users/jhenxu/.vim/vim_template/vim_header_for_python
autocmd BufNewFile *.py ks|call FileName()|'s
autocmd BufNewFile *.py ks|call CreatedTime()|'s
autocmd BufNewFile *.sh 0r /Users/jhenxu/.vim/vim_template/vim_header_for_sh
autocmd BufNewFile *.sh ks|call FileName()|'s
autocmd BufNewFile *.sh ks|call CreatedTime()|'s
fun FileName()