Skip to content

Instantly share code, notes, and snippets.

#include "Quaternion.h"
#include <cmath>
// http://content.gpwiki.org/index.php/OpenGL:Tutorials:Using_Quaternions_to_represent_rotation
// http://www.flipcode.com/documents/matrfaq.html
// http://db-in.com/blog/2011/04/cameras-on-opengl-es-2-x/
// http://wiki.beyondunreal.com/Legacy:Quaternion
// http://clb.demon.fi/MathGeoLib/docs/float3x3.cpp_code.html#612
// http://clb.demon.fi/MathGeoLib/docs/Quat_summary.php
// http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm
@specialcircumstances
specialcircumstances / dhcpcd.sh
Created April 16, 2020 13:36 — forked from Lewiscowles1986/dhcpcd.sh
Raspberry pi stretch allow dhcpcd5 with /etc/network/interfaces
#!/bin/sh -e
#
# This file belongs in /usr/lib/dhcpcd5/dhcpcd how you get it there is up to you
#
DHCPCD=/sbin/dhcpcd
INTERFACES=/etc/network/interfaces
REGEX="^[[:space:]]*iface[[:space:]](*.*)[[:space:]]*inet[[:space:]]*(dhcp|static)"
EXCLUDES=""
@specialcircumstances
specialcircumstances / parseasa.py
Last active April 7, 2020 16:44
Thrown together script to do a rough analysis of ASA/LINA "show access-list" output to see how it is compiling and find ineffficient rules
#!/bin/python
#
import re
import argparse
def example(filename):
items = []
# P3 with open(filename, newline='') as f:
try:
#!/usr/bin/python
# gathers GSLB statistics for a particular name
from __future__ import print_function
from time import sleep
import curses
import dns.name
import dns.query
@specialcircumstances
specialcircumstances / gist:006629561b0941894934c1702c139efb
Created March 31, 2019 20:12
Driving LewanSoul LX-16A Serial Servo Directly from Particle Photon
// GIST to outline driving this very cost effective serial servos directly from Particle Photons
// Turns out the servo uses half duplex, and requires an Open Drain
// Turn off echo, or we can't read.
// According to my nScope although the docs say pull-up to 5V I can see it's a 3.3V that's 5V tolerant
// ... just like the photon...
// So, anyway, 3.3V works just fine. Link to the TX pin (that's Serial1). RX pin is unused.
// I used an external 10K pull-up to the 3.3V pin on the photon. You might be able to do this internally too?
//
// Power the servo separately to > 6V, so be a little careful with your wiring (cos the servo power will fry your serial pin)
{
"id": "ZW095-C",
"name": {
"en": "Home Energy Meter Gen2"
},
"class": "sensor",
"capabilities": [
"measure_current",
"measure_power",
"meter_power",
{
"id": "ZW095-C",
"name": {
"en": "Home Energy Meter Gen2"
},
"class": "sensor",
"capabilities": [
"measure_current",
"measure_power",
"meter_power",
"multiChannelNodes": {
"1": {
"class": "sensor",
"capabilities": [
"measure_power",
"meter_power"
],
"name": {
"en": "Clamp 01"
},
@specialcircumstances
specialcircumstances / statcom.py
Created September 27, 2016 19:38
station commodities
class StationCommodity(models.Model):
# Buy Sell Don't bring?
commodity = models.ForeignKey(Commodity, models.CASCADE)
station = models.ForeignKey(Station, models.CASCADE)
imported = models.NullBooleanField(blank=True, null=True) # Y N ?
exported = models.NullBooleanField(blank=True, null=True) # Y N ?
prohibited = models.NullBooleanField(blank=True, null=True) # Y N ?