
Comp/Prog/Linux Tips
文章平均质量分 51
Wolf0403
这个作者很懒,什么都没留下…
展开
-
Anaconda for Windows
Forget about ActivePython or stock installation. Use Miniconda is much easier.http://conda.pydata.org/miniconda.html原创 2014-06-18 11:19:37 · 4596 阅读 · 0 评论 -
Mac Security Essentials, protecting yourself against Flashback virus
1、开启自动更新2、禁用 Java Applet 插件设置参考 Google Docs 文档原创 2012-04-11 16:15:42 · 826 阅读 · 0 评论 -
Linux container hand-crafted
目标:快速建立环境用语测试 deb 包安装 / web 应用部署。可参考 https://github.com/wolf0403/lvmvm 的 README 基础环境:Ubuntu Natty (11.04) server. 文件系统:测试环境的快速部署依赖 LVM (Logical Volume Management) 。安装宿主系统方法不限,留足够硬盘原创 2012-01-24 16:33:45 · 1851 阅读 · 0 评论 -
Ubuntu Natty locale issue
Ubuntu Natty (11.04), debootstrap-ed chroot environmentRunning most commands would receive the following warning message:perl: warning: Setting locale failed.perl: warning: Please check that yo原创 2012-01-17 07:33:12 · 1172 阅读 · 0 评论 -
Trying out LVM2 on Ubuntu
Environment:Ubuntu 8.04 server LTS in VMwarePartitioned with installation guide, whole with LVMExtra empty virtual disk 8GB added as second SCSI device Steps: 1. Partition the new disk:原创 2009-09-12 22:35:00 · 1516 阅读 · 1 评论 -
Virtualbox network setup with no public IP
VirtualBox 虚拟 NAT 网络的限制与解决方法。原创 2011-03-05 09:22:00 · 2085 阅读 · 0 评论 -
Python MySQLdb unicode
无数人写过 blog / post 关于这个问题,但我还是又重新解决了一遍。先公布答案。 1、MySQLdb 连接类型conn = MySQLdb.connect(..., use_unicode = True, charset = "utf8",) 2、cursor.fetchall() 得到的字符串 typeof() 得到 ,所以要串接,要全部使用 unicodefo原创 2009-07-29 10:45:00 · 3986 阅读 · 1 评论 -
Now launching Advanced Linux Programming Chinese wiki site
Now launching Advanced Linux Programming zh_CN wiki for publishing, sharing and further developing the great book for Linux/C beginers. Please visit at http://wwwolf.3322.org/tracs/alp 为进一步完善翻译、原创 2009-07-20 02:11:00 · 3204 阅读 · 5 评论 -
Server status. Good job, friend!
ryan@ubuntu-server:~$ uptime 01:25:05 up 48 days, 4:24, 1 user, load average: 0.11, 0.12, 0.09 Will be shutdown in prior to power outage on Monday.原创 2009-03-02 01:29:00 · 1187 阅读 · 0 评论 -
Netcraft brain-dead
中国Web Server QZHTTP极速上升- 新闻Linux时代- 开源、自由、共享 ...中国Web Server QZHTTP极速上升- 新闻新闻Linux 技术文档.linux.chinaunix.net/news/2009/02/25/1063236.shtml - 23小时前 - 类似网页中国Web Server QZHTTP极速上升- 开源业界与评论- Linu原创 2009-02-26 12:35:00 · 1651 阅读 · 0 评论 -
Linux由谁编写?Be free, or to be served free?
http://news.youkuaiyun.com/n/20081111/120734.html唔,前十名看起来是:Red Hat,11.2%;Novell,8.9%;IBM,8.3%;Intel,4.1%;Linux基金会,2.6%;独立Linux顾问公司,2.5%;SGI,2.0%;MIPS Technology,1.6%;Oracle,1.3%和MontaVista,1.2%。就在这前十名底下,将发现转载 2008-11-21 03:24:00 · 1772 阅读 · 1 评论 -
PAM auth with program supplied password
PAM Authentication with program supplied username / password pair.In cases like "login" and "sudo", the use of PAM involves asking user for password on the terminal. This is a feature provided by the原创 2008-10-15 10:30:00 · 4023 阅读 · 0 评论 -
Server Building Made Easy w/ Virualization
Building a bunch of servers isnt even in my imaginary before but im running a couple now and looking forward to expand them, thanks to virtualization technology.p.s. Billy used to say that I writ原创 2008-05-11 01:53:00 · 1705 阅读 · 0 评论 -
Proxy and site on same port with Apache 2.2
# sites-enabled/siteNameVirtualHost *:80 ServerName site.com# sites-enabled/proxy #ServerName not important ProxyRequests OnWhen using Debian style sites-enabled, make sure Pro原创 2012-04-28 18:21:30 · 1261 阅读 · 0 评论 -
Bash array iteration
#!/bin/bashOD=outputURL=http://www.ug.it.usyd.edu.au/~ygao6590/# T: threadst=( 1 2 3 )#t=( 1 )# F: filesf=( "50k" "100k" "200k" )#f=( "50k" )# S: timeout (secs)s=( 5 10 15 20 25 )#s=( 5 )原创 2012-09-26 12:32:02 · 1055 阅读 · 0 评论 -
Retrospect on a recent university project
Group reflections and conclusionLimitations in terms of functionalityThe app is able to perform its main tasks to deliver and discover information on campus. However there are still limitation原创 2012-10-31 11:21:50 · 1132 阅读 · 0 评论 -
Installing virtualenv under Anaconda on OSX
OS X 10.8 by default comes with python 2.7.2.For using iPython Notebook (http://ipython.org/notebook.html) I usually install anaconda (http://continuum.io/downloads) in my home dir right away so I h原创 2013-09-16 17:34:55 · 4116 阅读 · 0 评论 -
PostgreSQL / GIST index require "LIMIT" clause to trigger the index.
When using PostgreSQL and POINT type / GIST indexing for location queries, "LIMIT" clause is required for correctly utilizing the GIST index.CREATE TABLE points ( name varchar(40) NOT NULL, ty原创 2013-09-03 11:07:22 · 2635 阅读 · 0 评论 -
URL redirection / building in WSGI app
Building an WSGI app with Flask with LinkedIn API access. The app runs fine in local dev environment but when put behind Nginx reverse proxy with HTTPS, all redirections and LinkedIn callbacks fails w原创 2013-06-24 03:31:35 · 2828 阅读 · 0 评论 -
[Unresolved] Webpy bug when using sessions with generator and normal function handlers
class count1: def GET(self): s.session.count += 1 return str(s.session.count)class count2: def GET(self): s.session.count += 1 yield str(s.session.count)With above two handlers diffe原创 2013-06-16 13:56:10 · 2950 阅读 · 0 评论 -
Tornado AsyncHTTPTestCase gotchas
Q: How to test session based scenarios (login, logout, @authenticated)?A: Need to handle cookie: parse Set-Cookie response headers and provide Cookie request headers.https://gist.github.com/wolf04原创 2013-04-30 19:54:23 · 3210 阅读 · 0 评论 -
Configure PHP and Django (Python) to run on the same Apache site.
Answered one question regarding how to setup Django / PHP to run on top / behind Apache frontend. I did the setup of Django using proxy_scgi. There are other ways like mod_wsgi but using proxy_* at原创 2013-04-20 16:47:34 · 2922 阅读 · 0 评论 -
Detection of a buffer overrun
Value of one of the thread-argument variable has changed at some place, which is only detected when the program crashes.(gdb) p *a$7 = { host = 0x0, port = 0, h_ent = 0x7fff5fbf6f10, r原创 2013-04-18 21:13:22 · 3424 阅读 · 0 评论 -
HTTP/1.1, protocol design, pySpeedtest client
So recently I've been writing HTTP/1.1 client side protocol parsing stuff. Twice.When I went through RFC2616, even shallow like I was doing (merely picking bits that I need to know to get my stuff原创 2013-04-15 23:38:34 · 2919 阅读 · 0 评论 -
TCP shutdown VS HTTP KeepAlive
Building an HTTP client for some performance testing purposes. Multiple sockets, I/O multiplexing, two threads. One sender pushing pipelined requests and one receiver dragging all server responses.原创 2013-02-23 23:08:49 · 3026 阅读 · 0 评论 -
Basic distinguish between web.py / flup and tornado web process handling model (TBC)
Tornado is known for its capability of handling concurrent connections with help of OS event triggering mechanisms like epoll and kqueue.Web.py is a web framework for Python. It relies on other serv原创 2012-12-23 21:53:49 · 3642 阅读 · 0 评论 -
Enable weak password in Ubuntu
WARNING: BAD PRACTICE!Here we go.Edit /etc/pam.d/common-passwordfind the linepassword [success=1 default=ignore] pam_unix.so obscure sha512The "obscure" option here disables sim原创 2012-11-05 14:11:30 · 3601 阅读 · 0 评论 -
Reflection on recent university project
Group reflections and conclusionLimitations in terms of structure, design, implementationThe design and structure of this app generally fulfills its requirements, capable of providing informatio原创 2012-10-31 11:26:26 · 2823 阅读 · 0 评论 -
Notes for recent work (iptables NAPT)
#!/bin/sh[ -z "$HOST" ] && HOST=localhostIP="`ping -c1 $HOST | egrep -o ([0-9]{1,3}.){3}([0-9]{1,3}) | head -n1`"# 清除前次设置的 NAPTiptables -t nat --flush# 将本机80映射到之前 $HOST 指定的服务器 80 上/sbin/iptables -原创 2008-05-11 01:04:00 · 2048 阅读 · 0 评论 -
VMware Server notes
这几天在 Laptop XP 和 Ubuntu server 上各装了 VMware Server。。实在是很酷的东西。不知道还有谁记得当年的 coLinux 没——或者这个东西现在还很流行,只是我不知道?VMware Server 至少已经非常简单地达到了我当初用 coLinux 没有做到的事情。 ——同时使用两个系统。不用 VMware Player 的原因: VMwar原创 2008-01-24 00:58:00 · 4473 阅读 · 3 评论 -
[glibc-manual]34.9 线程与信号处理
34.9 线程与信号处理-- 函数: int pthread_sigmask (int HOW, const sigset_t *NEWMASK, sigset_t *OLDMASK)pthread_sigmask 依照 HOW 和 NEWMASK 的指示改变调用线程的信号掩码(signal mask)。如果 OLDMASK 不是 NULL,则之前的信号掩码将被保存在 OLDMASK 指向的位翻译 2006-03-14 10:50:00 · 2365 阅读 · 0 评论 -
[glibc-manual]34.2 线程属性
34.2 线程属性线程具有一系列属性;这些属性可以在线程创建的时候指定。只需要创建并填充一个 pthread_attr_t 类型的线程属性对象 ATTR,并将其作为第二个参数传递给 pthread_create 就可以指定新创建线程的属性。如传递 NULL 作为第二个参数,则等价于传递一个所有属性均为默认值的属性对象。仅当创建新线程的时候线程属性对象才被参考。同一个线程对象可用于创建多个线翻译 2006-03-14 05:34:00 · 2639 阅读 · 2 评论 -
Simply memorize sth
mmap vs read : read requires one syscall for each operation while mmap doesnt.原创 2006-01-11 11:22:00 · 1700 阅读 · 0 评论 -
父子进程间 IPC 总结
目前本人熟悉的、特定适用于父子进程之间的 IPC 方式有三种:pipe、匿名 FIFO(Unix domain socket)和共享内存。现在将使用方法总结一下。1、管道Pipe 的特点:单向传递。在管道创建的时候,数据只能从读处读,从写处写,属于单向流动。相关文章已经太多了,小弟不多废话,贴一段代码提示记忆。CODE:[Copy to clipboard]$ cat -n pipe.c原创 2005-11-30 04:09:00 · 2363 阅读 · 0 评论 -
[memo] dlopen 与 --export-dynamic
先看看状况(小心头疼)client.c 编译得到 client;在 client 的 main 中用 dlopen( "./liba.so", RTLD_LAZY|RTLD_GLOBAL) 打开 liba.so,并调用 liba.so 中的 start 函数;在 liba.so 的 start 函数中通过 dlopen( 0, RTLD_GLOBAL|RTLD_LAZY ) 得到的句柄尝试调用 c原创 2005-11-02 19:06:00 · 10823 阅读 · 1 评论 -
[memo]left shift, right shift[on x86]
|-------|-------|-------|-------012345670123456701234567012345670 1 2 3在这个范围执行 对于值 (int)abcd 而言,在x86平台上,必须经过反序(htonl)才能得到与(int*)"abcd"相同的内存排布。Rock - 晨星 说:“byte”内还是左移,只是处理那个“溢出位”是给了原创 2005-11-01 12:02:00 · 1685 阅读 · 0 评论 -
futex(2) 快速用户态互斥体使用简介
这两天复习分布式系统,顺便看了一下 Linux 下的 futex(2) 同步机制。简单来说,futex(2) 是一个新的同步机制,在作用方面与一般的 mutex 比较相似。使用 futex(2) 进行同步的两个执行体必须通过一段共享的内存空间关联起来——这段内存空间可以具有相同或者不同的进程中地址,只要它们映射到同一块核心中内存地址即可——因此,线程和进程(通过 sysvshm 关联)都可以利用原创 2005-11-07 03:04:00 · 10589 阅读 · 0 评论 -
ALP-I-zh_CN released.
包含了原书第一、第二章的内容,修复了少量错误。欢迎提出宝贵意见或建议。新下载地址:http://www.lidaibin.com/alp1.pdf原创 2005-10-29 17:09:00 · 2748 阅读 · 13 评论 -
Project Announcement: LibPML
Project Announcement项目通告Project: LibPML, the Protocol Markup Language Library项目名: LibPML, 协议标记语言与解析库Motivation: Network applications are growing rapidly nowadays. By the same way, the protocol family原创 2005-10-27 03:17:00 · 2131 阅读 · 3 评论 -
Linux Tips 之 狸猫换太子:LD_PRELOAD
$ cat 1.cvoid *malloc ( unsigned sz ) { return 0; }$ gcc -shared 1.c -o libmyc.so$ cat 2.c#include int main () { void *p = malloc ( 3 ); return p == NULL;}$ gcc 2.c$ ./a.out$ echo $?0$ LD_PRELOAD="l原创 2005-06-07 06:29:00 · 4028 阅读 · 2 评论