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 PIL import Image, ImageDraw, ImageChops, ImageEnhance | |
img = Image.open("animal_arupaka.png") | |
dat = img.split() | |
r,b,g,a = img.split() | |
basecolor = (212, 195, 188) #毛の色 | |
cangap = 18 | |
# 毛を推察する。+-gapは許容 | |
r = r.point(lambda x: 1 if basecolor[0] - cangap <= x <= basecolor[0] + cangap else 0, mode="1") |
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
#include <iostream> | |
#include <string> | |
#include <vector> | |
#include <boost/algorithm/string/classification.hpp> // is_any_of | |
#include <boost/algorithm/string/split.hpp> | |
#include <boost/range/algorithm/for_each.hpp> | |
using namespace std; | |
void test(string s){ | |
vector<std::string> result; | |
cout << "Parse STR: \"" << s << "\"\n"; |
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
#include <stdio.h> | |
long func(int x) { return x + 1; } | |
long func2(int x) { return x + 2; } | |
int main() { | |
// 64bitの場合、関数は64bitなのでlongにする | |
long a, b; | |
long (*c)(long); // 正しい関数ポインタ | |
// まず、定義したfuncのアドレスを調べる | |
printf("func value is %lx\n", func); | |
printf("func2 value is %lx\n", func2); |
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
#include <bits/stdc++.h> | |
using namespace std; | |
void f(string A, string X, string Y){ | |
cout << "a, x, y = " << A << ", " << X << ", " << Y << "\n"; | |
double dA=stod(A), dX=stod(X), dY=stod(Y); | |
long double ldA=stold(A), ldX=stold(X), ldY=stold(Y); | |
long lA=stol(A), lX=stol(X), lY=stol(Y); | |
/* 入力をdoubleで比較 */ | |
if ((dA/dX) == (dA/dY)) cout << "double : a/x == a/y" << "\n"; |
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
# a/b == Fraction(a,b) 有理数計算クラス | |
from fractions import Fraction | |
from decimal import Decimal | |
def f(a, x, y): | |
print("a, x, y,", a, ",", x, ",", y) | |
a = int(a) | |
x = int(x) # 1e16 + 1 | |
y = int(y) # 1e16 + 2 |
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
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++) | |
#define REP(i, n) FOR(i,0,n) | |
using namespace std; | |
using namespace atcoder; | |
const int numNode = 2*100000; | |
const int numColor = 4 * 100000; | |
const int numGraph = numNode + numColor + 100; | |
const int snode = numGraph - 3; | |
const int tnode = numGraph - 2; |
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
// 本コードの | |
// I2C部分は中尾 司様の以下コードを参考にしています | |
// http://www.eleki-jack.com/mycom2/2007/12/avri2c8twii2c_4.html#more | |
// 07/11/15 www.wsnak.com T.Nakao | |
// また、nora66さんのコメントを参考にしています。 | |
// http://nora66.com/avr/prog2.html | |
// タイマーコード部分はsim00様の以下のコードを参考にしています | |
// http://blog.goo.ne.jp/sim00/e/1ab8d1564106581d1168edc059042c30 | |
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
// 本コードの | |
// I2C部分は中尾 司様の以下コードを参考にしています | |
// http://www.eleki-jack.com/mycom2/2007/12/avri2c8twii2c_4.html#more | |
// 07/11/15 www.wsnak.com T.Nakao | |
// また、nora66さんのコメントを参考にしています。 | |
// http://nora66.com/avr/prog2.html | |
// タイマーコード部分はsim00様の以下のコードを参考にしています | |
// http://blog.goo.ne.jp/sim00/e/1ab8d1564106581d1168edc059042c30 | |
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
""" | |
これなに? | |
Slackのあなたの書き込みを消します。 | |
クエリの調べ方 | |
https://api.slack.com/methods/pins.list | |
とか見て、適当にTester画面からクエリ送ります。 | |
URLでるので、良しなに書き換えましょう | |
準備 |
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
""" | |
static Py_ssize_t | |
find_empty_slot(PyDictKeysObject *keys, Py_hash_t hash) | |
{ | |
assert(keys != NULL); | |
const size_t mask = DK_MASK(keys); | |
size_t i = hash & mask; | |
Py_ssize_t ix = dictkeys_get_index(keys, i); |