Skip to content

Instantly share code, notes, and snippets.

View cheald's full-sized avatar

Chris Heald cheald

View GitHub Profile
Android Debug Bridge version 1.0.31
-a - directs adb to listen on all interfaces for a connection
-d - directs command to the only connected USB device
returns an error if more than one USB device is present.
-e - directs command to the only running emulator.
returns an error if more than one emulator is running.
-s <specific device> - directs command to the device or emulator with the given
serial number or qualifier. Overrides ANDROID_SERIAL
environment variable.
PRIMARY> db.rows.insert({posts: [{title: 'foo'}, {title: 'bar'}]})
PRIMARY> db.rows.insert({posts: [{title: 'baz'}, {title: 'bin'}]})
PRIMARY> db.rows.find({posts: {$elemMatch: {title: "foo"}}})
{ "_id" : ObjectId("52147be905abf6eada01c845"), "posts" : [ { "title" : "foo" }, { "title" : "bar" } ] }
PRIMARY> db.rows.find({posts: {$elemMatch: {title: "bin"}}})
{ "_id" : ObjectId("52147bef05abf6eada01c846"), "posts" : [ { "title" : "baz" }, { "title" : "bin" } ] }
chris@luna /var/www/repos $ file steam.html
steam.html: HTML document, UTF-8 Unicode text, with very long lines
chris@luna /var/www/repos $ mv steam.html steam.pdf
chris@luna /var/www/repos $ file steam.pdf
steam.pdf: HTML document, UTF-8 Unicode text, with very long lines
curl -H "Accept-Charset: ISO-8859-1" http://alexanderlloyd.info/json/translation_master.json | hexdump -c | head -n 30
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1886 100 1886 0 0 5994 0 --:--:-- --:--:-- --:--:-- 12167
0000000 357 273 277 { \r \n " d e _ D E
0000010 " : { \r \n " 1
0000020 " : " H E R B S T 2 0 1 3 "
0000030 , \r \n " 2 " :
0000040 " S T I L S I C H E R " , \r \n \t
0000050 \t " 3 " : " K l a s s i s c h
@cheald
cheald / spec.rb
Last active December 19, 2015 09:59
[1] pry(#<MongoMapper::Plugins::Keys::Key>)> show-source @default
From: /var/www/repos/mongomapper/spec/unit/keys_spec.rb
Number of lines: 1
generator = lambda { raise Exception }
[3] pry(#<MongoMapper::Plugins::Keys::Key>)> @default.call
=> nil
[4] pry(#<MongoMapper::Plugins::Keys::Key>)> lambda { raise Exception }.call
Exception: Exception
RSpec::Matchers.define :redirect_to do |expected|
match do |actual|
actual.should be_redirect
actual.location.should include expected
end
end
describe "Twitter route" do
include TwitterOAuth
@cheald
cheald / output
Last active December 18, 2015 12:39
$ go test -test.bench Json -file twitter_test.go
testing: warning: no tests to run
PASS
BenchmarkJsonEncode 50000 53661 ns/op
ok _/var/www/repos/twitter_test 4.038s
c@luna /var/www/repos/test_before_save $ rails c
Loading development environment (Rails 3.2.13)
1.9.3p327 :001 > User.new.save
(0.0ms) begin transaction
(0.0ms) rollback transaction
RuntimeError: Kaboom!
from /var/www/repos/test_before_save/app/models/user.rb:6:in `bomb'
from /usr/local/rvm/gems/ruby-1.9.3-p327-perf/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:407:in `_run__4317644355368665104__save__697132430908302071__callbacks'
# ...
else if ((en>=shred.energy) && (cp<5)&& ((((koj_timer<((shred.energy+rake.energy-10-en)*10) &&
((mdebuff_timer > ((shred.energy+mangle.energy-10-koj_m1-en)*10) && ((rake_timer > ((shred.energy+rake.energy-10-koj_m1-en)*10))||(rk==0))
&& (cp<3) && (mdebuff_timer >= 100+lag) && rake_timer>(0) )||((sr_timer<(100+lag))&&(en>(rake.energy+sr_energy-10)))||((rip_timer<(100+lag))&&(en>(rake.energy+sr_energy-10)))||(koj_timer<(100+lag))))||(((mdebuff_timer > ((shred.energy+mangle.energy-10-en)*10)
&&(( rake_timer > ((shred.energy+rake.energy-10-en)*10))||(rk==0)) && (cp<3) && (mdebuff_timer >= 100+lag) && ((rake_timer>0)||(rk==0)) )
||((sr_timer<(100+lag))&&(en>(rake.energy+sr_energy-10)))||((rip_timer<(100+lag))&&(en>(rake.energy+sr_energy-10)))||(koj_timer<(100+lag)))))||((cp>=3)||(rip_timer<0)))||(time_to_die_boss<=kill_mode)))
chris@luna ~ (master*) $ telnet localhost 8080
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /?name=Chris HTTP/1.0
HTTP/1.1 200 OK
Content-Type: text/html
Server: WEBrick/1.3.1 (Ruby/1.9.3/2012-11-10)
Date: Sat, 13 Apr 2013 00:07:11 GMT