Skip to content

Instantly share code, notes, and snippets.

@mangtronix
mangtronix / textProject
Last active August 29, 2015 14:04
Attempt to project text onto a cylinder and then extrude for embossing in FreeCAD
import Part, Draft
from FreeCAD import Base
v=Base.Vector
doc=App.ActiveDocument
font="/Users/mangtronix/src/blender/release/datafiles/bfont.ttf"
# ShapeString text
ss=Draft.makeShapeString(String=u"Hi",FontFile=font,Size=2.0,Tracking=0)
gb = new GnuBook();
gb.getPageWidth = function(index) {
return 800;
}
gb.getPageHeight = function(index) {
return 1200;
}
@mangtronix
mangtronix / orient_top.FCMacro
Last active April 12, 2016 22:09
FreeCAD macro to orient objects to top view
# Assuming a simple shapes like a triangle, orient to top view. Doesn't handle Z position.
#
# Usage:
# Select shapes and execute macro (e.g. Macro->Macros->Execute)
#
# mangtronix
# 2016-04-14
from FreeCAD import Base
@mangtronix
mangtronix / bisect.py
Created May 5, 2016 10:09
Bisect an angle between two lines, for skildall
from FreeCAD import Base
A = Base.Vector(10,3,0)
B = Base.Vector(1,10,0)
C = Base.Vector(0,0,0)
dirCB = B-C
dirCB.normalize()
dirCA = A-C
dirCA.normalize()
dirCc = dirCA + dirCB
dirCc.normalize()
from __future__ import division # allows floating point division from integers
from FreeCAD import Base
import Part
import math
# Run this macro to create a generic project enclosure box
# You can change all the parameters by selecting the object in the tree view and tweaking values in the "Data" tab
# Possible additions/improvements
# counterbore bridging .4mm
@mangtronix
mangtronix / laser_test.gcode
Created November 30, 2016 20:24
Short test fire of laser - no warranty or fitness expressed or implied!
G91 ; Relative mode
G1 X0.25 Y0 F200 S.2 ; 0.25 in X direction at 20% power
M18 ; Disable steppers
@mangtronix
mangtronix / kobo-fullscreen.md
Last active April 12, 2018 02:42
Enabling fullscreen mode (disabling header and footer) on Kobo eReader (e.g. Aura One)

Fullscreen reading removes the header (book title) and footer (page progress) for a pure text reading experience. There's a hidden setting to toggle fullscreen on/off, but it exposes a bug that needs to be patched in the Kobo's onboard CSS.

  1. Edit the "Kobo eReader.config" on the device http://blog.the-ebook-reader.com/2014/10/20/how-to-enable-full-screen-mode-on-kobo-ereaders/
  2. Check your firmware version in Settings->Device information. These instructions are for 4.7.10413
  3. Download stock firmware https://www.mobileread.com/forums/showpost.php?p=3625746&postcount=5
  4. Review instructions for patching https://www.mobileread.com/forums/showthread.php?t=293052
  5. Enable the fix by editing libnickel.so.1.0.0.patch and setting patch_enable to yes for the fullScreenReading fix
diff --git a/libnickel.so.1.0.0.patch b/libnickel.so.1.0.0.patch
@mangtronix
mangtronix / Keybot.pde
Created January 15, 2019 18:10
Processing sketch - Demo code to show pressing keys from simulated serial input
// Demo code to show pressing keys from simulated serial input
//
// Click in the window to send some simulated serial data.
// Press the keys on the keyboard to see the output is the same.
import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.KeyEvent;
Robot robot;
@mangtronix
mangtronix / touchpaint_lolin24tft.ino
Created March 19, 2019 14:26
Adafruit touchpaint example adapted to Lolin TFT 2.4 touch screen
// touchpaint example adapted for Lolin TFT 2.4 touch LCD
// The x and y of the touch needs to be mapped differently to the LCD display.
// https://wiki.wemos.cc/products:d1_mini_shields:tft_2.4_shield
/***************************************************
This is our touchscreen painting example for the Adafruit ILI9341 Shield
----> http://www.adafruit.com/products/1651
Check out the links above for our tutorials and wiring diagrams
These displays use SPI to communicate, 4 or 5 pins are required to
@mangtronix
mangtronix / oscP5_multicast.pde
Created April 12, 2019 05:42
Example of using OSC multicast with Processing / oscP5
/**
* oscP5multicast by andreas schlegel
* example shows how to send osc via a multicast socket.
* what is a multicast? http://en.wikipedia.org/wiki/Multicast
* ip multicast ranges and uses:
* 224.0.0.0 - 224.0.0.255 Reserved for special Òwell-knownÓ multicast addresses.
* 224.0.1.0 - 238.255.255.255 Globally-scoped (Internet-wide) multicast addresses.
* 239.0.0.0 - 239.255.255.255 Administratively-scoped (local) multicast addresses.
* oscP5 website at http://www.sojamo.de/oscP5
*