System: Debian/Ubuntu/Fedora. Might work for others as well.
As mentioned here, to update a go version you will first need to uninstall the original version.
To uninstall, delete the /usr/local/go directory by:
| import { z } from 'zod' | |
| // 文字列のスキーマの作成 | |
| const stringScheme = z.string() | |
| export const userRegistrationSchema = z.object({ | |
| username: z.string(), | |
| email: z.string().email(), | |
| password: z.string().min(8), | |
| }); |
| import gzip | |
| def gzip_search(query: str, candidate_chunks: object, top_k: int=1): | |
| """ | |
| 文字列ベースで類似したテキストチャンクを推定するアルゴリズム. | |
| `query`, `chunk`, および`query + " " + chunk`をそれぞれgzipで圧縮し、編集距離のようなものをベースに評価する. | |
| Parameters: | |
| query (str): 検索クエリとして使用する文字列. | |
| top_k (int, optional): 返される類似チャンクの上位k個を指定する (default: 1). |
| require 'minitest/autorun' | |
| require './lib/receipe_explore' | |
| MiniTest.autorun | |
| class TestReceipeExplore < Minitest::Test | |
| def setup | |
| @recipe_explore = RecipeExplorer.new('./receipe.tsv') | |
| end | |
| def test_search_keyword |
| { | |
| "Statement": [ | |
| { | |
| "Action": [ | |
| "apigateway:*", | |
| "cloudformation:CancelUpdateStack", | |
| "cloudformation:ContinueUpdateRollback", | |
| "cloudformation:CreateChangeSet", | |
| "cloudformation:CreateStack", | |
| "cloudformation:CreateUploadBucket", |
System: Debian/Ubuntu/Fedora. Might work for others as well.
As mentioned here, to update a go version you will first need to uninstall the original version.
To uninstall, delete the /usr/local/go directory by:
| from enum import Enum | |
| class MyEnum(Enum): | |
| RED = 'red' | |
| print(MyEnum('red') == MyEnum.RED) | |
| # => True | |
| go func() { | |
| for { | |
| err = rmq.Stream(cancelCtx) | |
| if errors.Is(err, rabbitmq.ErrDisconnected) { | |
| continue | |
| } | |
| break | |
| } | |
| }() |
| function parseUrl(url){ | |
| if (!typeof(url) == 'string'){ | |
| throw Error(`Unexpected input type, expected string but got ${typeof(url)}`) | |
| } | |
| let re = /^(https:\/\/www\.amazon\.co\.jp\/).*(dp|gp\/)(.*\/)/g; | |
| const resultArray = [...url.matchAll(re)]; | |
| let urlStr; | |
| try{ | |
| urlStr = resultArray[0][1]+resultArray[0][2]+resultArray[0][3]; | |
| return urlStr; |
| //https://www.techiedelight.com/convert-inputstream-byte-array-java/ | |
| private static byte[] toByteArray(InputStream in) throws IOException{ | |
| ByteArrayOutputStream os = new ByteArrayOutputStream(); | |
| byte[] buffer = new byte[1024]; | |
| int len; | |
| //Reads up to len bytes of data from the input stream into an array of bytes. | |
| //Check: https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html#read-byte:A- | |
| while((len = in.read(buffer)) != -1){ | |
| //指定されたバイト配列のオフセット位置offから始まるlenバイトをこのバイト配列出力ストリームに書き込みます。 | |
| os.write(buffer, 0, len); |