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
| export interface Root { | |
| queryStats: QueryStats | |
| memoryStats: MemoryStats | |
| queryTimeStats: QueryTimeStats | |
| statementCounters: StatementCounters | |
| transactionCounters: TransactionCounters | |
| concurrentExecutionStats: ConcurrentExecutionStats | |
| queryBatchStats: QueryBatchStats | |
| storageCounters: StorageCounters | |
| } |
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
| # %% [markdown] | |
| # # Neptune Slow Query Log Analysis | |
| # %% | |
| log_file_name = "slowquery.txt" | |
| # %% | |
| import json | |
| def read_file_lines(filename): |
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
| package dtos | |
| import play.api.libs.json.{Format, Json} | |
| case class ITableRow( | |
| cols: Seq[String] | |
| ) | |
| object ITableRow { | |
| implicit val jsonFormatter: Format[ITableRow] = Format(Json.reads[ITableRow], Json.writes[ITableRow]) |
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
| object DoubleReads { | |
| def reads(json: JsValue): JsResult[Option[Double]] = json match { | |
| case JsNumber(n) => JsSuccess(Some(n.toDouble)) | |
| case JsString(s) => JsSuccess(Some(s.toDouble)) | |
| case _ => JsSuccess(None) | |
| } | |
| } | |
| // Later in your code where you need | |
| implicit val odr: json.Reads[Option[Double]] = DoubleReads.reads |
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
| private static String dotEncode(long n) { | |
| String s = String.format("%d", n); | |
| if (s.startsWith("-")) { | |
| return ".2" + s.substring(1); | |
| } | |
| return ".1" + s; | |
| } | |
| private static long dotDecode(String s) { | |
| if (s.startsWith("1")) { |
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
| def to_serializable(val): | |
| """ | |
| Allows the JSON serializer to work over datetime data type | |
| :param val: | |
| :return: | |
| """ | |
| if isinstance(val, datetime): | |
| return val.isoformat() + "Z" | |
| vf = type(val).__name__ |
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 os | |
| import os.path | |
| from pathlib import Path | |
| if not Path.exists(Path(image_source_dir)): | |
| raise Exception(f"The source not found: {image_source_dir}. Please correct this in Migrate.py") | |
| index = 0 | |
| previousInfo: ImageInfo = None | |
| for ent in Path(image_source_dir).iterdir(): |
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
| /** | |
| * Combined class and instance inheritance in TypeScript | |
| * This looks deceptively simple, but there are two layers of inheritance that's happening | |
| * One is the Class inheritance. Another is the actual instance inheritance that's chained | |
| * through the children array. The parent has its' instance based factory to generate its | |
| * own children either daughters of sons | |
| */ | |
| class person { | |
| constructor(name, parent = null) { | |
| this.name = name; |
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
| ClassLoader classLoader = getClass().getClassLoader(); | |
| String fn = classLoader.getResource("some-file.txt").getFile(); | |
| String txt = new String(Files.readAllBytes(Paths.get(fn.substring(1)))); // Skips the first / of /c:/ in Windows |
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
| --watch -m commonjs -t es5 --emitDecoratorMetadata --experimentalDecorators |
NewerOlder