作为每天 ssh 到服务器的码农,以下 ssh 设置真是实用啊。
# http://blogs.perl.org/users/smylers/2011/08/ssh-productivity-tips.html
# If the network disappears your connection will hang, but if it then re-appears with 3 minutes it will resume working
TCPKeepAlive no
ServerAliveInterval 60
ServerAliveCountMax 3
# avoid not used GSSAPI authentication to faster up connection
GSSAPIAuthentication no
# share ssh session
ControlMaster auto
ControlPath /tmp/ssh_mux_%h_%p_%r
# keep alive for 2h
ControlPersist 2h
# scp on remote
ForwardAgent yes
详见:
http://blogs.perl.org/users/smylers/2011/08/ssh-productivity-tips.html
上个文章 comments 里的一个连接:
http://diogomelo.net/blog/10/ssh-tricks
[Quick-Tip: Reusing OpenSSH connections to the same host](https://revsys.com/writings/quicktips/ssh-faster-connections.html)
2013年5月20日星期一
2013年5月13日星期一
Emacs ROCKKKKKK!!!
今天找一个方法实现 Emacs 里面的自动保存,发现了 http://emacsredux.com/ 这个专门针对 Emacs 的技巧 Blog,是 Prelude 作者撰写的,找到了 N 个想要已久的功能。 最后在浏览 Prelude 介绍的时候,发现了 Ace Jump 这个让我瞬间内牛满面的插件,键盘党也可以快速跳转光标了,而且不是在 VIM 里!对 VIM 的 f 键早已经羡慕妒忌狠很久了,现在可以了了这心了。
还有 imenu... 爽翻了。
还有 imenu... 爽翻了。
2013年3月7日星期四
Ubuntu 12.10 一点优化Unity的小技巧
Ubuntu 的桌面使用了 Unity,因此可以通过 Win+数字 这样的快捷键来切换窗口。使用过程中会不小心的就按到 Win 键,这个时候弹出 Dash,经常卡住。在网上搜索了一下想禁用这个 Dash,没有什么结果,估计是没有办法的。不过找到一个可以加速这个 Dash Board 显示的技巧,安装 compiz config,设置 unity 的 Dash Blur 为 Static Blur,甚至 No Blur 就好了。原文连接如下:
http://askubuntu.com/questions/137091/how-to-disable-icon-fetching-in-dashboards-search-increasing-performance-idea
http://askubuntu.com/questions/137091/how-to-disable-icon-fetching-in-dashboards-search-increasing-performance-idea
2012年12月29日星期六
MySQL 的坑
对MySQL一直没有什么研究,基础知识不甚,今天总算遇到个坑搞了2个小时。
现象:
新增加了一个简单的表,外键指向另外一个表的 id。增加 row 的时候,总是提示
1452, 'Cannot add or update a child row: a foreign key constraint fails
折腾了半天,Google 出来的都不太有用,找不到原因。最后偶然发现了一丝线索。起因是我更换了操作系统,升级了 MySQL 的版本。新版本是 5.5 默认新建的表是 Innodb 引擎的,而我原来的库都是用 MyISAM的,所以出问题了,详细见如下连接:
http://stackoverflow.com/questions/3890205/why-foreign-key-constraint-fails-when-foreign-key-exists
最后,必须说 mysql-workbench 这东西 5.2 版本挺好用啊,没用过 phpmyadmin 的人超级喜欢这个。
2012年11月19日星期一
Ubuntu 上使用 Evernote
由于 Evernote 非常蛋疼的觉得 Linux 用户没啥值得支持的,盈利第一,所以一直以来在 Ubuntu 下都是使用 web 方式,基本上除了偶尔查点笔记外,没有使用的欲望。
之前尝试一个第三方的客户端 Everpad (github),在 Ubuntu 11.10 下我没成功跑起来,放弃。尝试过 wine,感觉有点渣。然后,今天尝试了 nixnote,目前看来还算满意。
安装过程中遇到点问题,记录一下。
其实系统已经是有了libssl 1.0.0版本的。Google 了一下:
Nixnote 1.3 dependency not satisfiable libssl(>=0.9.8)
1.3 dependency not satisfiable libssl(>=0.9.8)
其中第二链接提到了把 deb 包解压后,修改 control 文件里的 dependency,然后重新用 dpkg-deb -b build-directory 来打包。修改成 1.0.0 就可以了。
Ubuntu 12.10 可以通过 ppa 安装。 如下:
http://www.ubuntubuzz.com/2011/10/how-to-install-evernotenixnote-in.html
之前尝试一个第三方的客户端 Everpad (github),在 Ubuntu 11.10 下我没成功跑起来,放弃。尝试过 wine,感觉有点渣。然后,今天尝试了 nixnote,目前看来还算满意。
安装过程中遇到点问题,记录一下。
sudo dpkg -i /home/too/Downloads/nixnote-1.4_i386.deb
dpkg: dependency problems prevent configuration of nixnote:
nixnote depends on libssl0.9.8; however:
Package libssl0.9.8 is not installed.
其实系统已经是有了libssl 1.0.0版本的。Google 了一下:
Nixnote 1.3 dependency not satisfiable libssl(>=0.9.8)
1.3 dependency not satisfiable libssl(>=0.9.8)
其中第二链接提到了把 deb 包解压后,修改 control 文件里的 dependency,然后重新用 dpkg-deb -b build-directory 来打包。修改成 1.0.0 就可以了。
Ubuntu 12.10 可以通过 ppa 安装。 如下:
http://www.ubuntubuzz.com/2011/10/how-to-install-evernotenixnote-in.html
For ubuntu user, Nixnote also available to install via PPA, do following on terminal :
- $ sudo add-apt-repository ppa:vincent-c/nevernote
- $ sudo apt-get update
- $ sudo apt-get install nixnote
2012年6月21日星期四
nginx 的 uwsgi http page cache 清除
uwsgi 搭配 nginx 使用,在nginx里面配置了缓存的话,后台代码更新后,页面没有在 uwsgi 重新生成,此时需要清除 nginx 的缓存。(不知道是不是重启 nginx 服务也可以)
检查 nginx conf 配置文件,查找 uwsgi_cache_path 或者 proxy cache 的路径,比如是/dev/shm/,那么执行如下命令可以找到对应被cache 的url的文件:
sudo grep -lr 'http://url_some/' /dev/shm/*
执行 rm 删除该文件即可。当然也可以删除cache 的所有文件:
find /path/to/your/cache -type f -delete
nginx 较新的版本有个module 也可以做这个事情, 叫 purge cache 之类的,需要 Google 一下。
检查 nginx conf 配置文件,查找 uwsgi_cache_path 或者 proxy cache 的路径,比如是/dev/shm/,那么执行如下命令可以找到对应被cache 的url的文件:
sudo grep -lr 'http://url_some/' /dev/shm/*
执行 rm 删除该文件即可。当然也可以删除cache 的所有文件:
find /path/to/your/cache -type f -delete
nginx 较新的版本有个module 也可以做这个事情, 叫 purge cache 之类的,需要 Google 一下。
2012年5月8日星期二
Django ImageField 上传 jpeg 出错处理
使用 ImageField 之后,上传图片报错
Upload a valid image. The file you uploaded was either not an image or a corrupted image.
查看文档,检查PIL已经装好,MEDIA_ROOT 也设置了,似乎没有什么遗留了。直接Google出错信息,发现是PIL需要JPEG的支持。
Ubuntu 下安装操作如下:
先要反安装 PIL
- sudo pip uninstall PIL
- sudo apt-get install libjpeg8.dev
- sudo pip install PIL
一般就能解决问题了。但是由于使用了Virtualenv,需要在安装PIL的时候指出lib的路径,具体操作如下:
- pip uninstall PIL
- sudo apt-get install libjpeg8.dev
- virtualenv ~/Dev/python-virtualenv/project-name
- workon project-name
- (project-name) cd ~/Dev/python-virtualenv/project-name/
- (project-name) ln -s /usr/lib/x86_64-linux-gnu/libz.so ./lib/
- (project-name) ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so ./lib/
- (project-name) ln -s /usr/lib/x86_64-linux-gnu/libfreetype.so ./lib/
- pip install PIL
注意:i386路径为 /usr/lib/i386-linux-gnu/
参考链接:
订阅:
评论 (Atom)