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
package main | |
import ( | |
"fmt" | |
"reflect" | |
) | |
type Test struct { | |
Name string | |
} |
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
// | |
// Please read http://codepodu.com/subdomains-with-golang/ | |
// It's just copy and paste :smile: | |
// | |
// | |
// URLs : | |
// http://admin.localhost:8080/admin/pathone | |
// http://admin.localhost:8080/admin/pathtwo | |
// http://analytics.localhost:8080/analytics/pathone | |
// http://analytics.localhost:8080/analytics/pathtwo |
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
// test project main.go | |
package main | |
import ( | |
"fmt" | |
"net/http" | |
"strconv" | |
"time" | |
"net/url" |
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
#!/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 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 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 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 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 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 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 |
NewerOlder