Skip to content

Instantly share code, notes, and snippets.

View SharpCoder's full-sized avatar
🛰️
inventing

Josh Cole SharpCoder

🛰️
inventing
View GitHub Profile
@SharpCoder
SharpCoder / _Gear Generator README.md
Last active December 5, 2024 15:15
Gear generation code with openSCAD

gears.scad

In order to use this code, you will need to copy gears.scad to your Libraries folder. https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Libraries

And then you can run Untitled.scad as any other normal scad project file.

If you don't want to mess around with the library, just combine the two code files together into one.

Library Functions

Instructions for installing rEFInd to dual boot a computer with FreeBSD and windows (and possibly other OSes as well).
Note! I use $esp-dev for all commands. Substitude this for the device with your ESP (for example ada0p1)
Download rEFInd from here: http://sourceforge.net/projects/refind/files/0.11.4/refind-bin-0.11.4.zip/download
This gives you a zip-file with everything you need for rEFInd.
Find out which partition is the ESP. This is easiest done by running `gpart list` and look for partitions with `type: efi`.
In a multi-disk setup there might be more than one of those.
I have always installed rEFInd to the one with the Windows bootloader.
@phausamann
phausamann / complementary_filter.py
Created November 19, 2018 09:41
IMU orientation estimation with complementary filter
import numpy as np
from scipy.signal import filtfilt, butter
from quaternion import quaternion, from_rotation_vector, rotate_vectors
def estimate_orientation(a, w, t, alpha=0.9, g_ref=(0., 0., 1.),
theta_min=1e-6, highpass=.01, lowpass=.05):
""" Estimate orientation with a complementary filter.
Fuse linear acceleration and angular velocity measurements to obtain an
@MRobertEvers
MRobertEvers / PocketBeagleBoot.md
Last active March 14, 2025 02:38
Boot PocketBeagle into Bare Metal Code

Introduction

BeagleBoard came out with a new iteration called PocketBeagle in late september 2017. The new Beagle is minimalistic in nature, consisting primarily of an SD Card Reader, a Micro USB Interface, and the Octavo Systems OSD3358 1GHz ARM® Cortex-A8 System-in-Package (SIP).
The getting started page for the BeagleBoard truly gets you going quick with Linux. However, those of us looking to learn embedded systems, are left high and dry. The resources on uses of the PocketBeagle/BeagleBoard for "bare metal" programming are much fewer in number than those for getting started with Linux.
When I bought the PocketBeagle, it was still very new. There were few resources online for "bare metal" booting/programming. This gist will hopefully document some of the problems I encountered while learning how to boot the PocketBeagle into my own code.

The Manual

The manual for the AM335x is 5000+

@alexellis
alexellis / k8s-pi.md
Last active June 28, 2025 05:44
K8s on Raspbian
@muminoff
muminoff / cubemap.py
Created June 19, 2017 00:34
Panorama to cubemap (Python 3)
# !/usr/bin/env python
import numpy as np
from scipy import ndimage, misc
import sys, math, os
from PIL import Image
def cubemap(filename):
SIZE = 1024
HSIZE = SIZE / 2.0
@mpasternacki
mpasternacki / freebsd_on_mbp.md
Created January 23, 2015 17:12
FreeBSD on a MacBook Pro

FreeBSD on a MacBook Pro

Since 2008 or 2009 I work on Apple hardware and OS: back then I grew tired of Linux desktop (which is going to be MASSIVE NEXT YEAR, at least since 2001), and switched to something that Just Works. Six years later, it less and less Just Works, started turning into spyware and nagware, and doesn't need much less maintenance than Linux desktop — at least for my work, which is system administration and software development, probably it is better for the mythical End User person. Work needed to get software I need running is not less obscure than work I'd need to do on Linux or othe Unix-like system. I am finding myself turning away from GUI programs that I used to appreciate, and most of the time I use OSX to just run a terminal, Firefox, and Emacs. GUI that used to be nice and unintrusive, got annoying. Either I came full circle in the last 15 years of my computer usage, or the OSX experience degraded in last 5 years. Again, this is from a sysadmin/developer ki

@cspanring
cspanring / pip-install-gdal.md
Last active April 10, 2025 18:08
Installing GDAL in a Python virtual environment

Installing GDAL in a Python virtual environment

Get gdal development libraries:

$ sudo apt-add-repository ppa:ubuntugis/ubuntugis-unstable
$ sudo apt-get update
$ sudo apt-get install libgdal-dev

Create and activate a virtual environment:

# coding=UTF-8
from __future__ import division
import re
# This is a naive text summarization algorithm
# Created by Shlomi Babluki
# April, 2013
class SummaryTool(object):
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active December 23, 2025 09:09
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'