Skip to content

Instantly share code, notes, and snippets.

Stefan Blanke greenarrow

Block or report user

Report or block greenarrow

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
@greenarrow
greenarrow / sigpipe.py
Created Feb 13, 2015
How to make Python play nicely with pipes
View sigpipe.py
import sys
import errno
def main():
for i in range(20):
print i
if __name__ == "__main__":
# ensure buffer is flushed before we handle SIGPIPE
try:
@greenarrow
greenarrow / spherical_translate.scad
Last active Dec 23, 2015
OpenSCAD Spherical Translate
View spherical_translate.scad
/* http://en.wikipedia.org/wiki/Spherical_coordinate_system */
module spherical_translate(value)
{
radius = value[0];
inclination = value[1];
azimuth = value[2];
x = radius * sin(inclination) * cos(azimuth);
y = radius * sin(inclination) * sin(azimuth);
@greenarrow
greenarrow / gerber_lib.py
Created May 22, 2013
Incomplete gerber to OpenSCAD (PCB)
View gerber_lib.py
"""
GNU licence:
RepRap Gerber Plotter is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.
RepRap Gerber Plotter is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details. You should have received a copy of
the GNU General Public License along with File Hunter; if not, write to
@greenarrow
greenarrow / plasticdb.py
Created Mar 18, 2013
plasticdb - Simple tool for 3D printer filament calibration For the best 3D printing results the "steps per e" should be calibrated for each different filament. Plasticdb makes that an easier task. Works best with matterQ (http://matterq.org).
View plasticdb.py
#!/usr/bin/env python
import os
import sys
import subprocess
import tempfile
import shutil
# The file that stores all the data
View gsync
#!/bin/bash
set -e
METADIR=".gsync"
ARCHIVE=false
OLDHEAD=""
@greenarrow
greenarrow / fetch.py
Created Dec 2, 2011
Auto slice favourites from thingiverse
View fetch.py
#!/usr/bin/env python
import urllib
import re
import os
BASE = "http://www.thingiverse.com"
USER = "greenarrow"
# Find all things on a page
View scuddle.py
#!/usr/bin/env python
"""
Pass in SoundCloud page URLs as arguments and all MP3s will be downloaded into the current directory.
This is a demonstration only and you should almost definitely not use it.
"""
import urllib
import re
@greenarrow
greenarrow / cleanthumb.py
Created Oct 29, 2010
Delete Gnome thumbnails for a list of given locations
View cleanthumb.py
#!/usr/bin/env python
__doc__ = """
Deletes Gnome thumbnails for a given list of directories.
Very much helped by http://software.maexotic.de/python/cleanthumbs/
"""
import os, optparse, Image, urllib
View torrentcontrol
#!/usr/bin/env python
__doc__ = """Simple script to start and stop all torrents in Transmission
1. Make sure you have installed transmission-remote
2. Enable web client in Transmission (allow only for 127.0.0.1, do not use authentication)
3. Set up cron to start and stop the torrents (optional). e.g.
30 2 * * * path_to_script/torrentcontrol start
0 8 * * * path_to_script/torrentcontrol stop
View webcapture.py
#!/usr/bin/env python
import os, re, time, pexpect
print dir(pexpect)
class CaptureError(Exception):
pass
class WebCapture():
def __init__(self, filename, url, title):
self.filename = filename
You can’t perform that action at this time.