Skip to content

Instantly share code, notes, and snippets.

@zippera
zippera / hexo.workflow
Created April 6, 2014 06:04
alfred 的 workflow,用hexo 写博客时用。相关介绍:http://zipperary.com/2013/10/27/alfred-workflow/
cd Documents/zipperary
hexo n '{query}'
open ./source/_posts/
cd source/_posts/
file=`ls -rt | tail -1`&&open $file -a Mou
cd ~/Documents/zipperary
@zippera
zippera / hexo.sh
Created April 6, 2014 05:58
一个zsh 的 shell 脚本,执行方式是`zsh hexo.sh title`,利用 hexo 创建一个文档并打开。
#!/bin/zsh
#for hexo
cd ~/Documents/zipperary
hexo n "$1"
cd source/_posts/
file=`ls -rt | tail -1`&&open $file -a Mou
@zippera
zippera / bow.m
Created December 28, 2013 02:16
人工智能作业,对图片分类,matlab 版。
clear all;
clc;
ncluster = 10;
%%%%%%%读入数据
path_c = 'car feature/';
path_d = 'dinosaur feature/';
%恐龙
d_dir = [];
d_inf = [];
files_d = dir(strcat(path_d ,'*.txt'));
@zippera
zippera / bow.py
Created December 16, 2013 04:22
人工智能作业,对图片分类。
#!/usr/bin/env python
#coding=utf-8
import os
from numpy import array
from scipy.cluster.vq import vq, kmeans, whiten, kmeans2
from sklearn import svm
from sklearn import cross_validation
ncluster = 6 #聚类数
########
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal
#coding=utf8
##版本:1.0
##环境:python2.7
##作者:moxie
##日期:2013.08.23
##说明:文件生成目录为:D:/ludatui
import urllib2,urllib
import re
@zippera
zippera / v2ex_topx.py
Last active December 21, 2015 08:18
这个代码可以抓取v2ex回复数量前N的帖子。统计的页数和Top页数都可以指定。
#coding=utf8
##版本:1.0
##环境:python2.7
##作者:moxie
##日期:2013.08.20
import urllib2
import re
import threading
@zippera
zippera / mlook_ebooks.py
Last active October 17, 2017 07:18
依赖第三方库:requests和BeautifulSoup4 只下载mobi和epub格式电子书
#coding=utf-8
##版本:1.0
##环境:python2.7
##作者:moxie
##日期:2013.08.18
##第三方依赖:requests和BeautifulSoup4
import re
import requests as rq
@zippera
zippera / mlook.py
Last active December 21, 2015 05:49
#encoding=utf-8
import requests as rq
from bs4 import BeautifulSoup as bs
lgurl = 'http://mlook.mobi/member/login'
host = 'http://mlook.mobi'
tmpurl = 'http://mlook.mobi/book/info/6248'
hds = { 'User-Agent' : 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.72 Safari/537.36',
'Referer':'http://mlook.mobi/member/login',
Error in user YAML: (<unknown>): found character that cannot start any token while scanning for the next token at line 2 column 1
---
# Python 简介
@su27 and @menghan
---

What is Python?

Python: 优雅而健壮的编程语言

  • 高级

  • 易学易读易维护