Skip to content

Instantly share code, notes, and snippets.

@lisongx
lisongx / gist:1517515
Created December 24, 2011 15:04
download the hacker monthly issue
from fabric.api import local, run
from pyquery import PyQuery as pq
BASE_URL = "http://hackermonthly.com/"
HACKER_URL = "http://hackermonthly.com/issues.html"
d = pq(url=HACKER_URL)
issue_list = d("#issues li a")
def get_issue(inex, node):
d = pq(node)
@lisongx
lisongx / get_xidain_news.py
Created March 24, 2012 11:44
获得最see.xidian.edu.cn近几日的新闻
#!/usr/bin/env python
import requests
from lxml import html
from datetime import datetime, timedelta
# get news in last X days
DAY = 3
# url of the news page
$('body').append('<div id="tylerdurden"></div>');
$('#tylerdurden').click(function(e){
DBR.act($(this).attr('action'));
});
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from scrapy.selector import HtmlXPathSelector
from dmovie.items import MovieItem
import re
class MovieSpider(CrawlSpider):
name = 'douban_movie'
allowed_domains = ["http://movie.example.com/"]
start_urls = ['http://movie.douban.com/']
import urlparse
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from scrapy.selector import HtmlXPathSelector
from isbullshit.items import IsBullshitItem
class IsBullshitSpider(CrawlSpider):
""" General configuration of the Crawl Spider """
@lisongx
lisongx / gist:4050902
Created November 10, 2012 12:16
fp week6
def sentenceAnagrams(sentence: Sentence): List[Sentence] = {
def sen_iter(occur: Occurrences): List[Sentence] = {
if (occur == List())
List(Nil)
else for {
word_occur <- combinations(occur).filter(_ != List())
word <- dictionaryByOccurrences(word_occur)
rest <- sen_iter(subtract(occur, word_occur))
} yield word :: rest
}
[sean@xdlinux rubygems]$ sudo pacman -S zsh
Password:
resolving dependencies...
looking for inter-conflicts...
Targets (1): zsh-4.3.17-2
Total Download Size: 1.53 MiB
Total Installed Size: 6.72 MiB
@lisongx
lisongx / gist:7001310
Created October 16, 2013 01:31
tunnelblick
2013-10-16 09:30:24 *Tunnelblick: OS X 10.8.5; Tunnelblick 3.4beta10 (build 3614)
2013-10-16 09:30:25 *Tunnelblick: Attempting connection with douban using shadow copy; Set nameserver = 9; not monitoring connection
2013-10-16 09:30:25 *Tunnelblick: openvpnstart start douban.tblk 1337 9 0 1 1 305 -ptADGNWradsgnw 2.2.1
2013-10-16 09:30:25 *Tunnelblick: openvpnstart log:
Loading tun.kext
OpenVPN started successfully. Command used to start OpenVPN (one argument per displayed line):
/Applications/Tunnelblick.app/Contents/Resources/openvpn/openvpn-2.2.1/openvpn
--cd
@lisongx
lisongx / gist:8240693
Created January 3, 2014 16:19
build errro
compile done
resolve: Host not found (authoritative)
ERROR: Non Boolean in test.
RECEIVER:
class NetAddr (0x116231fc0) {
instance variables [19]
name : Symbol 'NetAddr'
nextclass : instance of Meta_Nil (0x1109c84c0, size=19, set=5)
superclass : Symbol 'Object'
@lisongx
lisongx / aa.md
Last active January 4, 2016 14:19
  1. In a terminal navigate to your userAppSupportDir resp. the directory containing the sources of your quarks.

    • On a mac:

      {% highlight bash %} $ cd ~/Library/Application\Support/SuperCollider/quarks {% endhighlight %}

    • On Linux: