Skip to content

Instantly share code, notes, and snippets.

View chihchun's full-sized avatar
🎯
Focusing

Rex Tsai chihchun

🎯
Focusing
View GitHub Profile
@chihchun
chihchun / nextmedia.py
Created January 6, 2011 15:52
spider to parse tw.nextmedia.com
import re
from scrapy.selector import HtmlXPathSelector
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from scrapy.contrib.spiders import CrawlSpider, Rule
from linkeddata.items import LinkeddataItem
class NextmediaSpider(CrawlSpider):
name = 'nextmedia'
allowed_domains = ['tw.nextmedia.com']
We couldn’t find that file to show.
#!/usr/bin/python
# -*- coding: utf-8 -*-
from xml.etree import ElementTree
import dbus
import urllib
import sys
def main(argv=sys.argv):
gtg = dbus.SessionBus().get_object('org.GTG', '/org/GTG')
tasks = gtg.get_tasks()
Traceback (most recent call last):
File "/home/plurk/plurk/git_trunk/ext/parts/web/wsgiserver/__init__.py", line 1183, in communicate
req.respond()
File "/home/plurk/plurk/git_trunk/ext/parts/web/wsgiserver/__init__.py", line 553, in respond
self._respond()
File "/home/plurk/plurk/git_trunk/ext/parts/web/wsgiserver/__init__.py", line 565, in _respond
response = self.wsgi_app(self.environ, self.start_response)
File "/home/plurk/plurk/git_trunk/ext/werkzeug/utils.py", line 859, in __call__
return self.app(environ, start_response)
File "/home/plurk/plurk/git_trunk/ext/parts/web/web.py", line 295, in dispatch_request
@chihchun
chihchun / gist:831517
Created February 17, 2011 11:10
LIRC commands of nextvod remote controller
begin remote
name fdremote1
bits 16
flags SPACE_ENC|CONST_LENGTH
eps 30
aeps 100
header 8957 4477
one 550 1695
@chihchun
chihchun / gist:831520
Created February 17, 2011 11:11
DBus APIs for nextvod
dbus-send --system --print-reply --dest=com.fulldynamic.hal /com/fulldynamic/hal org.freedesktop.DBus.Introspectable.Introspect
method return sender=:1.1 -> dest=:1.12 reply_serial=2
string "<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="com.fulldynamic.hal">
<signal name="playerStatusEOF">
</signal>
<signal name="playerStatusBuffering">
</signal>
@chihchun
chihchun / gist:831522
Created February 17, 2011 11:12
NextVOD firmware images
fdtv_update_0000001_rsa_fdhal-bsmi_fdtv-bsmi_full_v1348.pkg
fdtv_update_000002A_v1431.pkg
fdtv_update_000002I_v1534.pkg
fdtv_update_000002N_v1545.pkg
fdtv_update_000002P_v1556.pkg
fdtv_update_0000042_rsa_newui_full.pkg
fdtv_update_0000046_rsa_newui_full.pkg
fdtv_update_0000056_rsa_bypass_sap_force_enable_hdmi_full.pkg
fdtv_update_0000062.pkg
fdtv_update_0000065_rsa_normal_hdmi_bsmi_full.pkg
// ==UserScript==
// @name Fix anobii wish list link
// @include http://www.anobii.com/books/*
// @description replace "/wishlist?v=01202429d0a8178ec4" with "/wishlist?itemIdFade=01202429d0a8178ec4"
// ==/UserScript==
var allLinks = document.links;
if (allLinks != null) {
for (i = 0; i <allLinks.length; ++i) {
@chihchun
chihchun / ptt-slow-post.pl
Created March 31, 2011 03:09
Ptt 發文賺批幣,每秒貼一個字。
#!/usr/bin/perl
# Usage: perl ptt-post.pl content-in-a-file
# 1. save your post into a file
# 2. screen telnet ptt.cc
# 3. make a post && screen -d
# 4. perl ptt-post.pl content-in-a-file
use Expect;
use strict;
my $command = "screen";
@chihchun
chihchun / gist:1006058
Created June 3, 2011 08:35
apt pinning for oneiric
$ cat /etc/apt/preferences.d/oneiric
Package: *
Pin: release n=oneiric
Pin-Priority: 499