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 subprocess | |
| from os.path import expanduser, join | |
| from concurrent.futures import ThreadPoolExecutor | |
| import os | |
| import time | |
| def upload(path, name): | |
| rep = subprocess.run(["gdrive", "upload", path, "--delete", "-p", "0B2RYolW0g60rQmh2ZjNFWUZxZmM", "--name", name], stdout=subprocess.PIPE) | |
| rep = str(rep.stdout, "utf-8") | |
| # print(rep) |
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) | |
| while not cap.isOpened(): | |
| print("Reset") | |
| time.sleep(0.1) | |
| cap = cv2.VideoCapture(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
| var click = function(ch){ | |
| e = new KeyboardEvent('keydown',{'keyCode':ch.charCodeAt()}); | |
| document.getElementById("canvas").dispatchEvent(e); | |
| } | |
| var keypress = function(ch){ | |
| var eventObj = document.createEvent("Events"); | |
| eventObj.initEvent("keydown", true, true); | |
| eventObj.which = ch.toUpperCase().charCodeAt(); | |
| document.getElementById("canvas").dispatchEvent(eventObj); |
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 | |
| import matplotlib.pyplot as plt | |
| f = 5 # frequence | |
| A = 10 # amplitude | |
| sf = 50 // f # sampling frequence | |
| t = np.linspace(0, 1/f, 10 * sf) | |
| fun = A * np.sin(f * 2 * np.pi * t) |
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 | |
| import matplotlib.pyplot as plt | |
| f = 150 # frequency | |
| period_point = 10 # how many point each sampling interval | |
| period = 50 | |
| sf = 200 * period // f # sampling times | |
| t = np.linspace(0, period * 1 / f, period_point * sf) | |
| fun = 4 * np.sin(100 * np.pi * t) + 4 * np.sin(300 * np.pi * t) |
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 numpy as np | |
| sample_num = 100 | |
| lim = [0, 0.05] | |
| x = np.linspace(-0.999999, 0.999999, sample_num) | |
| plt.subplot(311) | |
| num = np.arcsin(x[1:]) - np.arcsin(x[:-1]) | |
| plt.plot(x[:-1], num/2) | |
| plt.title("derived formula") |
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 numpy as np | |
| # use latex | |
| plt.rc('text', usetex=True) | |
| plt.rc('font', family='serif') | |
| x = np.linspace(0, 2 * np.pi, 100) | |
| plt.subplot(411) |
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 <DHT.h> | |
| #include <Wire.h> | |
| #include <LiquidCrystal_I2C.h> | |
| const int lightPin = 13, | |
| motorPin = 9, | |
| dhtPin = 8, | |
| temperture = 27; // strictly larger | |
| int lightFeq = 0, | |
| motorFeq = 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 matplotlib.pyplot as plt | |
| import matplotlib | |
| import numpy as np | |
| import scipy.stats as st | |
| us = [4.8949, 4.8957, 4.8939, 4.8932, 4.8954] | |
| ts = [0.0004995, 0.0004992, 0.001768, 0.001757, 0.0006654] | |
| n = 5000 | |
| tns = np.array(ts) / np.sqrt(n - 1) | |
| print(us) |
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.patches as mpatches | |
| import matplotlib.pyplot as plt | |
| import matplotlib | |
| import numpy as np | |
| import scipy.stats as st | |
| data = np.array("1.0006 1.0072 0.9941 0.9918 0.9986 0.9991 1.0107 0.9981 1.0011 1.0218".split(), dtype=np.float) | |
| data1 = np.array("0.9854 1.0056 1.0041 1.0132 0.9902 0.9876 1.0094 0.9815 0.9999 1.0027".split(), dtype=np.float) |