This file contains 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
def len_of_bytes_as_repr(b): | |
return str_to_bytes(str(hex(int(len(bytes_to_str(b)) / 2))[2:]).zfill(3).upper()) |
This file contains 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 serial | |
from threading import Thread | |
from py_test_framework_utils.framework_utils import bytes_to_str | |
from uart_tool.telegram import Telegram | |
from time import sleep | |
class _LoggingTool: | |
def __init__(self, com_port, log_file_path): | |
self._log_file_path = log_file_path |
This file contains 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
(defn sum-digits [number-str] | |
(reduce + (map #(Character/digit % 10) number))) | |
vs. | |
def digits_sum(number_str): | |
sum = 0 | |
for c in number_str: | |
sum += int(c) |
This file contains 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
def __init__(self, telegram): | |
try: | |
{str: self._init_from_str, | |
dict: self._init_from_dict, | |
bytearray: self._init_from_bytearray}[type(telegram)](telegram) | |
except KeyError: | |
raise ValueError("Invalid type of constructor argument") | |
This file contains 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 serial | |
from threading import Thread | |
from py_test_framework_utils.framework_utils import bytes_to_str | |
from abc import ABCMeta, abstractmethod, abstractproperty | |
class _LoggingTool: | |
def __init__(self, com_port, log_file_path): | |
self._log_file_path = log_file_path | |
self._serial_conn = serial.Serial(port=com_port, baudrate=115200) |
This file contains 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 java.util.*; | |
/* | |
What you need to do: | |
1) Write a method to build a tree from the left parenthetic string representation (return the root node of the tree) | |
Left parenthetic string representation: |
This file contains 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
#------------------------------------------Wrapping DLL------------------------------------------ | |
#Create an object that contains the C/C++ lib | |
optolyzer_dll = CDLL("libBOoptoLyzer_dll.so") | |
#Define functions and c types for argument and return values in lib | |
#int Connect(char* ip, unsigned int port); | |
dll_connect = optolyzer_dll.Connect | |
dll_connect.argtypes = [c_char_p, c_uint] |
This file contains 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 time | |
from datetime import datetime | |
def get_time(): | |
"""ex. get_time() -> [19, 05, 10]""" | |
pass | |
def _int_to_digits(time_int): |
This file contains 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 | |
from time import sleep | |
clock = 27 | |
data = 22 | |
# Tell the GPIO module to use GPIO numbering used by processor | |
GPIO.setmode(GPIO.BCM) | |
GPIO.setup(clock, GPIO.OUT) |
This file contains 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 | |
from time import sleep | |
clock = 27 | |
data = 22 | |
# Tell the GPIO module to use GPIO numbering used by processor | |
GPIO.setmode(GPIO.BCM) | |
GPIO.setup(clock, GPIO.OUT) |