Skip to content

Instantly share code, notes, and snippets.

@PeterMortensen
PeterMortensen / testimport.py
Created July 29, 2017 13:44 — forked from 5263/testimport.py
Automaticly import and check OpenSCAD files into FreeCAD
import FreeCAD
import importCSG
#import prototype
importmod=importCSG
dirpath=''
def comparewithstl(filename,obj,doc):
# import MeshPart
import Mesh
import OpenSCADUtils
@PeterMortensen
PeterMortensen / ProjectEnclosure.py
Created July 29, 2017 13:43 — forked from thehans/ProjectEnclosure.py
FreeCAD script for generating parametric project enclosures
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
@PeterMortensen
PeterMortensen / rt-draw.py
Last active April 30, 2017 01:03 — forked from sbourdelin/rt-draw.py
Draw plot in real time with matplotlib [SigRok, PulseView]
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 Savoir-Faire Linux Inc.
# Authors:
# Sebastien Bourdelin <sebastien.bourdelin@savoirfairelinux.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License Version 2 as
# published by the Free Software Foundation.
@PeterMortensen
PeterMortensen / extractsession.js
Created January 31, 2017 20:23 — forked from clochix/extractsession.js
Extract URLs of every tab from the file `sessionstore.js` in a Firefox profile
#!/usr/bin/env nodejs
//jshint node: true
require('fs').readFile('sessionstore.js', {encoding: 'utf8'}, function (err, data) {
"use strict";
var session;
if (err) {
throw err;
}
session = JSON.parse(data);
session.windows.forEach(function (window) {
@PeterMortensen
PeterMortensen / issues.rb
Created January 28, 2017 20:23 — forked from tomohiro/issues.rb
Redmine REST API sample
#!/usr/bin/env ruby
require 'rubygems'
require 'active_resource'
class Issue < ActiveResource::Base
self.site = 'http://localhost'
self.user = 'user'
self.password = 'password'
end
@PeterMortensen
PeterMortensen / web-servers.md
Last active January 25, 2017 17:43 — forked from willurd/web-servers.md
Big list of HTTP static server one-liners

Each of these commands will run an ad hoc HTTP static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on Reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@PeterMortensen
PeterMortensen / stddev.fs
Created February 28, 2016 15:43 — forked from stephanh42/stddev.fs
Computing mean and population standard deviation in Forth.
\ Computing mean and population standard deviation in Forth.
\ Tested on Gforth 0.7.0
16 constant FRAC \ number of bits behind fixed-point
\ convert from/to fixed point representation
: s>fix FRAC lshift ;
: fix>s FRAC rshift ;
\ fixed-point arithmetic