Skip to content

Instantly share code, notes, and snippets.

View Coderx7's full-sized avatar
💭
In God we Trust!

Seyyed Hossein Hasanpour Coderx7

💭
In God we Trust!
  • IRAN
  • 05:11 (UTC +03:30)
View GitHub Profile
import cv2
import numpy as np
import matplotlib.pyplot as plt
# create a simple image
image = np.kron([[1, 0] * 4, [0, 1] * 4] * 4, np.ones((50, 50))).astype(np.uint8) * 255
# test opencv
cv2.imshow('checkboard',image)
cv2.waitKey(0)
# test matplotlib
@Coderx7
Coderx7 / ubuntu_sim_ros_noetic.sh
Last active August 16, 2021 04:33
ubuntu_sim_ros_noetic.sh
#!/bin/bash
## Bash script for setting up ROS Neotic (with Gazebo 9) development environment for PX4 on Ubuntu LTS (20.04).
## It installs the common dependencies for all targets (including Qt Creator)
##
## Installs:
## - Common dependencies libraries and tools as defined in `ubuntu_sim_common_deps.sh`
## - ROS Melodic (including Gazebo9)
## - MAVROS
@Coderx7
Coderx7 / ubuntu_sim_common_deps.sh
Last active August 15, 2021 12:12
ubuntu_sim_common_deps.sh
#!/bin/bash
## Bash script for setting up a PX4 development environment on Ubuntu LTS (16.04 and above).
## It can be used for installing simulators (only) or for installing the preconditions for Snapdragon Flight or Raspberry Pi.
##
## Installs:
## - Common dependencies and tools for all targets (including: Ninja build system, latest versions of cmake, git, anaconda3, pyulog)
## - jMAVSim simulator dependencies
## - PX4/Firmware source (to ~/src/Firmware/)
#!/usr/bin/env python
#ROS Node to convert a GPS waypoint published on the topic "waypoint" into a 2D Navigation Goal in SLAM to achieve autonomous navigation to a GPS Waypoint
#Converts Decimal GPS Coordinates of waypoint to ROS Position Vector relative to the current gps position of the robot
#Accounts for curvature of the earth using haversine formula
#Depends rospy, std_msgs, geographic_msgs, sensor_msgs, numpy
#Written by Alex McClung, 2015, alex.mcclung@hotmail.com, To be Released Open Source under Creative Commons Attribution Share-Alike Licence
import roslib
import rospy
@Coderx7
Coderx7 / How to build dlib on windows using Visual Studio 2019
Last active August 16, 2020 04:51
How to build dlib on windows using Visual Studio 2019
Here is a gif showing how to do this from the beginning to the very end
@Coderx7
Coderx7 / pytorch_cpu_perf_bkm.md
Created June 9, 2020 02:15 — forked from mingfeima/pytorch_cpu_perf_bkm.md
BKM for PyTorch CPU Performance

General guidelines for CPU performance on PyTorch

This file serves a BKM to get better performance on CPU for PyTorch, mostly focusing on inference or deployment. Chinese version available here.

1. Use mkldnn layout

layout refers to how data is organized in a tensor. PyTorch default layout is NCHW, from optimization perspective, MKL-DNN library (renamed as DNNL recently) may choose a different layout, sometimes refered to as internal layout or primitive layout. This is actually a normal technique for acceleration libraries, common knowledge is that NHWC runs faster than NCHW for convolution, changing the default NCHW to NHWC is called a reorder. MKL-DNN may choose different internal layouts based on the input pattern and the algorithm selected, e.g. nChw16c, a.k.a. reorder a 4-dim tensor into 5-dim by chop down dimension C by 16, for vectorization purpose (AVX512 instruction length is 16x32 bit).

By default on CPU, conv2d will ru

@Coderx7
Coderx7 / main.go
Created April 21, 2020 11:07 — forked from KatelynHaworth/main.go
Example of run an interactive process on the current user from system service on windows (Golang)
package main
import (
"github.com/kardianos/service"
"log"
"flag"
)
type Service struct {}
@Coderx7
Coderx7 / embpython.c
Created April 20, 2020 07:48 — forked from bluebanboom/embpython.c
Example of embedding python in c.
#include <Python.h>
#include <stdio.h>
/*
* gcc embpython.c -I/usr/include/python2.7 -lpython
**/
void loadModule()
{
/* run objects with low-level calls */
char *arg1="sir", *arg2="robin", *cstr;
printf("Load Module err!\n");
@Coderx7
Coderx7 / test.c
Created April 20, 2020 07:48 — forked from nad2000/test.c
Basic examples to show how to embed and extend Python in C including: creation of module in C with functions handling and building Python objects; importing and calling python functions from C.
/* Example of embedding Python in another program */
// to compile run:
// gcc -o test $(python-config --cflags) test.c $(python-config --ldflags) && ./test
#include<stdio.h>
#include "Python.h"
void initxyzzy(void); /* Forward */
main(int argc, char **argv)
@Coderx7
Coderx7 / -1559928795563.log
Created June 7, 2019 17:35
vscode console log with default jedi
workbench.main.js:3313 [Extension Host] debugger listening on port 36301
workbench.main.js:238 [Extension Host] [vscode-icons] v8.7.0 activated!
workbench.main.js:238 [Extension Host] (node:12808) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
t.log @ workbench.main.js:238
workbench.main.js:238 [Extension Host] Info Python Extension: 2019-06-07 22:02:44: Display locator refreshing progress, Class name = p, completed in 1ms, , Return Value: undefined
workbench.main.js:238 [Extension Host] Info Python Extension: 2019-06-07 22:02:44: Notify locators are locating, Class name = p, completed in 1ms, , Return Value: undefined
workbench.main.js:238 [Extension Host] Info Python Extension: 2019-06-07 22:02:44: Checking whether locactors have completed locating, Class name = p, completed in 0ms, , Return Value: false
workbench.main.js:238 [Extension Host] Info Python Extension: 2019-06-07 22