As configured in my dotfiles.
start new:
tmux
start new with session name:
| #!/usr/bin/python | |
| # -*- coding: utf-8 -*- | |
| # | |
| #author: rex | |
| #blog: http://iregex.org | |
| #filename tr.py | |
| #created: 2010-08-01 20:24 | |
| #source uri: http://iregex.org/blog/trie-in-python.html | |
| # escape bug fix by fcicq @ 2012.8.19 |
| #!/usr/bin/python | |
| # -*- coding: utf-8 -*- | |
| # | |
| #author: rex | |
| #blog: http://iregex.org | |
| #filename tr.py | |
| #created: 2010-08-01 20:24 | |
| #source uri: http://iregex.org/blog/trie-in-python.html | |
| # escape bug fix by fcicq @ 2012.8.19 |
| # https://ruby-china.org/topics/7555 | |
| # gem 'fast_trie', :require => "trie" | |
| # encoding: utf-8 | |
| class SegTrie | |
| attr_accessor :trie | |
| def initialize | |
| self.trie = ::Trie.new | |
| end |
As configured in my dotfiles.
start new:
tmux
start new with session name:
| <?php | |
| // http://zguide.zeromq.org/php:mdcliapi2 | |
| /* ===================================================================== | |
| * mdcliapi2.c | |
| * | |
| * Majordomo Protocol Client API (async version) | |
| * Implements the MDP/Worker spec at http://rfc.zeromq.org/spec:7. | |
| * | |
| * --------------------------------------------------------------------- | |
| * Copyright (c) 1991-2011 iMatix Corporation <www.imatix.com> |
| head /dev/urandom | openssl base64 | head -n -1 | cut -b1-16 |
| # -*- encoding: utf-8 -*- | |
| # Creates a task-bar icon with balloon tip. Run from Python.exe to see the | |
| # messages printed. Right click for balloon tip. Double click to exit. | |
| # original version of this demo available at http://www.itamarst.org/software/ | |
| import win32api, win32con, win32gui | |
| import webbrowser | |
| import time, urllib2, threading, re | |
| import logging | |
| opener = urllib2.build_opener(urllib2.HTTPCookieProcessor()) |
| yum remove -y pptpd ppp | |
| iptables --flush POSTROUTING --table nat | |
| iptables --flush FORWARD | |
| rm -rf /etc/pptpd.conf | |
| rm -rf /etc/ppp | |
| arch=`uname -m` | |
| wget http://poptop.sourceforge.net/yum/stable/packages/pptpd-1.4.0-1.el6.x86_64.rpm | |
| yum -y install make libpcap iptables gcc-c++ logrotate tar cpio perl pam tcp_wrappers dkms kernel_ppp_mppe ppp |
| <?php | |
| function httpGet($host, $base) { | |
| global $index; | |
| //使用fsockopen会导致阻塞 | |
| //$fd = fsockopen($host, 80, $errno, $errstr, 3); | |
| $fd = stream_socket_client("{$host}:80", $errno, $errstr, 3, STREAM_CLIENT_ASYNC_CONNECT | STREAM_CLIENT_CONNECT); | |
| $index[$fd] = 0; | |
| $event = event_new(); |