Skip to content

Instantly share code, notes, and snippets.

View tkoki's full-sized avatar

Takashi Koki tkoki

  • Tokyo, Japan
View GitHub Profile
@tkoki
tkoki / wifi_check.py
Created August 30, 2020 03:41
Raspberry Pi OS でWi-Fiが有効かを確認する
# coding: UTF-8
import subprocess
import re
def extract_essid(line):
# ESSID:"essid" のパターンがあるかどうか
pattern = r'.*ESSID:"(.*)"'
result = re.match(pattern, line)
if result:
return (True, result.group(1))
@tkoki
tkoki / property_check.py
Created October 18, 2021 00:52
Pythonのクラスのプロパティ名の一覧を取得する(セットされているものしか得られない)
# coding: UTF-8
class Test():
def __init__(self, name):
self.name = name
def set_id(self, x):
self.id = x
def who_are_you(self):
@tkoki
tkoki / list_walk.py
Created October 24, 2021 23:38
Pythonで複数のリストの要素とインデックスを同時に取得する
lista = [1, 2, 3]
listb = ['a', 'b', 'c']
for idx, (la, lb) in enumerate(zip(lista, listb)):
print(idx, la, lb)
@tkoki
tkoki / youtube_download.py
Created March 28, 2022 23:42
pytubeでYouTube動画をダウンロードする
import pytube
link = input('Enter Youtube Video URL ')
yt = pytube.YouTube(link)
yt.streams.filter(progressive=True, file_extension='mp4').order_by('resolution').desc().first().download()
print('downloaded', link)