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
| installed = set() | |
| processing = set() | |
| def install(x): | |
| if x in installed:return | |
| if x in processing: raise Exception("cyclic dependency") | |
| processing.add(x) | |
| dependencies = get_dependencies(x) |
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 smtplib | |
| import email.utils | |
| from email.mime.text import MIMEText | |
| subject = 'subject' | |
| body = '''body | |
| ''' | |
| sender = ('Chen,Chao-Wei', 'willhyper@gmail.com') |
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 hashlib as hasher | |
| from collections import deque | |
| class Block: | |
| def __init__(self, data: str, previous_hash: str): | |
| self.data = data | |
| self.previous_hash = previous_hash | |
| @property |
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 base64 | |
| import json | |
| import requests | |
| def jupyter_upload(url="http://localhost:8889", | |
| token="280e41422dcdef6fa2ba790279badc019bda0b42f69d53ba", | |
| src="src/test.txt",dst="test2.txt"): | |
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
| # install opencv https://docs.opencv.org/master/d3/d52/tutorial_windows_install.html#tutorial_windows_install_path | |
| # pip install opencv-python | |
| # https://stackoverflow.com/questions/604749/how-do-i-access-my-webcam-in-python | |
| import cv2 | |
| cv2.namedWindow("preview") | |
| vc = cv2.VideoCapture(0) | |
| if vc.isOpened(): # try to get the first frame |
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 setuptools import setup | |
| setup( | |
| name='myModuleName', | |
| packages=[ | |
| 'package.moduleA', | |
| 'package.moduleB' | |
| ], | |
| version='0.0.0', | |
| description='description', |
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 sys | |
| img_name = sys.argv[1] | |
| import matplotlib.pyplot as plt | |
| import numpy as np | |
| im = plt.imread(img_name) | |
| im23 = np.tile(im, [2,3,1]) | |
| plt.imsave("output.jpg", im23) |
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 clojure.java.api.Clojure; | |
| import clojure.lang.IFn; | |
| public class Main{ | |
| public static void main(String[] args){ | |
| IFn plus = Clojure.var("clojure.core", "+"); | |
| var ans = plus.invoke(1, 2); | |
| System.out.println(ans); | |
| } |
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
| /* | |
| * gradle init | |
| * gradle jar | |
| * cp build/libs/*.jar ../interop-clj/resources | |
| */ | |
| package jlib; | |
| public class Library { | |
| public boolean method1() { | |
| return true; |
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
| (ns app.core) | |
| (defn -main | |
| "I don't do a whole lot." | |
| [x] | |
| (println x "Hello, World!")) |