This file contains 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
let segment = (text) => { | |
let it = Intl.v8BreakIterator('ja'); | |
it.adoptText(text); | |
let result = []; | |
let curr, next; | |
while (true) { | |
curr = it.current(); | |
next = it.next(); | |
if (next == -1) break; | |
result.push(text.slice(curr, next)); |
This file contains 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
# coding: utf-8 | |
import random | |
stroke_width = 4 | |
radius = 10 | |
glyphs = { | |
'd': f'<circle cx="{radius}" cy="{radius}" r="{radius}" /><line x1="{radius*2}" y1="{radius}" x2="{radius*2}" y2="{-radius * 0.6}" />', | |
'o': f'<circle cx="{radius}" cy="{radius}" r="{radius}" />', | |
'g': f'<circle cx="{radius}" cy="{radius}" r="{radius}" /><path d="M {radius*2} {radius} C {radius*2} {radius*2}, {radius*2} {radius*2.8}, {radius} {radius*2.8}" />', |
This file contains 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
# coding: utf-8 | |
# | |
# Simulation program for unplugged neural network model. | |
# Reference: | |
# https://www.1101.com/morikawa/2001-03-12.html | |
# https://www.1101.com/morikawa/2001-04-02.html | |
import itertools | |
import random | |
import numpy as np |
This file contains 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
# coding: utf-8 | |
# Dynamic programing: knapsack problem. | |
# Rewrote the program in the webpage below in Python. | |
# 動的計画法(ナップサック問題) | |
# 下記のサイトのコードを Python にて書き直した。 | |
# reference: http://dai1741.github.io/maximum-algo-2012/docs/dynamic-programming/ | |
VALUES = [15, 3, 1, 8, 2, 4] | |
WEIGHTS = [11, 2, 3, 5, 1, 4] | |
MAX_WEIGHT = 15 |
This file contains 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
const CDP = require('chrome-remote-interface'); | |
const chromeLauncher = require('lighthouse/chrome-launcher/chrome-launcher'); | |
function onPageLoad(Runtime) { | |
const js = "document.querySelector('title').textContent"; | |
return Runtime.evaluate({expression: js}).then(result => { | |
console.log('Title of page: ' + result.result.value); | |
}); | |
} |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder