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
| from typing import Tuple | |
| import numpy as np | |
| def n_union_and_intersection(a: np.ndarray, b: np.ndarray) -> Tuple[int, int]: | |
| na = len(a) | |
| nb = len(b) | |
| ia = 0 | |
| ib = 0 |
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
| #!/bin/bash | |
| TIMESTAMP_FILE="/tmp/auto-stop-timestamp" | |
| if [ $(who | wc -l) -gt 0 ]; then | |
| rm -f $TIMESTAMP_FILE | |
| else | |
| now=$(date "+%s") | |
| if [ -f "$TIMESTAMP_FILE" ]; then | |
| echo $now > $TIMESTAMP_FILE |
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 numpy as np | |
| from dataclasses import dataclass | |
| @dataclass(frozen=True) | |
| class Adam: | |
| learning_rate: float = 1.0 | |
| eps: float = 1e-8 | |
| rho1: float = 0.9 | |
| rho2: float = 0.999 |
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
| function f1(...args: number[] & {0: any}) { | |
| } | |
| f1() // type error! | |
| f1(1) | |
| f1(1, 2, 3) | |
| const a1: number[] = [1, 2, 3] | |
| const a2: number[] = [] | |
| f1(...a1) // type error! (unexpected) |
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
| 'atom-text-editor': | |
| 'ctrl-t': 'fuzzy-finder:toggle-file-finder' | |
| 'atom-text-editor.vim-mode-plus.insert-mode': | |
| 'ctrl-h': 'core:backspace' | |
| # 'atom-text-editor.vim-mode-plus.insert-mode.autocomplete-active': | |
| # 'escape': 'autocomplete-plus:cancel' | |
| 'body atom-text-editor.autocomplete-active': | |
| 'up': 'autocomplete-plus:move-up' | |
| 'down': 'autocomplete-plus:move-down' | |
| 'ctrl-p': 'autocomplete-plus:move-up' |
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
| use strict; | |
| use warnings; | |
| use 5.010; | |
| use DBIx::MyParsePP; | |
| my %TYPES = ( | |
| DECIMAL_SYM => 3, | |
| INT_SYM => 4, | |
| BIGINT => 4, | |
| SMALLINT => 4, |
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
| buildscript { | |
| ext.kotlin_version = '1.1.0' | |
| repositories { | |
| jcenter() | |
| } | |
| dependencies { | |
| classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" | |
| } | |
| } |
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 kotlin.reflect.KClass | |
| import kotlin.reflect.full.memberProperties | |
| open class A { | |
| val a = "xxxx" | |
| var b = 12 | |
| } | |
| class B : A() { | |
| val c: String? = null |
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
| sealed class Either<out L, out R> { | |
| class Left<out T>(val value: T) : Either<T, Nothing>() { | |
| override fun equals(other: Any?): Boolean = | |
| other is Left<*> && other.value == value | |
| override fun hashCode(): Int = value?.hashCode() ?: 0 | |
| override fun toString(): String = "Left($value)" | |
| } |
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
| open class A { | |
| init { | |
| doSomething() | |
| } | |
| open fun doSomething() { | |
| } | |
| } | |
| class B : A() { |