Skip to content

Instantly share code, notes, and snippets.

Avatar

Clarence "Sparr" Risher sparr

View GitHub Profile
@sparr
sparr / T-Slot Nut.py
Created Nov 28, 2011
Parametric Printable T-Slot Nut
View T-Slot Nut.py
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 Nov 30, 2011
freecad mirror rotate bug test case
View mirror_rotate_bug.py
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 Mar 15, 2012
reddit api, post with retries and rate limit
View persistent_post_comment.py
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 Mar 18, 2012
get list of subreddits we are banned from
View find_banned_subreddits.py
# 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 Aug 3, 2012
SublimeText Build System for BASH scripts
View bash.sublime-build
{
"cmd": ["bash", "$file"],
"file_regex": "^(.*): line ([0-9]*)",
"selector": "source.bash"
}
@sparr
sparr / gist:5265567
Created Mar 28, 2013
ohai output on OSX 10.7, lightly censored
View gist:5265567
{
"counters": {
"network": {
"interfaces": {
"en1": {
"rx": {
"bytes": "19949649885",
"packets": "19418063",
"overrun": 0,
"multicast": 0,
View nperry_resume.html
<!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 Dec 18, 2015
Add profile links to Facebook friend list management
View fb_list_edit_profile_links.js
@sparr
sparr / git remote -v
Created Aug 5, 2013
`git remote -v` while troubleshooting ruby instructions
View git remote -v
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 Aug 14, 2013
cobblerd snippet to set the date and time via kickstart %pre
View cobblerd_set_date.snippet
# 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
You can’t perform that action at this time.