-
get yq 3.x from https://github.com/mikefarah/yq/releases
-
get jsonnet (Go) from
go get github.com/google/go-jsonnet/cmd/jsonnet go install github.com/google/go-jsonnet/cmd/jsonnet
| import json | |
| from typing import Dict, List, Any | |
| import sys | |
| if len(sys.argv) != 2: | |
| raise Exception("invalid args") | |
| id = sys.argv[1] | |
| def check(name: str, a: Any, isPrintable: bool = False, path: str = "") -> None: |
| class stopWatch { | |
| private: | |
| decltype(std::chrono::high_resolution_clock::now()) start = std::chrono::high_resolution_clock::now(); | |
| public: | |
| ~stopWatch() { | |
| const auto finish = std::chrono::high_resolution_clock::now(); | |
| const auto durationMilliSeconds = std::chrono::duration_cast<std::chrono::milliseconds>(finish - start).count(); | |
| std::cout << durationMilliSeconds << " ms" << std::endl; | |
| } |
get yq 3.x from https://github.com/mikefarah/yq/releases
get jsonnet (Go) from
go get github.com/google/go-jsonnet/cmd/jsonnet
go install github.com/google/go-jsonnet/cmd/jsonnet
| #include <bits/stdc++.h> | |
| using namespace std; | |
| struct something { | |
| ~something() { | |
| cout << "destructor" << endl; | |
| } | |
| }; | |
| something&& f(something&& s) { |
| package main | |
| import ( | |
| "log" | |
| "math" | |
| "github.com/vmihailenco/msgpack" | |
| ) | |
| func main() { |
| import sqlite3 | |
| import json | |
| conn = sqlite3.connect(':memory:') | |
| c = conn.cursor() | |
| c.execute('''CREATE TABLE stocks | |
| (date text, trans text, symbol text, qty real, price real, json text, id integer primary key AUTOINCREMENT)''') | |
| c.execute( | |
| "INSERT INTO stocks(date, trans, symbol, qty, price, json) VALUES ('2006-01-05','BUY','RHAT',100,35.14,'{\"name\":\"太郎1\"}')") | |
| purchases = [('2006-03-28', 'BUY', 'IBM', 1000, 45.00, '{"name":"太郎2"}'), |
| scala> List(1,2,3).map({println("1");_+1}).map({println("a"); _+1}) | |
| 1 | |
| a | |
| res21: List[Int] = List(3, 4, 5) | |
| scala> List(1,2,3).map({println("1");_+1}).map(a=>{println("a"); a+1}) | |
| 1 | |
| a | |
| a | |
| a |
| #include <fstream> | |
| #include <iostream> | |
| #include <k2hash/k2hash.h> | |
| #include <k2hash/k2hshm.h> | |
| #include <sstream> | |
| using namespace std; | |
| int main() { | |
| K2HShm k; | |
| cout << k.GetSystemPageSize() << endl; |
| scala> import java.nio.ByteBuffer | |
| import java.nio.ByteBuffer | |
| scala> val b = Array(1,2,3,4,5,6,7,8,0,0,0,0).map(_.toByte) | |
| b: Array[Byte] = Array(1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, 0) | |
| scala> b.grouped(4).foldRight(Nil: List[Float])(ByteBuffer.wrap(_).getFloat::_) | |
| res8: List[Float] = List(2.3879393E-38, 6.301941E-36, 0.0) |