Skip to content

Instantly share code, notes, and snippets.

Avatar

J. Hart Hart87

  • USA
View GitHub Profile
View userscontroller.java
@RestController
public class V1RestUser {
private static final Logger logger = LoggerFactory.getLogger(V1RestUser.class);
private final UserRepository users;
private final PostRepository posts;
public V1RestUser(PostRepository links, UserRepository users) {
this.posts = links;
this.users = users;
View post.java
@Entity
public class Post extends BaseEntity {
@NotNull
@Size(min = 1, max = 280)
private String uniquePostId;
private String body;
private String createdAt;
private String author;
private String image;
View user.java
@Entity
public class User extends BaseEntity {
//public static final PasswordEncoder PASSWORD_ENCODER = new BCryptPasswordEncoder();
@NotNull
@Size(min = 5, max = 50)
private String uniqueUserId;
private String email;
@JsonIgnore
View buid.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath('org.springframework.boot:spring-boot-gradle-plugin:1.5.0.RELEASE')
}
}
apply plugin: 'java'
@Hart87
Hart87 / initCV.py
Created Jan 27, 2020
OpenCV starting point for different cameras
View initCV.py
import cv2 #Open CV 3.4.1
import datetime
import socket
import time
#get the cam.....
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
#for tello
def send_command(command):
@Hart87
Hart87 / dd.py
Last active Sep 23, 2019
Initial drive controller for the DareDevil
View dd.py
import paho.mqtt.client as mqtt
from time import sleep
import pigpio
import RPi.GPIO as GPIO
import datetime
print ("INIT DAREDEVIL")
print (datetime.datetime.now())
## Set GPIO
@Hart87
Hart87 / pigpio.py
Last active Sep 4, 2019
Calibrating and driving ESCs with PIGPIO & Raspberry pi
View pigpio.py
import pigpio
import time
#start the daemon - sudo pigpiod then check with pigs t
#stop the daemon - sudo killall pigpiod
## new PWM method
pi = pigpio.pi('localhost', 8888)
pi.set_servo_pulsewidth(26, 0)
@Hart87
Hart87 / calibr8.py
Created Aug 21, 2019
Quick script to calibrate ESCs. Turn on flight controller after.
View calibr8.py
import RPi.GPIO as GPIO
from time import sleep
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
#motors
GPIO.setup(21, GPIO.OUT)
GPIO.setup(20, GPIO.OUT)
@Hart87
Hart87 / FlightCon.py
Last active Sep 21, 2019
A functioning Quadcopter flight controller using and Accelerometer for inertial monitoring, PWM, and MQTT. This script accepts MQTT messages from a slider in an iOS app to adjust motor throttle. UIButtons in iOS app fire off flight control maneuvers when it’s pressed and return to level throttle when the button is unpressed
View FlightCon.py
import paho.mqtt.client as mqtt
from time import sleep
import pigpio
import Adafruit_ADXL345
import multiprocessing
import datetime
pi = pigpio.pi('localhost', 8888)
# Create an ADXL345 instance.
View humidor.py
#To run the humidor ....
import paho.mqtt.client as mqtt
import paho.mqtt.publish as publish
import datetime
import RPi.GPIO as GPIO
import time
import Adafruit_DHT
import lcddriver
### Relay is 22 & LED is 17 ........ #####