Skip to content

Instantly share code, notes, and snippets.

@jinuljt
Last active February 5, 2018 11:41
Show Gist options
  • Select an option

  • Save jinuljt/5aec5a64810362098c30 to your computer and use it in GitHub Desktop.

Select an option

Save jinuljt/5aec5a64810362098c30 to your computer and use it in GitHub Desktop.
各种坑

redis

redis 命令参数数量不能超过 1024*1024 个,包含命令哦。 比如:

SADD key 1 2 3 4...n (n <= 1024*1024 - 2)

source

emacs

osx 上可以安装GUI 的emacs emacs for Mac OS X,but,你在terminal中输入emacs用的还是osx系统自带的老版本 emacs哦。 不过你可以用下面的bash脚本替换/usr/bin/emacs。

#!/bin/bash
/Applications/Emacs.app/Contents/MacOS/Emacs "$@"

想要在terminal中使用emacs?

emacs -nw

docker

如果是使用ufw,你会发现,明明ufw没有开启某个端口,但是如果某个docker container暴露端口的话,其他人可以访问到。 这个时候你需要修改/etcd/default/docker,增加以下配置:

DOCKER_OPTS="$DOCKER_OPTS --iptables=false"

OS X

Mail.app

OS X 10.11 中Mail.app 在内存中压缩日志导致内存飙升。

rm -f ~/Library/Containers/com.apple.mail/Data/Library/Logs/Mail/*

source

SSL

上线之前一定要在每个平台上都测试一下哦。 最好把各级CA证书都放到你的CRT里面。

source:线上用户帮我测试了一把。呵呵

Python

Django

format_html 处理 花括号(brace)

In [14]: format_html("{{}}")
Out[14]: '{}'

In [15]: format_html("{}", '{')
Out[15]: '{'

In [16]: format_html("{}", '}')
Out[16]: '}'

requests

因为 requests 是根据http response自动处理body的编码的,所以如果http response中没有指定编码,那会导致requests给一个默认的编码,比如就导致我的utf-8数据乱码了。

特别是当接口是别人提供时,建议指定编码。我遇到的问题是微信获取素材接口因为requests导致的乱码。

resp = requests.get(...)
resp.encoding = "utf-8"

前端

JavaScript动态修改CSS会有跨域问题。

#iTerm2

iTerm2 会有 focus report,在termina中输入^[[I^[[O 用 vim 的时候特别明显会有问题,经常鼠标焦点变化导致出问题。 https://github.com/sjl/vitality.vim

apt-get

遇到 apt-get update 特别慢的情况,并且总是不成功,两台机器相同的配置都会这样。用 apt-get clean 就好了。

抓包看了一下有问题的那台电脑,apt source list返回 416 Requested Range Not Satisfiable。我的猜测是值钱 apt-get update 的时候Ctrl-C 取消,导致有缓存。用 apt-get clean 清理掉就好了。

Tornado

get_secure_cookie 返回的是 byte

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment