Skip to content

Instantly share code, notes, and snippets.

Horace Williams worace

Block or report user

Report or block worace

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
@worace
worace / solo.rb
Created Jun 4, 2012
Sample chef solo base file
View solo.rb
file_cache_path File.expand_path("../", __FILE__)
cookbook_path File.expand_path("../cookbooks", __FILE__)
json_attribs "https://raw.github.com/gist/2861861/f4a5f4b78f5cd88813151be598a4782bfbbb0ed4/node.json"
recipe_url "https://github.com/worace/chef-repo/blob/master/vim-chef-solo-tar.gz?raw=true"
View tasilo.zsh-theme
# tassilo's zsh from http://tsdh.wordpress.com/2007/12/06/my-funky-zsh-prompt/
# stashing this for reference for colors :)
local blue_op="%{$fg[blue]%}[%{$reset_color%}"
local blue_cp="%{$fg[blue]%}]%{$reset_color%}"
local path_p="${blue_op}%~${blue_cp}"
local user_host="${blue_op}%n@%m${blue_cp}"
local ret_status="${blue_op}%?${blue_cp}"
local hist_no="${blue_op}%h${blue_cp}"
local smiley="%(?,%{$fg[green]%}:%)%{$reset_color%},%{$fg[red]%}:(%{$reset_color%})"
PROMPT="╭─${path_p}─${user_host}─${ret_status}─${hist_no}
View memoize.rb
1.9.3-p448 :014 > class MyClass
1.9.3-p448 :015?> def my_config
1.9.3-p448 :016?> @@my_config ||= nil
1.9.3-p448 :017?> end
1.9.3-p448 :018?> def my_config=(setting)
1.9.3-p448 :019?> @@my_config = setting
1.9.3-p448 :020?> end
1.9.3-p448 :021?> end
1.9.3-p448 :022 > config = MyClass.new
=> #<MyClass:0x007faa21080d40>
View gist:8570472
horacewilliams @ WoracesWorkshop / level1 / master ➸ ruby miner.rb
the content is:
tree 0dcb7aa769718cbded43797b27130f2387335ac6
parent 0000002cb344c4fb2cd6d8d08e4c0f0b4c8bb5ff
author CTF user <me@example.com> 12345 +0000
committer CTF user <me@example.com> 12345 +0000
Give me a Gitcoin
View gist:8571597
require 'digest/sha1'
class Miner
attr_reader :tree, :parent, :timestamp
def initialize
@tree=`git write-tree`.chomp
@parent=`git rev-parse HEAD`.chomp
@timestamp=12345
prepare_index
end
View gist:8653905
require 'sinatra'
require 'json'
require 'ruby-prof'
class Index
attr_reader :base_path, :index
def initialize(base_path)
@base_path = base_path
end
View crackle_pop.rb
def cracklepop(i)
if i % 15 == 0
"CracklePop"
elsif i % 5 == 0
"Pop"
elsif i % 3 == 0
"Crackle"
else
i
end
View tic_tac_toe.rb
module TicTacToe
class Application
def run
display_launch_options
end
def display_launch_options
puts "n: New Game"
puts "q: Quit"
selection = gets
View gist:4b1d430db1c7be257023
2014-09-15 00:13:11.917 troutr-ios[37485:60b] Cannot find executable for CFBundle 0xb76f4e0 </Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/System/Library/AccessibilityBundles/GeoServices.axbundle> (not loaded)
2014-09-15 00:13:11.922 troutr-ios[37485:60b] Cannot find executable for CFBundle 0xb64f090 </Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/System/Library/AccessibilityBundles/StoreKitFramework.axbundle> (not loaded)
2014-09-15 00:13:11.925 troutr-ios[37485:60b] Cannot find executable for CFBundle 0xb65a190 </Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/System/Library/AccessibilityBundles/CertUIFramework.axbundle> (not loaded)
2014-09-15 00:13:11.992 troutr-ios[37485:60b] authentication loadview
2014-09-15 00:13:11.992 troutr-ios[37485:60b] auth view init
2014-09-15 00:13:11.993 troutr-ios[37485:60
View exercise-loops-and-functions.go
package main
import (
"fmt"
"math"
)
func guessOutsideDelta(guess, x float64) bool {
delta := .00000000001
return (math.Abs(guess * guess - x) > delta)
You can’t perform that action at this time.