Skip to content

Instantly share code, notes, and snippets.

💭
be gay, do crimes

Kyle Kingsbury aphyr

💭
be gay, do crimes
Block or report user

Report or block aphyr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:174012
# From rails/activesupport/lib/active_support/dependencies.rb:333
# Ulysses forgets standard library, complains instead:
# http://dev.rubyonrails.org/changeset?new=trunk%2Factivesupport%2Flib%2Factive_support%2Fdependencies.rb%404728&old=trunk%2Factivesupport%2Flib%2Factive_support%2Fdependencies.rb%404681
# Search for a file in load_paths matching the provided suffix.
def search_for_file(path_suffix)
path_suffix = path_suffix + '.rb' unless path_suffix.ends_with? '.rb'
load_paths.each do |root|
path = File.join(root, path_suffix)
return path if File.file? path
View gist:176449
class API::Comment < Sequel::Model(:group_audits)
# Comments, as we're interested in them, are review_videos and add_videos.
reviews = API::Comment.filter(:group_audits__action => 'review_video')
adds = API::Comment.filter(
{:group_audits__action => 'add_video'} &
(:length.sql_function(:group_audits__text) > 0)
)
set_dataset reviews.union(adds).opts[:from].first.expression
View gist:732302
function(v, keydata) {
user = JSON.parse(v.values[0].data);
user.source = [keydata];
user.key = v.key;
return [user];
}
View gist:732494
POST /mapred HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 795
X-Riak-Clientid: Lr5XMw==
Host: 192.168.1.116:8098
{"inputs":[["tablet_feeds","kyletest2"]],"query":[{"map":{"arg":{"limit":32,"offset":0},"language":"javascript","keep":false,"source":"\n function(v, keydata, opts) {\n o = JSON.parse(v.values[0].data);\n items = o.items.slice(opts.offset, opts.offset + opts.limit);\n return items.map(function(item) {\n return ['tablet_feed_items', item]\n });\n }\n "}},{"map":{"language":"javascript","keep":false,"source":"\n function(v) {\n o = JSON.parse(v.values[0].data);\n o.key = v.key;\n return [o];\n }\n "}},{"reduce":{"language":"javascript","keep":true,"source":"\n function(items) {\n return items.sort(function(a, b) {\n return(a.created_at < b.created_at);\n })\n }\n "}}]}HTTP/1.1 500 Internal Server Error
Server: MochiWeb/1.1 WebMachine/1.7.2 (parti
View gist:1077487
(10:54:19 PM) Loren Bruns: The VLT (Very Large Telescope), when configured in optical interferometry mode with all 4 telescopes working together, gives it an angular resolution that can resolve an object of what scale on the moon?
(10:54:30 PM) Aphyr: oooh, interferometry
(10:54:42 PM) Aphyr: Let's go with... rubix hypercube.
(10:55:15 PM) ***Aphyr actually does some math
(10:55:35 PM) Aphyr: OK, 4 8 meter telescopes
(10:55:55 PM) Aphyr: in interferometry mode they are 25x finer resolution limit
(10:56:21 PM) Loren Bruns: Oh, you're actually looking things up.
(10:56:26 PM) Aphyr: the diffraction limit for an 8.2 meter mirror is...
(10:56:26 PM) Aphyr: uhh
(10:56:38 PM) Loren Bruns: I just figured you would guess and I would tell you.
View gist:1081555
$ git pull
Warning: fetch updated the current branch head.
Warning: fast-forwarding your working tree from
Warning: commit 44c6b4dde98f6c7c07cca7f23ae14900fd73ad19.
Already up-to-date. Yeeah!
View gist:1258495
The riak-users list receives regular questions about how to secure a riak
cluster. I'd like to take a step back and discuss what application security means in general, and talk about what layers you can implement various security policies at.
Theory
======
You can skip this, but it may be a helpful primer.
Consider an application composed of agents (Alice, Bob) and a datastore (Store). All events in the system can be parameterized by time, position (whether the event took place in Alice, Bob, or Store), and the change in state. Of course, these events do not occur arbitrarily; they are connected by causal links (wires, protocols, code, etc.)
View gist:1262768
[pom.xml] generating file
[deps] Fetching dependencies...
Downloading: classlojure/classlojure/0.6.2/classlojure-0.6.2.pom from repository clojure at http://build.clojure.org/releases
Unable to locate resource in repository
[INFO] Unable to find resource 'classlojure:classlojure:pom:0.6.2' in repository clojure (http://build.clojure.org/releases)
Downloading: classlojure/classlojure/0.6.2/classlojure-0.6.2.pom from repository clojure-snapshots at http://build.clojure.org/snapshots
Unable to locate resource in repository
[INFO] Unable to find resource 'classlojure:classlojure:pom:0.6.2' in repository clojure-snapshots (http://build.clojure.org/snapshots)
Downloading: classlojure/classlojure/0.6.2/classlojure-0.6.2.pom from repository clojars at http://clojars.org/repo
Unable to locate resource in repository
View gist:1262812
(defproject ustate "0.0.1-SNAPSHOT"
:description "A state aggregation daemon"
:tasks [protobuf.tasks]
:dependencies [
[org.clojure/clojure "1.2.1"]
[classlojure "0.6.1"]
[clojure-protobuf "0.4.6"]]
:dev-dependencies [
[cake-protobuf "0.5.0-alpha5"]]
:tasks [protobuf.tasks]
View gist:1366237
pp e
#<struct Riak::Client::Pool::Element object=[], owner=#<Thread:0x9e30248 run>>
pp @pool
#<Set: {#<struct Riak::Client::Pool::Element
object=[],
owner=#<Thread:0x9e30248 run>>}>
pp e.hash
317069887
You can’t perform that action at this time.