-
查看版本
# Finding your kernel release $ uname -r > 3.16.0-34-generic # Finding your distribution release $ lsb_release -a > Distributor ID: Ubuntu
> Description: Ubuntu 14.10
package main | |
import ( | |
"net" | |
"os" | |
) | |
func main() { | |
strEcho := "Halo" | |
servAddr := "localhost:6666" | |
tcpAddr, err := net.ResolveTCPAddr("tcp", servAddr) |
查看版本
# Finding your kernel release
$ uname -r
> 3.16.0-34-generic
# Finding your distribution release
$ lsb_release -a
> Distributor ID: Ubuntu
> Description: Ubuntu 14.10
# Thanks to @samsonjs for the cleaned up version: | |
# https://gist.github.com/samsonjs/4076746 | |
PREFIX=$HOME | |
VERSION=1.2.3 | |
# Install Protocol Buffers | |
wget http://protobuf.googlecode.com/files/protobuf-2.4.1.tar.bz2 | |
tar -xf protobuf-2.4.1.tar.bz2 | |
cd protobuf-2.4.1 |
import lxml.html | |
html = lxml.html.parse("http://pypi.python.org/pypi") # can take an url, a filename or an object with a .read() method | |
packages = html.xpath('//tr/td/a/text()') # get the text inside all "<tr><td><a ...>text</a></td></tr>" | |
print packages | |
Out[7]: | |
[u'celery\xa02.2.3', | |
u'django-celery\xa02.2.3', | |
u'kombu\xa01.0.3', |
var page = require('webpage').create(); | |
// User-Agent is supported through page.settings | |
page.settings.userAgent = 'Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5355d Safari/8536.25'; | |
// This is how you set other header variables | |
page.customHeaders = {'Referer': 'localhost'}; |
package main | |
import ( | |
"log" | |
"net/http" | |
) | |
func redirect(w http.ResponseWriter, r *http.Request) { | |
http.Redirect(w, r, "http://www.google.com", 301) |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import urllib2 | |
gh_url = 'https://api.github.com' | |
req = urllib2.Request(gh_url) | |
password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm() |
from concurrent.futures import ThreadPoolExecutor | |
from functools import partial, wraps | |
import time | |
import tornado.ioloop | |
import tornado.web | |
EXECUTOR = ThreadPoolExecutor(max_workers=4) |
# 0 is too far from ` ;) | |
set -g base-index 1 | |
# Automatically set window title | |
set-window-option -g automatic-rename on | |
set-option -g set-titles on | |
#set -g default-terminal screen-256color | |
set -g status-keys vi | |
set -g history-limit 10000 |
#coding=utf8 | |
import itchat | |
# tuling plugin can be get here: | |
# https://github.com/littlecodersh/EasierLife/tree/master/Plugins/Tuling | |
from tuling import get_response | |
@itchat.msg_register('Text') | |
def text_reply(msg): | |
if u'作者' in msg['Text'] or u'主人' in msg['Text']: | |
return u'你可以在这里了解他:https://github.com/littlecodersh' |