Skip to content

Instantly share code, notes, and snippets.

View theY4Kman's full-sized avatar

Zach Kanzler theY4Kman

View GitHub Profile
@theY4Kman
theY4Kman / prepare_s3.sh
Created April 9, 2011 05:41
Compresses each folder in data/sets and places its tar.gz in data/sets/archives
#!/bin/bash
pushd data/sets/ > /dev/null
mkdir -p data/sets/
mkdir -p archives
find . -maxdepth 1 -mindepth 1 -type d -not -name archives -not -name data | while read -r set
do
export set set=`basename $set`
touch -d "`find $set -exec stat \{} --printf="%y\n" \; | sort -n -r | head -1`" ${set}test
if [ ${set}test -nt archives/$set.tar.gz ]
then
#!/bin/bash
# This file is used to split up the datasets into their own archives before
# they are uploaded to S3.
pushd data/sets/ > /dev/null
mkdir -p data/sets/
mkdir -p ../archives
find . -maxdepth 1 -mindepth 1 -type d -not -name data | while read -r set
do
@theY4Kman
theY4Kman / parse_events.py
Created August 23, 2011 23:12
Parses the JSON events list for the <Trading Game> Mechanical Turk experiment
import json
FIRST_MTURK = 1313994874
GAME_LENGTH = 5*60+5
START_CASH = 20.0
APPROVED_MTURK = ('25fead42', '5d7ef660', '23cf8ae3', '2d1402d1', '4c8f688c',
'09be3a98', '682550c5', '3ce59c03')
def parse_events(fname):
'''Takes a filename and parses all its events'''
@theY4Kman
theY4Kman / graphs.py
Created August 24, 2011 19:43
<Trading Game> Mechanical Turk Graphs Generator
def graphs(results):
for user,res in results.items():
clf()
axes([.075,.05, .725,.9])
xlabel('Time')
ylabel('Cash Value')
title('Results for %s' % user)
plot(res[0], res[1], label='Cash in Wallet')
plot(res[0], res[2], label='Inventory Value')
plot(res[0], res[3], label='Net Worth')
@theY4Kman
theY4Kman / tag_counts.txt
Created September 22, 2011 07:37
Tag counts
### Combined tag counts for roles and chat match-ups, for both conditions and per-user
{'aggression': {'conds': {1: 0, 2: 1, 3: 0},
'users': {'buyer': 0,
'buyer_insurer': 0,
'insurer': 0,
'insurer_buyer': 1,
'insurer_seller': 0,
'seller': 0,
'seller_insurer': 0}},
'agreed': {'conds': {1: 1, 2: 0, 3: 1},
@theY4Kman
theY4Kman / Source.html
Created November 23, 2011 00:21
Trying to create a Facebook Like button after page load
<iframe src="http://widgets.awe.sm/v3/fblike_button?href=&send=true&data-layout=button_count&show_faces=false&font=verdana&awesm_key=c4e2cc2a143cd4741589587221017e476474399de7d50b21d73c78f20eaf45da&awesm_user_id_profile_url=http%3A%2F%2Fwww.styleseat.com%2Fp%2F32&awesm_user_id_username=they4kman%2Bcrapbag%40gmail.com&awesm_user_id_icon_url=http%3A%2F%2Fstatic.styleseat.com%2Fstatic%2Fuploads%2F2011%2F11%2F14%2F84eebd0d-c74_14_200x200.jpg&awesm_user_id=122" id="order-sharing-fb" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:150px; height:24px;" allowTransparency="true"></iframe>
@theY4Kman
theY4Kman / Errors!
Created December 1, 2011 04:36
smrepo.sp
SourcePawn Compiler 1.4.0
Copyright (c) 1997-2006, ITB CompuPhase, (C)2004-2008 AlliedModders, LLC
/Users/they4kman/srcds/css/cstrike/addons/sourcemod/scripting/smrepo/smrepo.sp(39) : error 010: invalid function or declaration
/Users/they4kman/srcds/css/cstrike/addons/sourcemod/scripting/smrepo/smrepo.sp(39 -- 44) : error 008: must be a constant expression; assumed zero
/Users/they4kman/srcds/css/cstrike/addons/sourcemod/scripting/smrepo/smrepo.sp(45) : error 010: invalid function or declaration
/Users/they4kman/srcds/css/cstrike/addons/sourcemod/scripting/smrepo/smrepo.sp(45) : error 008: must be a constant expression; assumed zero
/Users/they4kman/srcds/css/cstrike/addons/sourcemod/scripting/smrepo/smrepo.sp(46) : error 010: invalid function or declaration
/Users/they4kman/srcds/css/cstrike/addons/sourcemod/scripting/smrepo/smrepo.sp(46) : error 008: must be a constant expression; assumed zero
/Users/they4kman/srcds/css/cstrike/addons/sourcemod/scripting/smrepo/smrepo.sp(48) : error 017: undefined symbol "
@theY4Kman
theY4Kman / gist:1413691
Created December 1, 2011 04:40
smrepo.sp
#pragma semicolon 1
#include <sourcemod>
#include <rootmenu>
public Plugin:myinfo =
{
name = "SMRepo",
author = "theY4Kman",
description = "Yak's SMRepo client -- SourceMod Plug-in Repository tool",
@theY4Kman
theY4Kman / gist:1559175
Created January 4, 2012 08:54
How to use gists to spread a good idea

github is an excellent idea. It is the solution to the problem of slow development cycles. It solves that by giving you the tools you need to make sharing your code easier. If you share your code with someone, they don't have to write lots of code themselves; they can simply borrow the best ideas in your code. If they have a good idea, they can easily add it in, and share it with more people. It's a positive feedback loop that produces better code, every time it circles.

This doesn't have to apply only to code. Code is just a way to express an idea to a computer. We can use the tools github has given us to make sharing great ideas easier.

@theY4Kman
theY4Kman / gist:1559587
Created January 4, 2012 11:05
Re: reddit -- By FAR my parents' best vinyl record[s] [FIXED]...

In response to: http://www.reddit.com/r/pics/comments/o2d4n/by_far_my_parents_best_vinyl_records_fixed/ Actual content link: http://i.imgur.com/pFJ2O.jpg

We laugh at things when they suddenly make sense. We make sense of things by taking in as much information as we can, and trying to recognize patterns in it. Carlin just lived his whole life trying to experience new things, meet new people, and talk honestly with everyone. If you do that, your brain will physically build stronger connections between the patterns that make the most sense.

If you spent your life experiencing new things, meeting new people, and being