Skip to content

Instantly share code, notes, and snippets.

View jefflunt's full-sized avatar
🌴
On vacation

Jeff Lunt jefflunt

🌴
On vacation
View GitHub Profile
wget https://github.com/yudai/gotty/releases/download/v1.0.1/gotty_linux_amd64.tar.gz
tar -xvf gotty_linux_amd64.tar.gz
rm gotty_linux_amd64.tar.gz
@jefflunt
jefflunt / ruby-2.5.1-rbenv
Last active March 24, 2019 13:47
ubuntu ruby 2.5.1 install w/rbenv
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install -y libssl-dev libreadline-dev zlib1g-dev libpq-dev build-essential
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
cd ~/.rbenv && src/configure && make -C src
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
mkdir -p "$(rbenv root)"/plugins
git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
@jefflunt
jefflunt / mac-brew-rbenv-install
Last active January 23, 2019 05:59
mac-ruby-2.5.1-install
#!/usr/bin/env bash
set -e
# X-Code
xcode-select --install
# Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# rbenv
@jefflunt
jefflunt / animals
Last active August 29, 2015 14:06
animal-module
def cow():
"""See: http://en.wikipedia.org/wiki/Cattle"""
return {
'sound': 'moo',
'legs': 4,
'covering': 'hair'
}
def horse():
"""See: http://en.wikipedia.org/wiki/Horse"""
@jefflunt
jefflunt / foobar
Last active August 29, 2015 14:06
"""
The FooBar Card Game!
The game is simple:
1. Start a deck of cards
2. Shuffle the deck
3. Every player has a "hand" - a list of cards they are holding
4. Deal all cards from the deck as evenly as possible to all players
5. Score the cards - the player with the highest score WINS!"
@jefflunt
jefflunt / gist:c382083c7b8853974437
Last active August 29, 2015 14:01
Handling hashes
> text = 'some text'
=> "some text"
> hash_options = {rant_id:1,date:11/04/2014,top:text,number:12}
=> {:rant_id=>1, :date=>0, :top=>"some text", :number=>12}
NOTE that 'date' gets set to zero, because it's being interpreted as, "11 divided by 04 divided by 2014"
Also this:
> hash_options = rant_id:1,date:11/04/2014,top:text,number:12
@jefflunt
jefflunt / Gemfile
Created February 23, 2014 23:36
Basic ruby script to pull active listings and match against a strategy every 300 milliseconds (max)
source "https://rubygems.org"
gem 'curb'
@jefflunt
jefflunt / order.rb
Last active January 3, 2016 01:09
Writing tests for AR validations
class Order < ActiveRecord::Base
...
validates :customer_id,
:company_id,
:credit_card_id,
:tip,
:delivery_location,
presence: true
@jefflunt
jefflunt / game.rb
Created November 21, 2013 19:58
Bowling game scorer with visual score output and per-frame or aggregate scoring.
# Contains a list of rolls that a bowling player throws, and from that can tell
# you the score of the game in progress or finished, the visual score (with 'X'
# and '/', etc.), and the score of any frame within the game.
#
# Examples:
#
# > g = Game.new
# => []
#
# > g.roll(3)
@jefflunt
jefflunt / pptp-conf
Created August 16, 2013 16:41
pptp config file
[lines containing credentials and VPN server IP address excluded]
remotename PPTP
require-mppe-128
require-mschap-v2
refuse-eap
refuse-pap
refuse-chap
refuse-mschap
noauth