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
# Interval | |
$interval = 1000 | |
$counter = 0 | |
# 例えばこれが自動的・定期的に他のスクリプトから呼ばれるとして | |
def on_update() | |
$counter ++ | |
if $interval < $counter | |
# do something | |
$counter = 0 |
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
import numpy as np | |
set([ tuple(set(t)) for t in [ (n, m) for c in np.random.permutation(len(M)) for e in np.random.permutation(len(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
' '.join(''.join([ bin(random.randint(0, 0xFFFFFFFF))[2:] for i in range(10) ])) |
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
import os | |
import shutil | |
import time | |
import argparse | |
from datetime import datetime as dt | |
VERSION = '0.1.0' | |
class BackupItem: | |
def __init__(self, src, dest): |
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
import os | |
import platform | |
import subprocess | |
#src = | |
#dest = | |
#logfile = | |
def utcnow(): | |
from datetime import datetime as dt |
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
import requests | |
from bs4 import BeautifulSoup | |
def get_amedas(url): | |
r = requests.get(url) | |
bs = BeautifulSoup(r.content, 'html.parser') | |
main = bs.find('div', id="main_table") | |
table = main.find('table', id='tbl_list') | |
data = [ [ td.text for td in tr.find_all('td') ] for tr in table.find_all('tr') ] |
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
if __name__ == '__main__': | |
import sys | |
file = sys.argv[1] | |
class Wave: | |
def __init__(self, file): | |
with open(file, 'rb') as fp: | |
self.riff = fp.read(4).decode('ascii') | |
self.size = int.from_bytes(fp.read(4), 'little') |
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
import matplotlib.pyplot as plt | |
import matplotlib.dates as mdates | |
import matplotlib.ticker as ticker | |
import time | |
from datetime import datetime as dt | |
from datetime import timedelta | |
import sqlite3 | |
db = sqlite3.connect('./db.sqlite3') |
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
import cv2 | |
import numpy as np | |
import time | |
cap = cv2.VideoCapture(0) | |
spoints = [] | |
def mouse_handler(event, x, y, flags, params): | |
if event == cv2.EVENT_LBUTTONUP: | |
if len(spoints) < 4: |
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
import io | |
from PIL import ImageGrab | |
cap = ImageGrab.grab() | |
print(cap.size) |