This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def gettimeszonestg(tz,dt1=None): | |
if tz is None: | |
return 'J' | |
else: | |
utco=tz.utcoffset(dt1) | |
if utco.days>=0: | |
tzg = 'ZABCDEFGHIKLM'[utco.seconds//3600] | |
else: | |
tzg = 'ZNOPQRSTUVWXY'[(-utco).seconds//3600] | |
if utco.seconds % 3600 == 1800: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/usr/bin/env python | |
import sqlite3 | |
conn=sqlite3.connect('memento.sqlite') | |
cr=conn.cursor() | |
calcslist=cr.execute("SELECT * FROM `entry`").fetchall() | |
calcsdict=dict((entry[0].lower(),entry) for entry in calcslist) | |
conn.close() | |
if __name__ = '__main__': | |
import sys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
token_type='Bearer' | |
access_token='' | |
baseurl='https://api.thingiverse.com/' | |
meurl='https://api.thingiverse.com/users/me' | |
import urllib2, base64 | |
import json | |
def isfiletype(name,suffixes=('fcstd','scad','brep','brp')): | |
return any([name.lower().endswith(suffix) for suffix in suffixes]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
#with information from http://paulbourke.net/dataformats/spacemouse/ | |
smkeys=('1','2','3','4','5','6','7','8', '*','L','R','?') | |
nibble2sm=('0','A','B','3','D','5','6','G','H','9',':','K','<','M','N','?') | |
sm2nibble=dict(zip(nibble2sm,range(16))) | |
sm2nibble2=lambda x:ord(x) & 0xf | |
binary=False | |
def sm2coord(cstr): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sqlite3,datetime,sys | |
def buildactdict(c): | |
c.execute('SELECT id,name from categories') | |
catdict=dict(((cat[0], cat[1]) for cat in c.fetchall())) | |
c.execute('SELECT id,name,category_id from activities') | |
actdict=dict(((act[0], '%s@%s' % (act[1],catdict.get(act[2]))) \ | |
for act in c.fetchall())) | |
return actdict | |
def findunfinished(c): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import imaplib,getpass | |
import email | |
import email.header | |
import email.utils | |
import re | |
def decodestr(str1): | |
str2,enc=email.header.decode_header(str1)[0] | |
if enc: | |
return str2.decode(enc) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Part, FreeCAD, math | |
iso261pitchregular={1.0:0.25, 1.1:0.25, 1.2:0.25, | |
1.4:0.30, | |
1.6:0.35, 1.8:0.35, | |
2.0:0.4, | |
2.2:0.45, 2.5:0.45, | |
3.0:0.5, | |
3.5:0.6, | |
4.0:0.7, | |
4.5:0.75, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> | |
<title>Untitled Document</title> | |
</head> | |
<frameset rows="*" cols="147,*" framespacing="0" frameborder="no" border="0"> | |
<frame src="../menu.html" name="leftFrame" scrolling="No" noresize="noresize" id="leftFrame" /> | |
<frame src="Export_main.html" name="mainFrame" id="mainFrame" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> | |
<title>Untitled Document</title> | |
</head> | |
<frameset rows="*" cols="150,*" framespacing="0" frameborder="no" border="0"> | |
<frame src="../menu.html" name="leftFrame" scrolling="No" noresize="noresize" id="leftFrame" /> | |
<frame src="ImportCSG_main.html" name="mainFrame" id="mainFrame" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
from FreeCAD import Base | |
#Main class for general extrusion related methods | |
class ExtrusionProfile(): | |
def __init__(self, profile): | |
self.profile = profile | |
def makeExtrusion(self, p1, p2, rotateAngle=0): | |
"""Generates an extrusion which connects between two points, |