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
| synchronized def print(String str) { | |
| System.out.print str | |
| } | |
| def bootServer() { | |
| def server = new ServerSocket(8080) | |
| Thread.start { | |
| while (true) { | |
| def soc | |
| try { soc = server.accept() } | |
| catch (SocketException e) { println "[server] SocketError: $e.message"; break } |
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
| new Socket('example.com', 80).withStreams { is, os -> | |
| def req = 'GET / HTTP/1.1\r\nHost: example.com\r\n\r\n' | |
| println "[[$req]]" | |
| os << req.getBytes('utf-8') | |
| System.out << is // blocking | |
| } |
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
| @echo off | |
| pushd %~dp0 | |
| powershell -Command "& {ls | where {$_.name.endswith('-orig')} | %%{$to = ($_.name -replace '-orig',''); echo "rename` $_` $to"; Rename-Item $_.name $to} }" | |
| popd |
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
| @Grab(group='org.apache.commons', module='commons-lang3', version='3.4') | |
| String a = '\\u003cb\\u003e' | |
| println a | |
| println org.apache.commons.lang3.StringEscapeUtils.unescapeJava(a) | |
| // Outputs: | |
| // \u003cb\u003e | |
| // <b> |
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
| " License: MIT | |
| " (c) 2015 am4dr <t.f.octo@gmail.com> | |
| if exists('g:loaded_syntastic_groovy_groovyc_checker') | |
| finish | |
| endif | |
| let g:loaded_syntastic_groovy_groovyc_checker = 1 | |
| let s:save_cpo = &cpo | |
| set cpo&vim |
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
| @Grab(group='org.processing', module='core', version='2.2.1') | |
| import processing.core.* | |
| class MySketch extends PApplet { | |
| final float r = 200 | |
| final int FPS = 60 | |
| final float sec = 1 | |
| final float radpf = 2*PI / sec / FPS | |
| void setup() { | |
| frameRate(FPS) |
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.nio.file.Path | |
| import java.nio.file.Paths | |
| def p = Paths.get('aaa', 'bbb', 'ccc').resolve('xxx/yyy/zzz/') | |
| assert p as String == /aaa\bbb\ccc\xxx\yyy\zzz/ | |
| import java.util.stream.* | |
| def pathToString(Path path, String separator = '/', boolean startsWithSeparator = false) { | |
| StreamSupport.stream(path.spliterator(), false) | |
| .map{ it.toString() } |
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
| <!doctype html> | |
| <html lang="ja"> | |
| <head> | |
| <title>power!</title> | |
| </head> | |
| <body> | |
| <svg width="600" height="200"> | |
| <defs> | |
| <symbol id="rrr" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" | |
| width="100" height="100"> |
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
| " usage | |
| " 1. acrobat readerで全文選択コピー | |
| " 2. バッファに貼り付け | |
| " 3. :source sc.vim | |
| " TODO | |
| " - markを上手に使って全体的にもう少しきれいに書けそう? | |
| " - `^##`にマッチしない行で条件に合う行を全部結合したい処理をきれいに。 | |
| " Contentsをaとしてマーク | |
| g/^Contents$/normal ma |
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
| javascript:var e=document.createElement('input');e.type='text';e.value="["+document.title+"]"+"("+document.URL+")";document.body.appendChild(e);e.select();document.execCommand('copy');document.body.removeChild(e);void(0); |
NewerOlder