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 RPi.GPIO as GPIO | |
import os | |
import time | |
import math | |
usleep = lambda x: time.sleep(x / 1000000.0) | |
GPIO.setwarnings(False) | |
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 multiprocessing | |
from threading import Thread | |
import random | |
import string | |
class ThreadWorker(Thread): | |
def __init__(self, *args, **kwargs): | |
super().__init__(*args, **kwargs) |
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
encode_table = { | |
'a': "01", | |
'b': "02", | |
'c': "03", | |
'd': "04", | |
'e': "05", | |
'f': "06", | |
'g': "07", | |
'h': "08", | |
'i': "09", |
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
# Credit for gcd() method - https://stackoverflow.com/questions/11175131/code-for-greatest-common-divisor-in-python | |
def gcd(a, b): | |
"""Calculate the Greatest Common Divisor of a and b. | |
Unless b==0, the result will have the same sign as b (so that when | |
b is divided by it, the result comes out positive). | |
""" | |
while b: | |
a, b = b, a % b | |
return a |
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
class MyClass { | |
MyClass() { | |
APIManager manager = GameObject.FindWithTag("APIManager").GetComponent<APIManager>(); | |
manager.StartCoroutine(MyFunction()); | |
} | |
IEnumerator MyFunction() { | |
yield return "Hello World!"; |
NewerOlder