Skip to content

Instantly share code, notes, and snippets.

View odiak's full-sized avatar

Kaido Iwamoto odiak

View GitHub Profile

コンパイル前

package net.odiak.kotlin_coroutines_experiment

import kotlinx.coroutines.*

suspend fun s1(): Int {
    println("hello")
    delay(1000L)
sudo apt install -y build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev libffi-dev liblzma-dev python-openssl git
curl https://pyenv.run | bash
cat <<'EOS' >> $HOME/.bashrc
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
#!/usr/bin/env python3
from subprocess import check_output, check_call
from datetime import datetime
import sys
from pathlib import Path
def main() -> None:
datetime_file = Path.home() / 'last-active-timestamp'
pause_file = Path.home() / 'pause-auto-shutdown'
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
#!/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
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
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)
'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'
use strict;
use warnings;
use 5.010;
use DBIx::MyParsePP;
my %TYPES = (
DECIMAL_SYM => 3,
INT_SYM => 4,
BIGINT => 4,
SMALLINT => 4,
@odiak
odiak / build.gradle
Created July 12, 2017 13:31
for ktor
buildscript {
ext.kotlin_version = '1.1.0'
repositories {
jcenter()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}