Skip to content

Instantly share code, notes, and snippets.

View sparr's full-sized avatar

Clarence "Sparr" Risher sparr

  • Amazon
  • Whitinsville, MA, USA
View GitHub Profile
@sparr
sparr / T-Slot Nut.py
Created November 28, 2011 01:44
Parametric Printable T-Slot Nut
from __future__ import division # allows floating point division from integers
from FreeCAD import Base
import sys
import math
try:
path = App.ConfigGet('UserHomePath') + '/FreeCad/Mod'
i = sys.path.index(path)
except:
sys.path.append(path)
@sparr
sparr / mirror_rotate_bug.py
Created November 30, 2011 01:01
freecad mirror rotate bug test case
from FreeCAD import Base
box1 = Part.makeBox(1,4,9)
Part.show(box1)
box2 = Part.makeBox(1,4,9)
box2.rotate(Base.Vector(0,0,0),Base.Vector(0,0,1),60) # this line changes the behavior of the mirror
Part.show(box2)
box2 = box2.mirror(Base.Vector(2,4,9),Base.Vector(1,0,0)) # this mirror doesn't work correctly after the part has been rotated
Part.show(box2)
@sparr
sparr / persistent_post_comment.py
Created March 15, 2012 05:17
reddit api, post with retries and rate limit
def persistent_post_comment(parent,comment,retries=3,debug=False):
result = None
while retries >= 0:
try:
if debug:
print "debug: comment: " + comment
else:
print "comment: " + comment
result = post_comment(parent,comment)
except reddit.errors.RateLimitExceeded as e:
@sparr
sparr / find_banned_subreddits.py
Created March 18, 2012 03:42
get list of subreddits we are banned from
# fetch our inbox, find subreddits we are banned from in advance
my_inbox = None
try:
my_inbox = r.user.get_inbox()
except:
#TODO: handle some exceptions here!
raise
if (my_inbox):
for m in my_inbox:
s = re.match("you have been banned from posting to \[.*\]\(/r/(.*)/\)\.",m.body)
@sparr
sparr / bash.sublime-build
Created August 3, 2012 15:48
SublimeText Build System for BASH scripts
{
"cmd": ["bash", "$file"],
"file_regex": "^(.*): line ([0-9]*)",
"selector": "source.bash"
}
@sparr
sparr / gist:5265567
Created March 28, 2013 18:17
ohai output on OSX 10.7, lightly censored
{
"counters": {
"network": {
"interfaces": {
"en1": {
"rx": {
"bytes": "19949649885",
"packets": "19418063",
"overrun": 0,
"multicast": 0,
<!DOCTYPE html>
<html lang="en">
<!--
One Page HTML/CSS resume design, copyright 2013 Nicholas Perry.
Structure and design of HTML and CSS released under Creative Commons Attribution-ShareAlike 3.0 Unported License http://creativecommons.org/licenses/by-sa/3.0/deed.en_US
Personal Content is used as exmaple, but is not licensed for re-use, please update all content (including meta tags) before republish/reuse.
For inquerys, contact nicholas.t.perry at gmail.com and refer to this gist: https://gist.github.com/4509098.
Please do not remove this copyright notice and include a note on modifications if you choose to use this for your own resume.
-->
@sparr
sparr / fb_list_edit_profile_links.js
Last active December 18, 2015 16:49
Add profile links to Facebook friend list management
@sparr
sparr / git remote -v
Created August 5, 2013 19:17
`git remote -v` while troubleshooting ruby instructions
origin git@github.com:sparr/ruby.git (fetch)
origin git@github.com:sparr/ruby.git (push)
upstream git://github.com/ruby/ruby.git (fetch)
upstream git://github.com/ruby/ruby.git (push)
@sparr
sparr / cobblerd_set_date.snippet
Created August 14, 2013 21:06
cobblerd snippet to set the date and time via kickstart %pre
# set the date and time
#import time
#set $timestamp = $time.strftime("%m%d%H%M%Y.%S",$time.gmtime());
date -u $timestamp
hwclock -w -u