Skip to content

Instantly share code, notes, and snippets.

#!perl
# 読み飛ばす
while (<>) {
last if /<div class="horseList">/;
}
# テーブルをばらす
while (<>) {
if (/<h4 class="name">/) {
@moccos
moccos / co2mini_mackerel.py
Created April 25, 2020 06:25
Co2Mini -> mackerel format (TSV)
#python3
import time
import CO2Meter
sensor = CO2Meter.CO2Meter("/dev/hidraw0")
_LIMIT = 10
def get_sensor():
co2 = None
package main
import (
"fmt"
"sync"
)
type Fetcher interface {
// Fetch returns the body of URL and
// a slice of URLs found on that page.
@moccos
moccos / exercise-equivalent-binary-trees.go
Created April 13, 2019 06:24
A Tour of Go Exercise: Equivalent Binary Trees https://tour.golang.org/concurrency/8
package main
import (
"fmt"
"golang.org/x/tour/tree"
)
// Walk walks the tree t sending all values
// from the tree to the channel ch.
func Walk(t *tree.Tree, ch chan int) {
@moccos
moccos / gist:77a9673321879db1eef78a959c214921
Created January 18, 2017 02:53
なんの情報も出さず死ぬtd-agent、つらみ
2017-01-18 11:52:06 +0900 [info]: reading config file path="/etc/td-agent/td-agent.conf"
2017-01-18 11:52:06 +0900 [info]: starting fluentd-0.12.31
2017-01-18 11:52:06 +0900 [info]: gem 'fluent-mixin-config-placeholders' version '0.4.0'
2017-01-18 11:52:06 +0900 [info]: gem 'fluent-mixin-plaintextformatter' version '0.2.6'
2017-01-18 11:52:06 +0900 [info]: gem 'fluent-plugin-kafka' version '0.5.0'
2017-01-18 11:52:06 +0900 [info]: gem 'fluent-plugin-kafka' version '0.4.1'
2017-01-18 11:52:06 +0900 [info]: gem 'fluent-plugin-mongo' version '0.7.16'
2017-01-18 11:52:06 +0900 [info]: gem 'fluent-plugin-rewrite-tag-filter' version '1.5.5'
2017-01-18 11:52:06 +0900 [info]: gem 'fluent-plugin-s3' version '0.8.0'
2017-01-18 11:52:06 +0900 [info]: gem 'fluent-plugin-scribe' version '0.10.14'
@moccos
moccos / ambari-metrics-collector.log
Created November 21, 2016 07:09
HDP-2.4.3.0-227
2016-11-21 15:53:47,377 WARN org.apache.hadoop.yarn.webapp.GenericExceptionHandler: INTERNAL_SERVER_ERROR
java.lang.RuntimeException: java.io.IOException: maxStamp is smaller than minStamp
at org.apache.phoenix.execute.BaseQueryPlan.iterator(BaseQueryPlan.java:205)
at org.apache.phoenix.execute.BaseQueryPlan.iterator(BaseQueryPlan.java:161)
at org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:253)
at org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:243)
at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
at org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:242)
at org.apache.phoenix.jdbc.PhoenixPreparedStatement.executeQuery(PhoenixPreparedStatement.java:186)
at org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.PhoenixHBaseAccessor.getAggregateMetricRecords(PhoenixHBaseAccessor.java:633)
f1 = fn x ->
IO.puts(" #{x} -> #{x + 1}")
x + 1
end
list = [10, 20]
list
|> Enum.map(&(f1.(&1)))
|> Enum.map(&(f1.(&1)))
defmodule Hoge do
@flag false
defmacro ifa(a, exp) do
if (Macro.expand_once(a, __CALLER__)), do: exp
end
def main do
if (@flag), do: IO.puts 123
ifa (@flag), do: IO.puts 456
end
lazy val codeGenTask2 = TaskKey[Unit]("hoge", "description")
codeGenTask2 := {
import scalikejdbc.mapper.SbtKeys._
scalikejdbcCodeGeneratorAll.in(Compile).value.apply(scalikejdbcJDBCSettings.in(Compile).value, scalikejdbcGeneratorSettings.in(Compile).value).foreach { g =>
g.writeModel()
// g.writeSpec(g.specAll())
}
}
compile in Compile <<= (compile in Compile).dependsOn(codeGenTask2)
@moccos
moccos / scalikejdbc_build.sbt
Last active August 29, 2015 14:26
run scalikejdbcGenAllForce before compile
lazy val removeTestTask = TaskKey[Unit]("removeTest", "Deletes scalikeJDBC test file")
removeTestTask := {
println("remove test files.")
sbt.IO.delete(new File("src/test/scala/path/to/generated/code"))
}
compile in Compile <<= (compile in Compile).dependsOn(removeTestTask)
scalikejdbcSettings
compile in Compile <<= (compile in Compile).dependsOn(scalikejdbc.mapper.SbtKeys.scalikejdbcGenAllForce.in(Compile).toTask(""))