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 / 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
@jefflunt
jefflunt / syslog
Created August 16, 2013 16:06
PPTP debug log
pi@pi ~ $ tail -n 10000 /var/log/syslog
Aug 6 15:40:00 pi pppd[1479]: Connection terminated.
Aug 6 15:40:00 pi avahi-daemon[2868]: Withdrawing workstation service for ppp0.
Aug 6 15:40:00 pi pppd[1479]: using channel 1815
Aug 6 15:40:00 pi pppd[1479]: Using interface ppp0
Aug 6 15:40:00 pi pppd[1479]: Connect: ppp0 <--> /dev/pts/0
Aug 6 15:40:00 pi pptp[14671]: anon fatal[get_ip_address:pptp.c:437]: getaddrinfo(): Name or service not known
Aug 6 15:40:00 pi pppd[1479]: Script pptp [VPN SERVER IP] --nolaunchpppd --debug finished (pid 14670), status = 0x1
Aug 6 15:40:00 pi pppd[1479]: Modem hangup
Aug 6 15:40:00 pi pppd[1479]: Connection terminated.
@jefflunt
jefflunt / gist:6098923
Last active December 20, 2015 08:09
Sample SSH config
# What ports, IPs and protocols we listen for
Port 22
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
UsePrivilegeSeparation yes
@jefflunt
jefflunt / summarized order.rb
Created May 15, 2013 18:24
Order model - after
class Order < ActiveRecord::Base
# This array includes the list of possible states that an Order can be in. These reflect the steps
# that an order goes through from placement to fulfilment.
#
# nil The initial state of any Order record
# checking_terminals Checking if the terminals involved in this order are online
# terminals_offline One of more of the printers/terminals for this order are offline
# charging Attempting to charge the customer's credit card via BrainTree
# failed_to_charge BrainTree returned an error
@jefflunt
jefflunt / summarized order.rb
Created May 15, 2013 18:24
Order model - before
class Order < ActiveRecord::Base
...
after_initialize :init
before_validation :can_be_placed?
before_save :process_transaction, :on => :create
validates :customer_id,
:company_id,