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 / gist:9002acb015bb1e5cf37c
Created April 9, 2015 19:07
CDDA strength effects
Effects of Strength:
activity_handlers.cpp
activity_handlers::butcher_finish
151: strength below 4 incurs a butcher skill check penalty
activity_handlers.cpp
activity_handlers::pulp_do_turn
770: increases pulp damage
772: increases pulp damage cap
@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 / armor_stats.jq
Created November 27, 2015 18:56
cataclysm armor stats json jq script
# Output stats for armor, including resistance calculations
# jq -f armor_stats.jq --argfile mat ../materials.json ../items/*.json
# load bash and cut resist data from the material array
( $mat | map ( { (.ident):.bash_resist } ) | add ) as $br
|
( $mat | map ( { (.ident):.cut_resist } ) | add ) as $cr
# now, $br and $cr are objects mapping materials to bash/cut resist values
# like this {plastic:2, paper:1, ...}
@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