Skip to content

Instantly share code, notes, and snippets.

@kozy4324
kozy4324 / seed.sh
Last active February 22, 2017 03:56
freeCodeCampをdocker-composeで動かす
# データベースへロード
docker exec $(docker ps -f name=freecodecamp_server_1 -q) node seed
@kozy4324
kozy4324 / index.html
Last active November 4, 2016 06:15
FOSS4G 2016 Tokyo hands-on
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title></title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.26.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.26.0/mapbox-gl.css' rel='stylesheet' />
<link href='https://www.mapbox.com/base/latest/base.css' rel='stylesheet' />
<style>
@kozy4324
kozy4324 / format_xml.rb
Created May 1, 2015 07:24
Format xml in ruby
require 'rexml/document'
require 'stringio'
def format xml_str
output = StringIO.new
REXML::Formatters::Pretty.new.write(REXML::Document.new(xml_str), output)
output.string
end
puts format '<a><b>afasdlkfj</b></a>'
@kozy4324
kozy4324 / response_writer_wrapper.rb
Created March 2, 2015 02:43
[JRuby][Solr] BinaryResponseWriterで書き出したものをRackサーバーで返す
java_import Java::java.io.ByteArrayOutputStream
java_import Java::java.io.OutputStreamWriter
java_import Java::java.util.HashMap
java_import Java::org.apache.solr.common.SolrDocument
java_import Java::org.apache.solr.common.SolrDocumentList
java_import Java::org.apache.solr.common.params.SolrParams
java_import Java::org.apache.solr.common.util.NamedList
java_import Java::org.apache.solr.request.SolrQueryRequestBase
java_import Java::org.apache.solr.response.SolrQueryResponse
java_import Java::org.apache.solr.response.XMLResponseWriter
@kozy4324
kozy4324 / a.rb
Created February 27, 2015 10:26
[Solr] ResponseWriterで書き込んでみるJRuby版
java_import Java::java.io.ByteArrayOutputStream
java_import Java::java.io.OutputStreamWriter
java_import Java::java.util.HashMap
java_import Java::org.apache.solr.common.SolrDocument
java_import Java::org.apache.solr.common.SolrDocumentList
java_import Java::org.apache.solr.common.params.SolrParams
java_import Java::org.apache.solr.common.util.NamedList
java_import Java::org.apache.solr.request.SolrQueryRequestBase
java_import Java::org.apache.solr.response.SolrQueryResponse
java_import Java::org.apache.solr.response.XMLResponseWriter
@kozy4324
kozy4324 / App.java
Last active August 29, 2015 14:16
[Solr] ResponseWriterで書き込んでみる
package test;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@kozy4324
kozy4324 / a.txt
Last active August 29, 2015 14:06
2014/09/12のc-proxy-01のログ。 左から、件数、IPアドレス、リファラ、UA。
90 "117.55.68.170", "http://www.mapion.co.jp/", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36"
3 "210.168.26.13", "-", "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0)"
3 "210.128.246.2", "http://www.mapion.co.jp/", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.103 Safari/537.36"
2 "219.166.180.40", "-", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; Tablet PC 2.0)"
2 "202.234.160.153", "-", "Mozilla/5.0 (Windows; U; Windows NT 5.1; ja; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1"
2 "117.55.68.170", "-", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36"
1 "72.14.199.24", "-", "Mediapartners-Google"
1 "66.220.156.115", "-", "facebookexternalhit/1.1 (+http://www.facebook.com/extern
@kozy4324
kozy4324 / connect-qunit.coffee
Created September 12, 2014 10:29
CoffeeScriptコンパイルと依存関係解決をしながらQUnit実行HTMLを出力するサーバーのGruntタスク
module.exports = (grunt) ->
grunt.registerTask 'connect_qunit', 'QUnit実行HTML配信サーバーを起動(CoffeeScriptコンパイル含む)', ->
options = @options
port: 0xBEEF
hostname: 'localhost'
base: '.'
urlNameSpace: 'qunit'
testDir: 'js_test'
srcDir: 'js'
includeLibs: []
@kozy4324
kozy4324 / Gruntfile.coffee
Last active August 29, 2015 14:06
git log --statで出力されるInsertion(s)とDeletion(s)でグラフ表示
module.exports = (grunt) ->
grunt.initConfig
connect:
server:
options:
port: 0xBEEF
hostname: "localhost"
keepalive: true
processMaxBuffer: 512*1024
graphMaxY: 1000000
@kozy4324
kozy4324 / capture.js
Last active January 2, 2016 13:59
capture script for phantomjs
if (phantom.args.length == 0) {
phantom.exit();
}
var i = 0, ua, url, clipRect = null, file, wait_ms;
if (!phantom.args[i].match(/^https?:\/\//)) {
ua = phantom.args[i++];
}
url = phantom.args[i++];
file = phantom.args[i++];