Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View pricees's full-sized avatar

Ted Price pricees

View GitHub Profile
echo "Hello World"
echo "Hello\nWorld"
echo "\nLoad another file into context"
. load_vars
echo "Loaded \$VAR from . load_vars and its value is: $VAR"
echo "Script is also environmentally conscious: \$HOME = ${HOME}"
@pricees
pricees / how-computer-works.txt
Created March 30, 2017 03:10
How a computer works...slide info
CPU
Control Unit
- Portillos Manager
- Tells input, output, memory and alu how to respond to instruction
- Here are those binary logic gates that we know and love
- When we say a computer is 1HZ it means it can execute a single instuction 1
time per second. A 2.4 Ghz machine is 2.4B instructions per unit. Times 4
cores!!
Algorithm/Logic Unit
- Algorithmic: add, substract, multiple, divide
@pricees
pricees / stocks.rb
Created March 1, 2017 03:01
Stock parser
#!/usr/bin/env ruby
cap_range =
case (ARGV[1] || '').downcase
when /small/
puts "Filtering small caps: 50MM - 2B"
0...2_000
when /mid/
puts "Filtering mid caps: 2B - 10B"
2_000...10_000
@pricees
pricees / open3.rb
Last active February 17, 2017 17:50
interactive shell through ruby
require 'open3'
Open3.popen3("ssh -t myserver.net") do |stdin, stdout, stderr, th|
# STDIN
Thread.new {
until stdin.closed? do stdin.puts gets.strip; end
}
# STDOUT
thr_out = Thread.new {
@pricees
pricees / 4hww.txt
Created January 25, 2017 06:34
four hour work week crap
1. Define my worst nightmare if I took off a year from work?
2. What steps could I take to get back under control
3. Benefits, proposal or definite good outcomes
4. What could I do to get financially stable
5. What is keeping me from doing it.
1. Am I being productive or just active?
2. Am I doing something to avoid doing what I need to do?
Calls to make
@pricees
pricees / ruby-fun-2017-01-03.rb
Last active January 5, 2017 20:16
2017-01-03 Lightning Talk
# `warn`
# Use to write to stderr
puts "Hello stdout!"
warn "Hello stderr!"
# ruby __FILE__ 1> stdout.txt 2> stderr.txt
####################################################################
# `included_modules`
@pricees
pricees / nullobject.rb
Last active September 16, 2016 17:09
Basic Null Object for use in the Rubies
# A simple null object
class NullObject < BasicObject
def to_ary; nil end # Handle the `puts call to_ary` don't ask
# Add the attributes, methods you care to define here
# ...
#
# def name
# 'Nully'
# end
@pricees
pricees / finances_lightning_talk.md
Last active May 5, 2016 18:08
Lightning talk: finances and investing

Finance / Investing

Basics

Asset - puts money into your wallet
Liability - takes money out of your wallet

Examples

Job? House? Car?

@pricees
pricees / core_ext.rb
Last active March 30, 2016 16:53
Some fun core extension methods
# Read here: http://edgeguides.rubyonrails.org/active_support_core_extensions.html
# require "active_support/core_ext/object/blank.rb" # Load Blank module
# require "active_support/core_ext/object" # Load all Object core ext
# require "active_support/core_ext" # Load all core ext
# require "active_support/all" # Load all active support
require "active_support/dependencies/autoload"
require "active_support/core_ext"
###################################################
@pricees
pricees / learn_clojure_recipe.md
Created March 4, 2016 05:21
Recipe to Learn Clojure