Skip to content

Instantly share code, notes, and snippets.

View cookrn's full-sized avatar
👻

Ryan Cook cookrn

👻
View GitHub Profile
@cookrn
cookrn / screenfetched.rb
Created May 27, 2016 17:00
An easy way to cache `screenfetch` results for a set amount of time so that every new terminal doesn't re-run it
#!/usr/bin/env ruby
if fetched_file_blank? or fetched_file_expired?
fetch!
end
write_cached_screenfetch!
BEGIN {
COMMAND = 'screenfetch'.freeze
@cookrn
cookrn / client.rb
Created December 15, 2015 04:53
A tiny, standard-library only example of attaching to a running process over the network for inspection
#!/usr/bin/env ruby
require 'drb'
require 'irb'
DRb.start_service
$context = DRbObject.new_with_uri('druby://localhost:9876')
IRB.start
@cookrn
cookrn / keybase.md
Created March 26, 2015 00:56
keybase.md

Keybase proof

I hereby claim:

  • I am cookrn on github.
  • I am cookrn (https://keybase.io/cookrn) on keybase.
  • I have a public key whose fingerprint is 15DF D0D1 294D FE92 BBFE 47AC A77A 94F0 1103 1D5B

To claim this, I am signing this object:

use std::io::println;
fn is_three(num: int) -> bool {
num % 3 == 0
}
fn is_five(num: int) -> bool {
num % 5 == 0
}
example21.rs:70:13: 70:19 error: mismatched types: expected `&str` but found `collections::string::String` (expected &-ptr but found struct collections::string::String)
example21.rs:70 println(answer);
^~~~~~
error: aborting due to previous error
@cookrn
cookrn / quotes.md
Last active August 29, 2015 14:02
A collection of some much appreciated quotes

The bat­tle we have fought, and are still fight­ing for the forests is a part of the eter­nal con­flict between right and wrong, and we can­not expect to see the end of it. …So we must count on watch­ing and striv­ing for these trees, and should always be glad to find any­thing so surely good and noble to strive for.

--john muir

====================

Trying to live a spiritual life in modern society is the most difficult path one can walk. It is a path of pain, of isolation, and of shaken faith, but that is the only way that our Vision can become reality. Thus the true Quest in life is to live the philosophy of the Earth within the confines of man. There is no church or temple we need to seek peace, for ours are the temples of the wilderness. There are no spiritual leaders, for our hearts and the Creator are our only leaders. Our numbers are scattered; few speak our language or understand the things that we live. Thus we walk this path alone, for each Vision, each Quest, is unique unto the individual. B

@cookrn
cookrn / a.rb
Last active August 29, 2015 14:01 — forked from ahoward/a.rb
# fork it
#
# make it print all true with only ONE LINE OF CODE
class A
def A.foo
@foo ||= (
if self == A
'42.0'
else
@cookrn
cookrn / a.rb
Last active August 29, 2015 14:01 — forked from ahoward/a.rb
# make this script run, update your gist with the running script, and it's
# output in a separate gist. the entire quzi should take 1-3 minutes, but you
# get 5.
#
# the meat - take < 5 minutes to do this
#
assert :hash do
x = Hash.new
@cookrn
cookrn / a.rb
Last active January 2, 2016 21:59
What would a library for Ruby look like that implemented some sort of runtime type checking?
class Printer
attr_reader :printer
deftyped :initialize , :printer => [ Proc ] do
@printer = printer
end
deftyped :print , :string => { :splat => true , :type => String } do
printer.call string.join( ' ' )
end
@cookrn
cookrn / _requirements.md
Last active December 28, 2015 22:49
Setting up an iPad 1 to be an Ansible Node

Setting up an iPad 1 to be an Ansible Node

  1. Update the iPad (v5.1.1?) to the latest iOS and make a backup using iTunes
  2. Install the sshpass program on your laptop. Ansible will need this to connect over ssh using a password.
  3. Jailbreak the iPad using redsn0w -- you now have Cydia
  4. Use Cydia to install "MobileTerminal", "OpenSSH", "Python", and "Setup Tools"
  5. Follow the "MobileTerminal" instructions in Cydia for changing the default passwords
  6. Locate your iPad's IP address by looking in Settings.app > Wi-Fi and clicking your connected networks detail ">" arrow
  7. SSH into your iPad and make sure you add IP address to list of known hosts
  8. Place IP address into an Ansible hosts file