This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import System.Directory | |
import Data.List | |
forRemove :: (String, String) -> Bool | |
forRemove (_, ".") = False | |
forRemove (_, "..") = False | |
forRemove (_, ".hs") = False | |
forRemove (_, ".git") = False | |
forRemove ("cleanup", _) = False | |
forRemove _ = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Codec.Binary.UTF8.String | |
import Codec.Text.IConv | |
import Data.List | |
import Text.XML.HXT.Core | |
import qualified Data.ByteString.Lazy as BSL | |
main = do | |
cs <- BSL.readFile "4731398C.html" | |
let u8s = convert "CP932" "UTF-8" cs | |
let html = decode (BSL.unpack u8s) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import urllib2 | |
proxy_handler = urllib2.ProxyHandler({'https': 'http://localhost:8888/'}) | |
opener = urllib2.build_opener(proxy_handler) | |
print opener.open("https://www.google.com/").read() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> | |
<fontconfig> | |
<match target="pattern"> | |
<test qual="any" name="family"> | |
<string>Ryumin</string> | |
</test> | |
<edit name="family" mode="prepend" binding="strong"> | |
<string>IPAMincho</string> | |
</edit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from lxml import etree | |
import gzip | |
tree = etree.parse(gzip.open('personal.gnucash')) | |
root = tree.getroot() | |
for i in tree.xpath('//gnc:GncInvoice[invoice:id[text()="000003"]]',namespaces=root.nsmap): | |
print(i.tag) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import locale | |
locale.setlocale(locale.LC_ALL,'') | |
locale.format_string("%d円", 12345, True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Codec.Binary.UTF8.String | |
import Codec.Text.IConv | |
import Data.List | |
import Text.XML.HXT.Core | |
import qualified Data.ByteString.Lazy as BSL | |
import Text.XML.HXT.XPath.Arrows | |
-- 日本語 | |
main = do | |
cs <- BSL.readFile "4731398C.html" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Control.Monad | |
import Data.List | |
import Data.Maybe | |
data Country = Japan | Jordan | Australia | Oman | Iraq deriving (Eq,Show) | |
countries = [Japan, Jordan , Australia, Oman, Iraq] | |
countryPriority :: Country -> Int | |
countryPriority x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from lxml import etree | |
tree = etree.parse(open('database.xml')) | |
blogs = tree.xpath('//row[user_id=5]') | |
for b in blogs: | |
print b.find('blog_id').text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from lxml import etree | |
tree = etree.HTML(open('a.html').read()) | |
# //*[@id="companyTopData"]/div[2]/table/tbody/tr[1]/td | |
inv = tree.xpath('//*[@id="companyTopData"]/div[2]/table/tr[1]/td') | |
for i in inv: | |
print(i.text) |
OlderNewer