Skip to content

Instantly share code, notes, and snippets.

function taskA(i: number) {
return new Promise<number>((resolve, reject) => {
if (i % 2 == 0) reject(`error on taskA ${i}`)
resolve(i)
})
}
function taskB(i: number) {
return new Promise<number>((resolve, reject) => {
if (i % 3 == 0) reject(`error on taskB ${i}`)
resolve(i)
cd sandbox
ls
cd sandbox
ls
CREATE TABLE submissions (
id BIGINT NOT NULL,
epoch_second BIGINT NOT NULL,
problem_id VARCHAR(255) NOT NULL,
contest_id VARCHAR(255) NOT NULL,
user_id BIGINT NOT NULL, -- 数値化
language VARCHAR(255) NOT NULL,
point DOUBLE PRECISION NOT NULL,
length INT NOT NULL,
result VARCHAR(255) NOT NULL,
<template>
<div ref="stage"></div>
</template>
<script>
import * as THREE from 'three';
import Stats from 'stats.js';
import DataPoint from '@/lib/DataPoint';
import Axis from '@/lib/Axis';
<template>
<div>
<div>
<button
v-for="(_, i) in 17"
:key="i"
@click="needles.push(i)">
{{ i }}
</button>
</div>
syntax = "proto3";
package image_dataset;
message Image {
uint32 width = 1;
uint32 height = 2;
bytes data = 3;
string mode = 4;
}
This file has been truncated, but you can view the full file.
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <tuple>
#include <set>
#include <stack>
#include <queue>
def make_mask(lens, mask_shape):
mask = np.ones(mask_shape).astype('uint8')
for i, l in enumerate(lens):
mask[i, :l] = 0
return mask
batch_size = 2
seq_len = 4
lens = np.array([2, 3])
@odanado
odanado / colorize_text.py
Created November 21, 2017 13:20 — forked from ihsgnef/colorize_text.py
Visualize attention over text with background colors
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
def colorize(words, color_array):
# words is a list of words
# color_array is an array of numbers between 0 and 1 of length equal to words
cmap = matplotlib.cm.get_cmap('RdBu')
template = '<span class="barcode"; style="color: black; background-color: {}">{}</span>'
colored_string = ''