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 Data.Monoid | |
import Blaze.ByteString.Builder | |
import Blaze.ByteString.Builder.Char.Utf8 | |
import qualified Data.ByteString.Char8 as BSC | |
main = do | |
let end = 50000 | |
-- print $ foldl1 (++) (map show [1..end]) -- too much slow | |
print $ length $ BSC.unpack $ toByteString $ foldl1 mappend $ map fromString $ (map show) [1..end] | |
print $ length $ BSC.unpack $ foldl1 mappend $ map BSC.pack $ Prelude.map show [1..end] -- slow |
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
# -*- coding: utf-8 -*- | |
from xcb import xcb | |
from xcb import xproto | |
r = [ 20, 20, 60, 60 ] | |
title = "test" | |
c = xcb.connect() | |
s = c.get_setup().roots[0] | |
g = c.generate_id() |
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 Debug.Trace | |
import Control.Monad.State | |
import Text.Parsec | |
import Data.Char | |
import Control.Monad.Trans | |
import Control.Applicative hiding((<|>),many,optional) | |
-- trace s f = f | |
-- ref. RFC5322 and RFC5234 |
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/perl | |
# | |
use strict; | |
use Encode qw(decode encode from_to); | |
use Data::Dumper; | |
open IN, 'euc.txt'; | |
while(<IN>){ | |
my $euc = $_; | |
my $string = decode('euc-jp', $euc); |
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/perl | |
use strict; | |
use HTML::TableExtract; | |
use Data::Dumper; | |
my $html = "<table>" . | |
"<tr><td>" . | |
"<table><tr><td>1</td><td>a</td></tr><tr>". | |
"<td>2</td><td>B</td></tr></table>" . | |
"</td></tr>" . |
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 Data.Lens.Common | |
data Hoge = Hoge { | |
x :: Int, | |
y :: Int, | |
z :: Int | |
} deriving(Show) | |
getX = x | |
getY = y |
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/python3 | |
data = [(2,3), (4,7), (1,1), (3,8)] | |
q_max = 8 | |
# wrong: p = [[0] * (q_max+1)] * (len(data) + 1) | |
p = [[0 for j in range(q_max+1)] for i in range(len(data)+1)] | |
ps = [[None for j in range(q_max+1)] for i in range(len(data)+1)] |
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
\documentclass{jsarticle} | |
\usepackage{ifthen} | |
\pagestyle{empty} | |
\addtolength{\textwidth}{15mm} | |
\setlength{\oddsidemargin}{-15mm} | |
\setlength{\topmargin}{-30mm} | |
\addtolength{\textheight}{55mm} |
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
package org.media_as.takaki.jfshogiban.gui; | |
import javafx.application.Application; | |
import javafx.application.Platform; | |
import javafx.concurrent.Service; | |
import javafx.concurrent.Task; | |
import javafx.event.EventHandler; | |
import javafx.scene.Scene; | |
import javafx.scene.control.Button; | |
import javafx.scene.input.MouseEvent; |
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
package org.example.javalabo; | |
import com.google.gson.GsonBuilder; | |
import com.google.gson.JsonParser; | |
public class GsonJsonPP { | |
public static void main(String[] args) { | |
System.out.println(new GsonBuilder().setPrettyPrinting().create() | |
.toJson(new JsonParser() | |
.parse("{\"aaa\":0, \"bbb\": [\"ddd\", \"eee\"], \"fff\":{\"ggg\":\"hhh\"}}"))); |