This file contains hidden or 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
| ;mapdb.clj | |
| (ns db.mapdb | |
| (:use | |
| [clojure.contrib.duck-streams :only (reader)] | |
| [clojure.java.io :only (writer)] | |
| [clojure.string :only (split)] | |
| [clojure.contrib.server-socket :only (create-server close-server)])) | |
| (def database-file "/Users/hideshi/Dev/Clojure/db/dbfile") |
This file contains hidden or 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
| abstract sealed class Bulletin | |
| case class SigmetBulletin ( | |
| header:Header | |
| ,firstLine:FirstLine | |
| ,mainBody:MainBody | |
| ) extends Bulletin | |
| case class Header( | |
| identificationMessage:String = "" |
This file contains hidden or 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 scala.util.parsing.combinator.RegexParsers | |
| abstract class Bulletin | |
| case class MetarBulletin ( | |
| icao:String | |
| ,datetime:String | |
| ,windDirection:String | |
| ,windSpeed:String | |
| ,windShift:String |
This file contains hidden or 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
| sealed abstract class AVLTree[A <% Ordered[A]] { | |
| def +(v:A):AVLTree[A] | |
| def -(v:A):AVLTree[A] | |
| def reconstruct:AVLTree[A] | |
| def depth:Int | |
| def contains(v:A):Boolean | |
| def size:Int | |
| def isEmpty:Boolean | |
| def nonEmpty:Boolean | |
| def toList:List[A] |
This file contains hidden or 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 scala.sys.process._ | |
| import scala.io.Source._ | |
| def in:List[String] = scala.io.Source.stdin.getLines.toList | |
| implicit def pathToFileReader(path:String) = new FileReader(path) | |
| class FileReader(path:String) { | |
| def getLines():List[String] = { | |
| try { |
This file contains hidden or 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 sys | |
| if __name__ == '__main__': | |
| with open(sys.argv[1]) as infile: | |
| with open(sys.argv[2], 'w') as outfile: | |
| for line in infile.readlines(): | |
| outfile.write(line.lstrip()) |
This file contains hidden or 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/awk -f | |
| BEGIN { | |
| db = "test.db" | |
| command = "sqlite3 -noheader -separator \" \" " db " \" %s \"" | |
| create_table = "create table employee (id, name, age)" | |
| insert1 = "insert into employee values (1, 'taro', 20)" | |
| insert2 = "insert into employee values (2, 'hanako', 18)" | |
| insert3 = "insert into employee values (3, 'ichiro', 26)" | |
| select = "select * from employee order by age" | |
| drop_table = "drop table employee" |
This file contains hidden or 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
| "This sets plugins directory. | |
| set runtimepath+=~/.vim/vimdoc-ja | |
| "This sets default help languages. | |
| set helplang=ja,en | |
| "This enables you to use syntax highlight. | |
| syntax on | |
| "This enables you to use pliugins. |
This file contains hidden or 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
| from bottle import view, route, get, post, request, redirect, template, run | |
| @route('/') | |
| @view('index') | |
| def index(): | |
| return dict() | |
| @route('/hello/<name>') | |
| def index(name='World'): | |
| return template('Hello {{name}}!', name=name) |
This file contains hidden or 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
| with open("file.csv", "r") as f: | |
| for line in f.readlines(): | |
| for col in line.strip().split(","): | |
| print(col.split(":")) | |