Skip to content

Instantly share code, notes, and snippets.

View lazyatom's full-sized avatar
🤠
Yes

James Adam lazyatom

🤠
Yes
View GitHub Profile
@lazyatom
lazyatom / gist:2759123
Created May 20, 2012 18:51
A Free Man's Worship

That Man is the product of causes which had no prevision of the end they were achieving; that his origin, his growth, his hopes and fears, his loves and his beliefs, are but the outcome of accidental collocations of atoms; that no fire, no heroism, no intensity of thought and feeling, can preserve an individual life beyond the grave; that all the labours of the ages, all the devotion, all the inspiration, all the noonday brightness of human genius, are destined to extinction in the vast death of the solar system, and that the whole temple of Man’s achievement must inevitably be buried beneath the debris of a universe in ruins—all these things, if not quite beyond dispute, are yet so nearly certain, that no philosophy which rejects them can hope to stand. Only within the scaffolding of these truths, only on the firm foundation of unyielding despair can the soul’s habitation be safely built.

-- Bertrand Russell

require "rubygems"
require "bundler/setup"
require "sinatra"
require "base64"
get "/" do
Base64.encode64(File.binread("image"))
end
@lazyatom
lazyatom / Gemfile
Created March 26, 2012 10:25
Looking at comment quality with EuRuKo 2012's pull request CFP strategy
source :rubygems
gem "multi_json"
gem "yajl-ruby"
@lazyatom
lazyatom / 1_test.ino
Created March 7, 2012 16:31
Arduino Ethernet flaky transfer example
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xDE, 0xAD }; //physical mac address
EthernetClient client;
#define debug(a) Serial.print(millis()); Serial.print(": "); Serial.println(a);
#define debug2(a, b) Serial.print(millis()); Serial.print(": "); Serial.print(a); Serial.println(b);
void setup(){
@lazyatom
lazyatom / embed_v2.js
Created November 25, 2011 12:11
embedtweets tweak
var EmbedTweet = {
enableDebugging:false,
automaticEmbedding:true,
doIncludeStylesheet:true,
objRegex:/http(s)?:\/\/twitter\.com\/(#!\/)?([a-z0-9_]+)\/status(es)?\/([0-9]+)/i,
doEmbedClass:"EmbedTweet",
dontEmbedClass:"dontEmbedTweet",
$:function(a){
var b=new Array;
for(var c=0;c<arguments.length;c++){
@lazyatom
lazyatom / gist:1211551
Created September 12, 2011 15:29
pow install issues
➜ ~ $ curl get.pow.cx/uninstall.sh | sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 2547 100 2547 0 0 4138 0 --:--:-- --:--:-- --:--:-- 18456
Sorry to see you go. Uninstall Pow [y/n]? y
*** Uninstalling Pow...
Password:
*** Uninstalled
➜ ~ $ curl get.pow.cx | sh
% Total % Received % Xferd Average Speed Time Time Time Current
@lazyatom
lazyatom / Shell output
Created May 21, 2011 09:25
Why is Rubinius running this method?
$ rvm use default
Using /Users/james/.rvm/gems/ree-1.8.7-2010.02
$ ruby testcase_issue.rb
Loaded suite testcase_issue
Started
.
Finished in 0.000416 seconds.
1 tests, 0 assertions, 0 failures, 0 errors
@lazyatom
lazyatom / gist:981011
Created May 19, 2011 15:24
Rubinius errors
➜ rubinius (master)↑ $ rake
(in /Users/james/Code/experiments/rubinius)
/Users/james/.rvm/rubies/ree-1.8.7-2010.02/bin/ruby vm/codegen/field_extract.rb vm/builtin/object.hpp vm/builtin/integer.hpp vm/builtin/fixnum.hpp vm/builtin/array.hpp vm/builtin/bignum.hpp vm/builtin/executable.hpp vm/builtin/access_variable.hpp vm/builtin/alias.hpp vm/builtin/block_environment.hpp vm/builtin/block_as_method.hpp vm/builtin/bytearray.hpp vm/builtin/io.hpp vm/builtin/channel.hpp vm/builtin/module.hpp vm/builtin/class.hpp vm/builtin/compiledmethod.hpp vm/builtin/data.hpp vm/builtin/dir.hpp vm/builtin/exception.hpp vm/builtin/float.hpp vm/builtin/immediates.hpp vm/builtin/iseq.hpp vm/builtin/list.hpp vm/builtin/lookuptable.hpp vm/builtin/ffi_pointer.hpp vm/builtin/methodtable.hpp vm/builtin/nativefunction.hpp vm/builtin/packed_object.hpp vm/builtin/randomizer.hpp vm/builtin/regexp.hpp vm/builtin/staticscope.hpp vm/builtin/string.hpp vm/builtin/symbol.hpp vm/builtin/thread.hpp vm/builtin/tuple.hpp vm/builtin/compactlookuptab
require 'test/unit/assertions'
include Test::Unit::Assertions
assert_equal "1.9.2", RUBY_VERSION
# A Ruby meta-programming puzzle for polite programmers.
# This puzzle was created by Matt Wynne (@mattwynne) on 2011-04-10 inspired by Jim Weirich's
# talk at the Scottish Ruby Conference 2011.
#
# The challenge is: you have a class Foo which you want to monkey-patch, but politely.
@lazyatom
lazyatom / check_for_escaping_issues.sh
Created February 14, 2011 18:03
log_escaping.diff
#!/bin/sh
wget -O - --save-cookies cookies.txt --post-data "save_login=1&email=EMAIL&password=PASSWORD" http://SITE/session > /dev/null
wget -r -l 1 --spider --save-cookies cookies.txt --load-cookies cookies.txt http://SITE/home