Skip to content

Instantly share code, notes, and snippets.

View dtgay's full-sized avatar

dtgay dtgay

View GitHub Profile
@dtgay
dtgay / gist:2647212
Created May 9, 2012 17:47
Java won't append a slash if missing from a String
/**
* Tests the duplicate file finder
* For RIT 4002-219
* Author: David Gay
* Spring 2012
* CODE WRITTEN FOR USE ON A LINUX FILESYSTEM
*/
public class TestDups
{
@dtgay
dtgay / gist:2766933
Created May 22, 2012 05:58
looping through text objects in yaml file for point-and-click-arthur
text_lines = []
for dialog_object in gametext["PLACES"]["start"]["ACTIONS"]["first_visit"]["DIALOG"]:
for text in dialog_object["TEXT"]:
text_lines.append(text)
txt = text_lines[0]
txt2 = text_lines[1]
txt3 = text_lines[2]
@dtgay
dtgay / fedora-rpg-irc-001.txt
Created June 5, 2012 19:08
Fedora RPG: IRC transcript #1
Any questions about this interaction, or any requests for clarification can be directed to oddshocks.
14:13:29 < oddshocks> I am about to caption stuff that SJ says
14:13:37 < francis-game> okay
14:13:37 < oddshocks> as per his request
14:13:45 < francis-game> thanks
14:13:48 < oddshocks> No problem!
14:14:08 < oddshocks> Good thing that we have a lot of activity in the Google Doc
14:14:32 < oddshocks> At the moment, we have 5 hours worth of stubs. Links to shit
people have written
@dtgay
dtgay / gist:2907543
Created June 10, 2012 22:29
pcreate failure traceback with Pyramid
Traceback (most recent call last):
File "/usr/bin/pcreate", line 9, in <module>
load_entry_point('pyramid==1.3.2', 'console_scripts', 'pcreate')()
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 337, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2279, in load_entry_point
return ep.load()
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 1989, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/usr/lib/python2.7/site-packages/pyramid-1.3.2-py2.7.egg/pyramid/__init__.py", line 1, in <module>
@dtgay
dtgay / coder-shell.py
Created July 4, 2012 22:05 — forked from ralphbean/coder-shell.py
coder-shell++
""" Run like: $ python coder-shell.py
First you need to: $ pip install coderwall requests fabulous
"""
from coderwall import CoderWall
import fabulous.image
import fabulous.text
import os
import requests
@dtgay
dtgay / gist:3190781
Created July 27, 2012 22:34
Problem with Stack Exchange API JSON data
stack_exchange_api = 'https://api.stackexchange.com/2.1'
request_url = "{0}/users/{1}/associated".format(
stack_exchange_api, usernames['stack_exchange'])
api_request = urllib2.Request(
request_url,
headers={"Accept": "application/json"})
api_response = urllib2.urlopen(api_request)
se_accounts_json = json.load(api_response)
se_answers = 0 # Number of answers given on SE sites
pprint.pprint(se_accounts_json)
@dtgay
dtgay / gist:3190973
Created July 27, 2012 23:12 — forked from gregjurman/gist:3190863
Problem with Stack Exchange API JSON data
stack_exchange_api = 'https://api.stackexchange.com/2.1'
request_url = "{0}/users/{1}/associated".format(
stack_exchange_api, usernames['stack_exchange'])
api_request = urllib2.Request(
request_url,
headers={"Accept": "application/json"})
api_z_response = urllib2.urlopen(api_request)
from zlib import decompress, MAX_WBITS
api_response = decompress(api_z_response.read(), 16 + MAX_WBITS)
se_accounts_json = json.loads(api_response)
@dtgay
dtgay / gist:3238297
Created August 2, 2012 16:13
Coderwall API example
def handle_coderwall(request, username):
"""
Get data from CoderWall.
"""
from coderwall import CoderWall
try:
cwc = CoderWall(username)
return {
'endorsements': cwc.endorsements,
@dtgay
dtgay / littlest_backup.sh
Created September 27, 2012 21:18
The Littlest Backup
#!/bin/sh
# Backup file and directory to local folder
cp -r ~/.task ~/Dropbox/Backup/tasks/
cp ~/.taskrc ~/Dropbox/Backup/tasks/.taskrc
# Backup file and directory to remote location
rsync -r ~/.task yacht:.task
rsync ~/.taskrc yacht:.taskrc
@dtgay
dtgay / gist:4445087
Created January 3, 2013 17:19
960gs demo
<div class="container_12">
<div class="grid_6">
<p>This content is in a half-container width column!<p>
</div>
<div class="grid_6">
<p>So is this! Two even columns!</p>
</div>
<div class="clear"></div> <!-- Put this between rows of content. -->