Skip to content

Instantly share code, notes, and snippets.

/*
Thrust bearing by Hans Loeblich
License CC BY-SA
*/
/* [Hidden] */
// constants
in = 25.4;
$fa = 0.1;
//use <polyround.scad> // https://github.com/Irev-Dev/Round-Anything/blob/master/polyround.scad
$fs = 0.2;
$fa = 0.2;
total_h = 90;
fingers = 4;
d2 = 3;
d1 = (total_h - (fingers+1)*d2) / fingers;
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
// Created in 2018 by Ryan A. Colyer.
// This work is released with CC0 into the public domain.
// https://creativecommons.org/publicdomain/zero/1.0/
include <plot_function.scad> // https://www.thingiverse.com/thing:2391851
finger_spacing = 21;
oblong_factor = 1.8;
ripple_sharpness = 0.6; // range [0:1]
grip_width = 20;
@thehans
thehans / Protractor.py
Created December 1, 2011 04:06
Protractor script for FreeCAD, measures angle between two edges
from FreeCAD import Base
import math
class Protractor:
"""Reports the angle between two edges.
Select the edges and the result will be shown in Report View"""
def __init__(self):
self.firstEdge = None
Gui.Selection.addObserver(self)
FreeCAD.Console.PrintMessage("Select any 2 edges\n")
@thehans
thehans / sorted compile words
Created February 6, 2019 07:06
compare cmake vs qmake
-c
CMakeFiles/OpenSCAD.dir/src/export_amf.cc.o
-DEIGEN_DONT_ALIGN
-DENABLE_CGAL
-DENABLE_EXPERIMENTAL
-DENABLE_LIB3MF
-DENABLE_LIBZIP
-DENABLE_OPENCSG
-D__GCC
-DNDEBUG
@thehans
thehans / command line log
Created February 10, 2019 19:00
Attempt to build latest Eigen 3.3.7
root@f12677981478:/mxe# make update-package-eigen && \
> make JOBS=6 -j8 \
> MXE_PLUGIN_DIRS=plugins/gcc7 \
> MXE_TARGETS=x86_64-w64-mingw32.static.posix \
> eigen
NEW eigen 3.2.5 --> 3.3.7
sed -i 's/^\([^ ]*_VERSION *:=\).*/\1 3.3.7/' '/mxe/src/eigen.mk'
make -f 'Makefile' 'update-checksum-eigen' || { sed -i 's/^\([^ ]*_VERSION *:=\).*/\1 3.2.5/' '/mxe/src/eigen.mk'; exit 1; }
make[1]: Entering directory '/mxe'
mkdir -p '/mxe/pkg' && ( (wget --user-agent='Wget/1.18' -T 30 -t 3 -O '/mxe/pkg/.tmp-eigen-3.3.7.tar.bz2' 'https://bitbucket.org/eigen/eigen/get/3.3.7.tar.bz2' && true) ) && cat '/mxe/pkg/.tmp-eigen-3.3.7.tar.bz2' > '/mxe/pkg/eigen-3.3.7.tar.bz2' && rm '/mxe/pkg/.tmp-eigen-3.3.7.tar.bz2' || ( echo; echo 'Download failed!'; echo; rm -f '/mxe/pkg/eigen-3.3.7.tar.bz2' '/mxe/pkg/.tmp-eigen-3.3.7.tar.bz2'; ) && sed -i 's/^\([^ ]*_CHECKSUM *:=\).*/\1 '"`openssl dgst -sha256 '/mxe/pkg/eigen-3.3.7.tar.bz2' 2>/dev/null | sed -n 's,^.*\([0-9a-f]\{64\}\)$,\1,p'`"'/' '/mxe/src/eigen.mk'
@thehans
thehans / testcase.i
Created February 13, 2019 06:14
gcc bug
class A { private: friend int &operator<<(int &i, const A &value) { return i; } };
#pragma GCC optimize ("-fno-ipa-cp-clone")
class B { };
int &operator<<(int &i, const B &ast);
@thehans
thehans / surface.dat
Created February 15, 2019 19:44
remove z=0 from surface
#surface.dat
10 9 8 7 6 5 5 5 5 5
9 8 7 6 6 4 3 2 1 0
8 7 6 6 4 3 2 1 0 0
7 6 6 4 3 2 1 0 0 0
6 6 4 3 2 1 1 0 0 0
6 6 3 2 1 1 1 0 0 0
6 6 2 1 1 1 1 0 0 0
6 6 1 0 0 0 0 0 0 0
3 1 0 0 0 0 0 0 0 0
@thehans
thehans / filter_fermat2k.c
Created May 18, 2019 20:41
Test of alternative powm specific to base-2 fermat test, using Left to right k-ary exponentiation.
#include <gmp.h>
#include <stdio.h>
#include <stdlib.h>
#include "../gmp-6.1.2/gmp-impl.h"
#include "../gmp-6.1.2/longlong.h"
static inline mp_limb_t
getbits (const mp_ptr p, mp_bitcnt_t bi, int nbits)
{
int nbits_in_r;