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
import apache_beam as beam | |
from apache_beam.testing.test_stream import TestStream | |
from apache_beam.transforms.userstate import CombiningValueStateSpec | |
from apache_beam.transforms.window import TimestampedValue | |
# Stateful DoFn, based on: | |
# - https://beam.apache.org/blog/stateful-processing/ | |
# - https://github.com/apache/beam/blob/30f9a607509940f78459e4fba847617399780246/sdks/python/apache_beam/transforms/userstate_test.py | |
class IndexAssigningStatefulDoFn(beam.DoFn): |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
index | datetime | Pressure | Sea-Level Pressure | Precipitation | Temperature | Relative Humidity | Sunlight Hours | Day/Night | |
---|---|---|---|---|---|---|---|---|---|
0 | 2020-10-01 00:10:00 | 1006.5 | 1009.3 | 19.6 | 82 | Night | |||
1 | 2020-10-01 00:20:00 | 1006.6 | 1009.4 | 19.5 | 82 | Night | |||
2 | 2020-10-01 00:30:00 | 1006.7 | 1009.5 | 19.6 | 81 | Night | |||
3 | 2020-10-01 00:40:00 | 1006.9 | 1009.7 | 19.6 | 82 | Night | |||
4 | 2020-10-01 00:50:00 | 1006.9 | 1009.7 | 19.7 | 82 | Night | |||
5 | 2020-10-01 01:00:00 | 1007.1 | 1009.9 | 19.5 | 83 | Night | |||
6 | 2020-10-01 01:10:00 | 1007.0 | 1009.8 | 19.5 | 83 | Night | |||
7 | 2020-10-01 01:20:00 | 1006.7 | 1009.5 | 19.2 | 84 | Night | |||
8 | 2020-10-01 01:30:00 | 1006.7 | 1009.5 | 19.2 | 84 | Night |
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
# 長方形詰め込み | |
class TwoDimPackingClass: | |
""" | |
2次元パッキング問題 | |
ギロチンカットで元板からアイテムを切り出す(近似解法) | |
入力 | |
width, height: 元板の大きさ | |
items: アイテムの(横,縦)のリスト | |
出力 | |
容積率と入ったアイテムの(id,横,縦,x,y)のリスト |
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
#include <stdio.h> | |
#include <stdlib.h> | |
// Returns 1 if the given date exists, 0 if not. | |
// Ref: Leap year https://ja.wikipedia.org/wiki/%E9%96%8F%E5%B9%B4 | |
int is_correct_day(int y, int m, int d) { | |
if (m == 2) { | |
if (d > 29) { // d = 30,31 is incorrect | |
return 0; | |
} else if (d == 29) { |
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
<body> | |
<p>A1</p> | |
<p>A1 foo foo foo foo</p> | |
<p>A1 foo foo foo foo <span>bar bar</span></p> | |
<div>A1 foo foo foo foo <a>A2 bar bar</a></div> | |
</body> |
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
#!/usr/bin/env python | |
""" | |
This scripts counts number of nodes | |
in 3x3x3 search tree (3) | |
http://www.terabo.net/blog/fmc-vs-gods-number/ | |
""" | |
ALL_POS = 43252003274489856000 | |
print 'All possible positions: {0:,d}'.format(ALL_POS) |
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
#!/usr/bin/env python | |
""" | |
This scripts counts number of nodes | |
in 3x3x3 search tree (2) | |
http://www.terabo.net/blog/fmc-vs-gods-number/ | |
""" | |
ALL_POS = 43252003274489856000 | |
print 'All possible positions: {0:,d}'.format(ALL_POS) |
NewerOlder