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
#!/bin/bash | |
# your ip address | |
ip_address="192.168.15.142" | |
function change_dns() { | |
route add default gw 192.168.14.200 | |
echo "nameserver 80.191.216.2" > /etc/resolv.conf | |
echo "nameserver 8.8.8.8" >> /etc/resolv.conf | |
echo "nameserver 4.2.2.4" >> /etc/resolv.conf |
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 serial | |
import time | |
def lsb(value): | |
return value & 0xff | |
def msb(value): | |
return value >> 8 | |
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 json | |
class School: | |
def __init__(self, name): | |
self.name = name | |
self.students = [] | |
def to_dict(self): | |
return { | |
'name': self.name, |
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
<div class="battery"> | |
<div id="battery_level" class="battery-level"></div> | |
</div> | |
<style> | |
.battery:after { | |
background-color: #fff; | |
border: 2px solid #000; | |
content: ""; | |
display: block; | |
height: 16px; |
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 | |
from sklearn.cluster import KMeans | |
import matplotlib.pyplot as plt | |
first_random = -2 * np.random.rand(100, 2) | |
second_random = 1 + 2 * np.random.rand(50, 2) | |
dataset = np.concatenate((first_random, second_random)) | |
plt.scatter(dataset[:, 0], dataset[:, 1]) |
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 sklearn.neighbors import KNeighborsClassifier | |
samples = [[0], [1], [2], [3]] | |
labels = [0, 0, 1, 1] | |
item_to_predict = [[1.1]] | |
model = KNeighborsClassifier(n_neighbors=3, metric='euclidean') | |
model.fit(samples, labels) | |
predict = model.predict(item_to_predict) |
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 message_filters | |
from cv_bridge import CvBridge, CvBridgeError | |
from sensor_msgs.msg import Image | |
class DepthCameraStreamer: | |
def __init__(self, image_topic="", depth_topic="", scale=1.0): | |
self.frame = None | |
self.depth = None |
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 rospy | |
import cv_bridge | |
from saam_object_detection.srv import WhatAmILookingAt | |
import json | |
import numpy as np | |
class PersonDetection: | |
def __init__(self, service_name='what_am_i_looking_at'): | |
rospy.wait_for_service(service_name) |
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 rospy | |
import cv_bridge | |
import json | |
from saam_pose_estimation.srv import PoseEstimator | |
class PoseEstimation: | |
def __init__(self, service_name='saam_pose_estimation'): | |
rospy.wait_for_service(service_name) | |
self.service = rospy.ServiceProxy(service_name, PoseEstimator) |
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 random | |
import copy | |
import matplotlib.pyplot as plt | |
class GeneticAlgorithm: | |
def __init__(self): | |
self.chromosome_length = 50 | |
self.population = [] |
NewerOlder