Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block reox

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
reox / divide by
Created Nov 29, 2017
divide by a value, decide with a flag
View divide by
# What you would normaly do:
def some_divison():
flag = True
val = 23
divisor = 42
if flag:
return val / divisor
reox /
Last active Mar 19, 2019
Build a debian package from FreeCAD yourself.
set -e
# This assumes you have a user `builder` and a folder `/home/builder/packages`.
# it will clone FreeCAD there and start pbuilder using pdebuild.
# For me this works using debian sid. (stretch/buster will probably not work!)
# After the build has finished, it will import the packes into a reprepro
# which is setup at /srv/repo
reox / ReplaceNonNullPlacements.FCMacro
Last active Nov 2, 2017
FreeCAD Macro to replace all placements with Nullplacements. This is important when using Assembly2 Workbench, to allow correct placement there.
View ReplaceNonNullPlacements.FCMacro
print("Checking replacing all placements with default.")
for b in App.activeDocument().findObjects("PartDesign::Body"):
if not b.Placement.isNull():
print("!!! Body {} has a non null placement --> resetting!".format(b.Label))
b.Placement.Base = FreeCAD.Base.Vector()
b.Placement.Rotation = FreeCAD.Base.Rotation()
print("Body {} looks fine...".format(b.Label))
reox /
Created Jul 11, 2017
Linear Algebra with scipy
import numpy as np
from itertools import combinations
import scipy.linalg
x = [1.2, 1.3, 1.6, 2.5, 2.3, 2.8]
y = [167.0, 180.3, 177.8, 160.4, 179.6, 154.3]
z = [-0.3, -0.8, -0.75, -1.21, -1.65, -0.68]
f = np.array([0.1, 0.2, 0.3, 0.4, 0.5, 0.6]).transpose()
G = np.c_[x, y, z]
reox /
Created May 9, 2017
Bottle as a class. Need to define the routing yourself, then you are fine
from bottle import Bottle
# From
def routemethod(route, **kwargs):
def decorator(f):
f.route = route
for arg in kwargs:
setattr(f, arg, kwargs[arg])
return f
return decorator
reox / bend_tube.scad
Last active Mar 17, 2017
Create a bend tube in OpenSCAD. Work ONLY with openscad >=2016, as the angle parameter in rotate_extrude was introduced there.
View bend_tube.scad
// fine mesh
fn = 1000;
// epsilon for clean intersection
eps = 0.1;
module tube(inner=5, outer=10, angle=45, length=250){
// we want the thing in z direction, thus we rotate on x axis
reox /
Created Mar 10, 2017
Import a Windows 7 VM from Virtualbox
# Unfortunately virtio seems to not work with win8 (it seems to work with windows 10)
virt-install --import --memory 4096 --vcpus 1 --name win8 --os-variant win8 --disk ~/VirtualBox\ VMs/Windows/Windows-disk1.vmdk,format=vmdk
reox /
Last active Mar 31, 2018
Create a new Debian container for KVM and import it using virt-install
set -e
# Name of the VM
# IP address for VM
PACKAGES="openssh-server htop vim"
reox /
Created Aug 8, 2016
Set the Time on a Canon Camera with gphoto2
# This is very simple but I always forget it...
gphoto2 --set-config datetime=$(date +%s)
reox /
Created Mar 28, 2016
Bup Backup using a remote BUP_DIR
# creake a backup of several folders using bup
# Using $TARGET as $BUP_DIR
FOLDERS="/etc /root /home /srv /var"
LOGFILE="$TARGET/logs/$(date +%Y%m%d_%H%M%S).log"
flock -n 200
You can’t perform that action at this time.