MXOXW

Life always finds a way.

EFB使用webhook模式

| Comments

添加配置

1
2
3
4
5
6
7
eh_telegram_master = {
"flag": {
"webhook_url": "http://example.com",
"port": 5000
},
"token": "12345678:QWFPGJLUYarstdheioZXCVBKM",
...

修改polling_from_tg

1
2
3
4
5
6
7
8
9
10
11
12
13
# self.bot.start_polling(timeout=10)
webhook_url = self._flag('webhook_url', '')
port = self._flag('port', 80)
if webhook_url != '':
token = getattr(config, self.channel_id)['token']
if not webhook_url.endswith('/'):
webhook_url += '/'
webhook_url += token
self.bot.start_webhook('127.0.0.1', port, token)
self.bot.bot.setWebhook(webhook_url=webhook_url)
# self.logger.critical("webhook_url: %s" % webhook_url)
else:
self.bot.start_polling(timeout=10)

修改nginx配置

转发回调请求到http://127.0.0.1:5000

git多账户

| Comments

1
2
3
ssh-keygen -t rsa -C "[email protected]"    // 添加key

Enter file in which to save the key (/c/Users/Administrator/.ssh/id_rsa): XXX //修改默认名称

.ssh目录添加config文件
修改内容

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Host *.a.com
IdentityFile ~/.ssh/id_rsa
User WWW

Host github.com
IdentityFile ~/.ssh/github
User YYY

Host git.coding.net
IdentityFile ~/.ssh/coding
User XXX

// Host github2
// HostName github.com
// IdentityFile ~/.ssh/github
// User YYY
// 使用方式:
// git clone github2:YYY/Mywork.git
// git clone git@github2:YYY/Mywork.git

参考:

http://www.cnblogs.com/BeginMan/p/3548139.html
http://www.tuicool.com/articles/7nMBVf

ssh自动登录

| Comments

1
2
3
4
5
6
7
8
9
10
11
12
13
#!/usr/bin/expect -f

set port 22
set user XXX
set host XXX
set password XXX
set timeout -1

spawn ssh $user@$host
expect "*assword:*"

send "$password\r"
interact