Skip to content

Instantly share code, notes, and snippets.

View h0rs3r4dish's full-sized avatar

Chris Szentkiralyi h0rs3r4dish

View GitHub Profile
@h0rs3r4dish
h0rs3r4dish / imgur-grab.rb
Created March 5, 2012 23:59
Download imgur albums all at once
#!/usr/bin/env ruby
require "net/http"
if ARGV.length == 0 then
puts "Usage: #{__FILE__.split('/').last} album loc [albumN locN ...]"
exit
end
while ARGV.length > 0
@h0rs3r4dish
h0rs3r4dish / rlsp.rb
Created October 27, 2009 22:33
LISP in <200 lines of Ruby
#!/usr/bin/ruby
RLSP_VERSION = "1.4.2"
class Lambda
attr_accessor :args, :body
def initialize(args=[],body="")
@args = (args.class == Array) ? args : [args]
@body = body
end
@h0rs3r4dish
h0rs3r4dish / README.markdown
Created September 18, 2009 03:43
scratch.rb, a Ruby web 'work

A Note

Forking has been fixed, but the old repositories will still be corrupted.

Basics

The method page will create a new page: page "home" do "Hello, world!"

@h0rs3r4dish
h0rs3r4dish / cf-games.sh
Created July 27, 2013 18:10
Quick workaround for the CrossFit Games stream geolocation blocking. For some reason, the Games site just loads some JS from an external provider, so we just inject our own non-US result there via a Python webserver.
#!/bin/sh
FOLDER=cfgames_locationfake
# Ensure we're able to use sudo
amiroot=$(sudo whoami)
if [ "$amiroot" != "root" ]; then
echo "You must have sudo permission to run this script."
exit 1
fi
@h0rs3r4dish
h0rs3r4dish / demo-output.txt
Created April 13, 2012 20:17
Inline Ruby tests
$ ruby inline-test.rb demo.rb
demo.rb
my_function ..
first ..
Foo#bar .
Bar::Baz#bar ..
7/7 tests passed in 0.113 seconds
$
@h0rs3r4dish
h0rs3r4dish / meth.markdown
Created July 14, 2011 20:26
IAmA Former meth addict

Preface

About a month ago, "s0ck" made an "ask me anything" thread on Reddit. It's probably the absolute best description of a meth user I've ever seen, probably because it comes from. Watching Breaking Bad only makes me realize how spot-on that show is in how it portrays meth culture.

This document's basically what I find to be the most important and interesting bits of the IAmA thread.

Contents

@h0rs3r4dish
h0rs3r4dish / spec_runner.rb
Created April 3, 2011 18:16
This is my <100-line spec framework, and some accompanying demo code that showcases all the features.
#!/usr/bin/env ruby
module Spec
class AssertionError < Exception; end
class Should
def initialize(obj, invert=false)
@invert = invert
@self = obj
end
@h0rs3r4dish
h0rs3r4dish / tcg-commands.md
Created December 23, 2010 20:25
A command reference for the Ruby Dvorak TCG IRC bot

Dvorak TCG Command Reference

All commands need to either be sent to the bot via a PM, or prefixed with the command character (default: ;)

Table of Contents

@h0rs3r4dish
h0rs3r4dish / tree.rb
Created March 18, 2010 22:54
A pure-Ruby 'tree' utility
#!/usr/bin/ruby
=begin
Changelog for 1.7
* Fixed a bug where bottom-level directories did not, in fact, have their '/'
* Allowed the specification of flags and directories in any order. Thus, the
results of `tree -depth 1 test` and `tree test -depth 1` are identical, and
either can be used.
Changelog for 1.6.2
@h0rs3r4dish
h0rs3r4dish / jsrepl.html
Created January 2, 2010 05:57
A Javascript REPL/console thing
<html>
<head>
<title>Javascript REPL</title>
<script type="text/javascript">
function $(i){return document.getElementById(i);}
</script>
</head>
<body>
<pre><span id="repl"></span><span style="font-size:12px;">&#x2588;</span></pre>
<script type="text/javascript">