Skip to content

Instantly share code, notes, and snippets.

View peterwallhead's full-sized avatar
👨‍💻
coding all the things

Peter Wallhead peterwallhead

👨‍💻
coding all the things
View GitHub Profile
@peterwallhead
peterwallhead / compassbearing.py
Created January 24, 2024 09:39 — forked from jeromer/compassbearing.py
compass bearing between two points in Python
# LICENSE: public domain
def calculate_initial_compass_bearing(pointA, pointB):
"""
Calculates the bearing between two points.
The formulae used is the following:
θ = atan2(sin(Δlong).cos(lat2),
cos(lat1).sin(lat2) − sin(lat1).cos(lat2).cos(Δlong))
@peterwallhead
peterwallhead / noodles.js
Created June 10, 2023 09:27 — forked from kellyvaughn/noodles.js
Accept LinkedIn Requests
const btns = document.querySelectorAll('button[aria-label*="Accept"]')
for(const btn of btns){
setTimeout(() => { btn.click() }, 300)
}
@peterwallhead
peterwallhead / openscad_spring_generator.scad
Created September 25, 2022 05:13
Use https://openscad.org/ to quickly design and iterate a 3D printable spring.
module springLeaf(height=10, leaf_spacing=10, spring_width=30) {
difference() {
union() {
translate([0,-spring_width,0])
cylinder(h=height, d=leaf_spacing, $fn=36);
translate([-leaf_spacing/2,-spring_width,0])
cube([leaf_spacing,spring_width-(leaf_spacing/2),height]);
}

This Hikvision webcam was a pain to get running on Linux Ubuntu.

After plugging it in all my photo taking apps refused to load or crashed very quickly after opening.

I used this to help solve the issue.

After plugging in the webcam, run the following in Terminal

sudo rmmod uvcvideo
@peterwallhead
peterwallhead / compre.py
Created July 12, 2018 20:29 — forked from soruly/compre.py
Compare two images using OpenCV and SIFT in python
import cv2
import sys
import os.path
import numpy as np
def drawMatches(img1, kp1, img2, kp2, matches):
rows1 = img1.shape[0]
cols1 = img1.shape[1]
rows2 = img2.shape[0]
/* A version of https://github.com/johnwargo/Seeed-Studio-Relay-Board/blob/master/seeed_relay_test.py in C for use with https://www.seeedstudio.com/Raspberry-Pi-Relay-Board-v1.0-p-2409.html */
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <wiringPiI2C.h>
int deviceRegMode1 = 0x06;
int deviceRegData = 0xff;
.box {
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
@peterwallhead
peterwallhead / dns-record-sets.md
Last active August 31, 2016 04:46
DNS record sets for my new side project domains (that use Servercrew as email host and Mailgun for transactional email)

A Record:

  • *.example.com > IP
  • example.com > IP

MX Record:

  • example.com > 40:webmail.servercrew.com.au

CNAME Record:

  • email.example.com > mailgun.org
#
# Controlling an RC car via webcam (well, so far, just tracking it...)
#
# Requires OpenCV 2.0 and Python 2.6
#
import cv
def find_car(image):