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
#!/bin/bash | |
# | |
# use | |
# watch ./top.sh | |
# | |
OUT="/tmp/topdata" | |
echo "---- cpu ----" >> $OUT |
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
// 名前付きパラメータに対応 | |
get("/${user}/${id}.html"){env => | |
import env._ | |
template( | |
<h1>ブログなんだよもん</h1> | |
<p> | |
<a href="new.html">投稿</a> | |
</p> | |
<p>name :{params("user")}</p> | |
<p>id :{params("id")}</p> |
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 java.io.File; | |
import java.io.FileInputStream; | |
import java.io.FileNotFoundException; | |
public class ExceptionSample { | |
public void f(){ | |
try{ | |
new FileInputStream(new File("")); | |
}catch (FileNotFoundException e) { |
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
set nocompatible | |
filetype plugin indent on | |
syntax enable | |
set backspace=eol,indent,start | |
set smartcase | |
noremap ; : | |
noremap : ; |
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
object ExploringCaves extends Application { | |
class Vector(var x:Int, var y:Int){ def r = x*x + y*y} | |
def solv(logs:List[(Int, Int)]) = { | |
var m = new Vector(0, 0); | |
var c = new Vector(0, 0); | |
def f(dx:Int, dy:Int){ | |
c.x += dx | |
c.y += dy | |
if((c.r > m.r) || ((c.r == m.r) && (c.x > m.x))){ | |
m.x = c.x |
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
public class FactorySample { | |
static class Hoge{ | |
public Hoge() { | |
System.out.println("Hello wold"); | |
} | |
} | |
static <T> T as( Object o ) { | |
return (T) o; | |
} | |
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
//パターン1 hoge, foo, barのテストをいい感じに書けない! | |
class A{ | |
public run(){ | |
return hoge(foo(bar)) | |
} | |
private hoge(String s) ... | |
private foo(String s) ... | |
private bar(String s) ... | |
} |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>ブログなんだよもん</title> | |
</head> | |
<body> | |
<header> | |
<h1>ブログなんだよもん</h1> |
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 java.io._ | |
import scala.xml._ | |
def tag2html(text:String) = text.replaceAll("<link caption=\"(.*?)\".*?>(.*?)</link>", "<a href='$2'>$1</a>").replaceAll("<link>(.*?)</link>", "<a href='$1'>$1</a>").replaceAll("<p>(.*?)</p>", "<pre>$1</pre>").replaceAll("<p>(.*?)</p>", "<pre>$1</pre>"); | |
val blog_data = scala.xml.XML.loadFile(new File("/mnt/share/documents/blog.txt")) | |
val article = (blog_data \ "document") toList(3) | |
article \ "@id" |
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
/* | |
* 作りかけ | |
*/ | |
function f(i){ | |
var us = document.location.toString().split("/"); | |
us.pop(); | |
var url = us.join('/'); | |
return (url + '/books/images/1.4585/' + i + '.jpg'); | |
} |