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 python3 | |
import shutil | |
import subprocess | |
import sys | |
revive_path = shutil.which("revive") | |
if revive_path == "": | |
print("revive をインストールしてください") | |
print("`go install github.com/mgechev/revive@latest`") |
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
from PIL import Image | |
def create_cell( | |
size: int, border_size: int, inside_color: str, border_color: str | |
) -> Image.Image: | |
inside_size = size - border_size * 2 | |
inside_cell_img = Image.new("RGB", (inside_size, inside_size), inside_color) | |
cell_img = Image.new("RGB", (size, size), border_color) | |
cell_img.paste(inside_cell_img, (border_size, border_size)) |
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
### Keybase proof | |
I hereby claim: | |
* I am chun37 on github. | |
* I am chun37 (https://keybase.io/chun37) on keybase. | |
* I have a public key ASCCW9xK8G8AjsKPGrrC4KEwVq34btu-cM_nS3cfqo_EiAo | |
To claim this, I am signing this object: |
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 itertools | |
base = range(10) | |
data = list(itertools.permutations(base, 6)) | |
data = list(map(lambda x: None if x[5] % 2 != 0 or x[0] == 0 else x, data)) | |
data = list(filter(None, data)) | |
for き, く, さ, す, ま, ゆ in data: | |
まゆすき = int(f'{ま}{ゆ}{す}{き}') | |
さくままゆ = int(f'{さ}{く}{ま}{ま}{ゆ}') | |
if まゆすき < 1000 or さくままゆ < 10000: |
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 -*- | |
from PIL import Image, ImageOps | |
import numpy as np | |
import os | |
file = "" # ここに読み込む画像ファイル名を入力 | |
img = Image.open(file) | |
filename = file.split("/")[-1].split(".")[0] | |
if not os.exist("changedImage"): | |
os.mkdir("changedImage") |
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 -*- | |
# !python3 | |
from PIL import Image | |
import appex | |
import ui | |
from objc_util import NSBundle, ObjCClass, uiimage_to_png, CGSize | |
import tweepy | |
import io | |
import os |
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 tweepy | |
import requests | |
import xmltodict | |
import HTMLParser | |
import random | |
import re | |
def normalText(tweet): |
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 -*- | |
from requests_oauthlib import OAuth1Session | |
def tweet(status, batch_mode, in_reply_to_status_id=None): | |
global tweet_id | |
if batch_mode: | |
params = {"status": status, "batch_mode": "first", "weighted_character_count": True} | |
else: | |
params = {"status": status, "in_reply_to_status_id": in_reply_to_status_id, "batch_mode": "subsequent", "weighted_character_count": True} |
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 sqlite3 | |
con = sqlite3.connect("") # dbname | |
conn = con.cursor() | |
conn.row_factory = sqlite3.Row | |
ret = conn.execute("select * from # order by #") # 1つ目の#: tablename, 2つ目の#: columnname | |
result = [i[0] for i in conn.fetchall()] # <type 'list'> | |
print result |
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 requests | |
import json | |
import re | |
import sys | |
print u"このプログラムは横浜市資源循環局のイーオくんとお話できるプログラムだよ" | |
print u"終了したいときは[Ctrl+C]を押すか[/exit]と送ってね" | |
print u"---" * 20 | |
print u"イーオだよ。こんにちは。" | |
print u"ゴミの名前を教えてくれたら、捨て方を案内するよ。粗大ごみの手数料を知りたい場合は、「自転車の手数料」のように話しかけてね。" |
NewerOlder