Skip to content

Instantly share code, notes, and snippets.

View ahmdrz's full-sized avatar
💭
I may be slow to respond.

Ahmadreza Zibaei ahmdrz

💭
I may be slow to respond.
View GitHub Profile
@ahmdrz
ahmdrz / dump.go
Created September 23, 2016 08:07
Golang Reflection Example of an array.
package main
import (
"fmt"
"reflect"
)
type Test struct {
Name string
}
@ahmdrz
ahmdrz / subdomains.go
Created October 10, 2016 06:29
How to use SubDomains in Golang , Subdomains With Go , http://codepodu.com/subdomains-with-golang/
//
// 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
@ahmdrz
ahmdrz / insta_downloader.go
Last active August 22, 2022 12:31
Want to download instagram videos ? Why not using telegram ? Share it to a user and receive it on telegram.
// test project main.go
package main
import (
"fmt"
"net/http"
"strconv"
"time"
"net/url"
#!/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
import serial
import time
def lsb(value):
return value & 0xff
def msb(value):
return value >> 8
import json
class School:
def __init__(self, name):
self.name = name
self.students = []
def to_dict(self):
return {
'name': self.name,
<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;
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])
@ahmdrz
ahmdrz / sklearn-knn.py
Created May 20, 2019 04:42
Simple knn in sklearn
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)
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