pip3 install --user pyqt5
sudo apt-get install python3-pyqt5
sudo apt-get install pyqt5-dev-tools
sudo apt-get install qttools5-dev-tools
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
#!/usr/bin/env python | |
import sys, os | |
from optparse import OptionParser | |
# tell python where to find mavlink so we can import it | |
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../mavlink')) | |
from pymavlink import mavutil | |
def handle_heartbeat(msg): |
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 sys; from PIL import Image; import numpy as np | |
chars = np.asarray(list(' .,:;irsXA253hMHGS#9B&@')) | |
if len(sys.argv) != 4: print( 'Usage: ./asciinator.py image scale factor' ); sys.exit() | |
f, SC, GCF, WCF = sys.argv[1], float(sys.argv[2]), float(sys.argv[3]), 7/4 | |
img = Image.open(f) | |
S = ( round(img.size[0]*SC*WCF), round(img.size[1]*SC) ) | |
img = np.sum( np.asarray( img.resize(S) ), axis=2) |
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
#define SCL TRISB4 // I2C bus | |
#define SDA TRISB1 // | |
#define SCL_IN RB4 // | |
#define SDA_IN RB1 // | |
// initialize | |
SDA = SCL = 1 ; | |
SCL_IN = SDA_IN = 0 ; | |
// make master wait |
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
#include <stdio.h> | |
int collatz_count_until_1(unsigned int n) { | |
int count = 0; | |
while(n != 1) { | |
if(n % 2 == 0) { | |
n /= 2; | |
} else { | |
n = (3 * n) + 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
/* ESP8266 + MQTT Humidity and Temperature Node | |
* Can also receive commands; adjust messageReceived() function | |
* See MakeUseOf.com for full build guide and instructions | |
* Author: James Bruce, 2015 | |
*/ | |
#include <MQTTClient.h> | |
#include <ESP8266WiFi.h> | |
#include <DHT.h> |
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 csv | |
import re | |
import matplotlib.pyplot as plt | |
import pandas as pd | |
portPath = "/dev/ttyACM0" # Must match value shown on Arduino IDE | |
baud = 115200 # Must match Arduino baud rate | |
timeout = 5 # Seconds | |
filename = "data.csv" |
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
$ | |
M_{ij}=\sum\limits_{x}\sum\limits_{y}x^iy^iI(x,y)\\ | |
\eta_{pq}=\sum\limits_{x}\sum\limits_{y}(x-\bar x)^p(y- \bar y)^qI(x,y)\\ | |
\bar x=\frac{M_{10}}{M_{00}}, \bar y=\frac{M_{01}}{M_{00}}\\ | |
\mu_{pq}=\frac{\eta_{pq}}{\eta_{00}^\gamma},\gamma=\frac{p+q}{2}\\ | |
H_{1} = \mu_{20} + \mu_{02}\\ | |
H_{2} = (\mu_{20} - \mu_{02})^2 + 4(\mu_{11})^2\\ | |
H_{3} = (\mu_{30} - 3\mu_{12})^2 + (\mu_{03} - 3\mu_{21})^2\\ | |
H_{4} = (\mu_{30} + \mu_{12})^2 + (\mu_{03} + \mu_{21})^2\\ | |
H_{5} = (\mu_{30} - 3\mu_{12})(\mu_{30} + \mu_{12})((\mu_{30} + \mu_{12})^2 - 3(\mu_{21} + \mu_{03})^2) + (3\mu_{21} - \mu_{03})(\mu_{21} + \mu_{03})(3(\mu_{30} + \mu_{12})^2 - (\mu_{03} + \mu_{21})^2)\\ |