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 | |
| import pickle | |
| import numpy as np | |
| from nltk.tokenize import word_tokenize | |
| def load_vectors(fname): | |
| fin = io.open(fname, 'r', encoding='utf-8', newline='\n', errors='ignore') | |
| n, d = map(int, fin.readline().split()) | |
| data = {} | |
| for line in fin: |
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
| sudo docker build --build-arg CACHEBUST=$(date +%s) -t judgement_ai . && sudo docker kill $(sudo docker ps -q) ; sudo docker run -p 127.0.0.1:5000:5000 -p 127.0.0.1:6006:6006 -t judgement_ai |
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 | |
| np.set_printoptions(suppress=True) | |
| pad = lambda x: np.hstack([x, np.ones((x.shape[0], 1))]) | |
| primary = np.array([[3, 0], | |
| [0, 3], | |
| [-3, -3], | |
| [0, -3]]) | |
| secondary = np.array([[1, 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 fastText | |
| import numpy as np | |
| ftModel = fastText.load_model("WordEmbedding/ftWord.bin") | |
| v1 = np.array(ftModel.get_word_vector("injury")) | |
| v2 = np.array(ftModel.get_word_vector("injuries")) # 0.872767 | |
| def get_similarity(v1, v2): | |
| return np.dot(v1/np.sqrt(np.sum(np.square(v1))), v2/np.sqrt(np.sum(np.square(v2)))) |
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
| # First, create folder python_app containing some python scripts (e.g. hello_world.py) | |
| #################################################################################### | |
| #################################################################################### | |
| # To build container: | |
| # sudo docker build . | |
| # To run container: | |
| # sudo docker run [LAST_HEX_ID_THAT_THE_BUILD_SPITS_OUT] |
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 <SPI.h> | |
| #include "Adafruit_GFX.h" | |
| #include "Adafruit_HX8357.h" | |
| #include <Adafruit_STMPE610.h> | |
| #define LED1 13 | |
| #define LED2 14 | |
| #define STMPE_CS 32 | |
| #define TFT_CS 15 |
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 | |
| def get_filenames(path, valid_exts=[".jpg", ".png"]): | |
| output = [] | |
| for dirpath, subdirs, files in os.walk(path): | |
| for x in files: | |
| if x.lower().endswith(tuple(valid_exts)): | |
| output.append(os.path.join(dirpath, x)) | |
| return output |
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
| while true; do ./arduino --verify --board espressif:esp32:featheresp32 '/home/alex/Downloads/alexbot_firmware/alexbot_firmware/alexbot_firmware.ino' 2>&1 >/dev/null | less -p 'warning|error' ; done |
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
| // Software Serial Sample | |
| // Copyright (c) 2012 Dimension Engineering LLC | |
| // See license.txt for license details. | |
| #include <SoftwareSerial.h> | |
| #include <SabertoothSimplified.h> | |
| SoftwareSerial SWSerial(NOT_A_PIN, 11); // RX on no pin (unused), TX on pin 11 (to S1). | |
| SabertoothSimplified ST(SWSerial); // Use SWSerial as the serial port. |
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 time | |
| GPIO.setwarnings(False) # enable warning from GPIO | |
| GPIO.setmode(GPIO.BCM) # GPIO numbering | |
| class RasPiRCCar(): | |
| def __init__(self, motor_dir_pin, motor_pwm_pin, steering_pwm_pin, debug=False): | |
| self.debug = debug | |
| if self.debug: |