This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import time | |
| import multiprocessing | |
| import memcache | |
| key = 'foo' | |
| process = 100 | |
| count = 1000 | |
| def f(): | |
| mc = memcache.Client(['127.0.0.1:11212']) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os.path | |
| import markdown | |
| HTML = """ | |
| <html> | |
| <head> | |
| <style type="text/css"> | |
| <!-- | |
| body { | |
| font-family: Halvetica, sans-serif; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import scrapemark # http://arshaw.com/scrapemark/ | |
| scrapemark.user_agent = 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0)' | |
| pattern = '<div id="topicsfb">{*<li>{{[]}}</li>*}</div>' | |
| for i in scrapemark.scrape(pattern, url='http://www.yahoo.co.jp/'): | |
| print i |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.mockito.Mockito; | |
| import org.springframework.beans.BeansException; | |
| import org.springframework.beans.MutablePropertyValues; | |
| import org.springframework.beans.PropertyValue; | |
| import org.springframework.beans.factory.FactoryBean; | |
| import org.springframework.beans.factory.config.BeanFactoryPostProcessor; | |
| import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; | |
| import org.springframework.beans.factory.support.BeanDefinitionRegistry; | |
| import org.springframework.beans.factory.support.RootBeanDefinition; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| import sys | |
| import time | |
| import signal | |
| from subprocess import Popen, PIPE | |
| dd = Popen(['dd'] + sys.argv[1:], stderr=PIPE) | |
| while dd.poll() is None: | |
| time.sleep(.3) | |
| dd.send_signal(signal.SIGUSR1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def col2row(col): | |
| """ | |
| >>> col2row('B') | |
| 2 | |
| >>> col2row('Z') | |
| 26 | |
| >>> col2row('AA') | |
| 27 | |
| >>> col2row('AZ') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defn pow [^long m ^long n] | |
| (apply * (repeat n m))) | |
| (defn ^long col2row [^String col] | |
| (apply + (map-indexed (fn [i c] * (- (int c) 64) (pow 26 i)) | |
| (reverse col)))) | |
| (defn ^String row2col [^long row] | |
| (let [n (mod (- row 1) 26) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| set-option -g prefix C-t | |
| unbind-key C-b | |
| bind C-r source-file ~/.tmux.conf | |
| set-window-option -g mode-keys vi | |
| bind -r C-h resize-pane -L 6 | |
| bind -r C-l resize-pane -R 6 | |
| bind -r C-j resize-pane -D 6 | |
| bind -r C-k resize-pane -U 6 | |
| bind -r s swap-pane -U |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function getParams() { | |
| var params = {} | |
| var h = location.href.replace(/^.*\?/, '').split('&') | |
| for (var i = 0; i < h.length; ++i) { | |
| var p = h[i].split('=') | |
| params[p[0]] = p[1]; | |
| } | |
| return params; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.net.InetSocketAddress | |
| import org.jboss.netty.channel.ChannelPipelineFactory | |
| import org.jboss.netty.channel.Channels | |
| import org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder | |
| import org.jboss.netty.handler.codec.frame.Delimiters | |
| import org.jboss.netty.handler.codec.string.StringDecoder | |
| import org.jboss.netty.handler.codec.string.StringEncoder | |
| import org.jboss.netty.util.CharsetUtil | |
| import com.twitter.finagle.builder.ClientBuilder |
OlderNewer