Skip to content

Instantly share code, notes, and snippets.

View zonble's full-sized avatar

Weizhong Yang a.k.a zonble zonble

View GitHub Profile
@zonble
zonble / axe1.py
Created February 22, 2014 14:20
斧頭幫第一關 http://axe.g0v.tw/level/1
#!/usr/bin/env python
# encoding: utf-8
# http://axe.g0v.tw/level/1
import urllib, urllib2, re
html = urllib2.urlopen("http://axe-level-1.herokuapp.com").read()
pattern = r"<tr>\s*<td>(.*)</td>\s*<td>(.*)</td>\s*<td>(.*)</td>\s*<td>(.*)</td>\s*<td>(.*)</td>\s*<td>(.*)</td>\s*</tr>"
result = re.findall(pattern, html, re.MULTILINE)
@zonble
zonble / axe2.py
Last active August 29, 2015 13:56
斧頭幫第二關 http://axe.g0v.tw/level/2
#!/usr/bin/env python
# encoding: utf-8
# http://axe.g0v.tw/level/2
import urllib2, re
lines = []
for index in range(1, 13):
url = "http://axe-level-1.herokuapp.com/lv2/?page=" + str(index)
@zonble
zonble / axe3.py
Last active August 29, 2015 13:56
斧頭幫第三關 http://axe.g0v.tw/level/3
#!/usr/bin/env python
# encoding: utf-8
# http://axe.g0v.tw/level/3
import urllib, urllib2, re
import cookielib
lines = []
jar = cookielib.FileCookieJar("cookies")
@zonble
zonble / axe4.py
Created February 22, 2014 15:38
斧頭幫第四關 http://axe.g0v.tw/level/4
#!/usr/bin/env python
# encoding: utf-8
# http://axe.g0v.tw/level/4
import urllib, urllib2, re
lines = []
last_url = None
@zonble
zonble / axe1.jl
Created February 24, 2014 15:23
斧頭幫第一關 Julia 版本
using HTTPClient.HTTPC
r = HTTPC.get("http://axe-level-1.herokuapp.com")
@assert r.http_code == 200
html = bytestring(r.body)
pattern = r"<tr>\s*<td>(.*)</td>\s*<td>(.*)</td>\s*<td>(.*)</td>\s*<td>(.*)</td>\s*<td>(.*)</td>\s*<td>(.*)</td>\s*</tr>"
substrings = matchall(pattern, html)
lines = String[]
for s in substrings[2:]
c = match(pattern, s).captures
@zonble
zonble / axe2.jl
Created February 24, 2014 15:56
斧頭幫第二關 Julia 版本
using HTTPClient.HTTPC
lines = String[]
for index =[1:13]
url = "http://axe-level-1.herokuapp.com/lv2"
r = HTTPC.get(url, RequestOptions(query_params=collect({:page => index})))
@assert r.http_code == 200
html = bytestring(r.body)
pattern = r"<tr>\s*<td>(.*)</td>\s*<td>(.*)</td>\s*<td>(.*)</td>\s*</tr>"
substrings = matchall(pattern, html)
@zonble
zonble / axe3.jl
Created February 24, 2014 16:36
斧頭幫第三關 Julia 版本
using HTTPClient.HTTPC
lines=String[]
cookie=""
url="http://axe-level-1.herokuapp.com/lv3/"
for index = [1:76]
if index == 1
r=HTTPC.get(url)
received_cookie=r.headers["Set-Cookie"]
#import <Foundation/Foundation.h>
@interface NSNull (NullValues)
- (BOOL)boolValue;
- (char)charValue;
- (double)doubleValue;
- (float)floatValue;
- (int)intValue;
- (NSInteger)integerValue;
@zonble
zonble / CampaignFinance.html
Last active August 29, 2015 14:00
政治獻金 API Reader
<!DOCTYPE html>
<html ng-app>
<head>
<meta charset="utf-8">
<title>政治獻金 API Reader</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.14/angular.min.js"></script>
<script src="CampaignFinance.js"></script>
<style> @import url("css.css"); </style>
</head>
<body>
@zonble
zonble / cal.css
Last active August 29, 2015 14:00
body {
font-family: sans-serif;
}
table {
margin: 10px;
padding: 10px;
border: 1px solid #CCC;
}