MacBook Air
11-inch, Mid 2011
Core i5
# encoding: UTF-8 | |
require 'rubygems' | |
require 'bundler/setup' | |
require 'active_support/inflector' | |
require 'iconv' | |
puts %[ | |
This is why String#encode does not replace Iconv, and neither | |
does ActiveSupport::Inflector#transliterate: |
require 'yaml' | |
case RUBY_VERSION[0,3] | |
when "1.9" | |
YAML::ENGINE.yamler = 'syck' | |
yaml_engine = YAML::ENGINE.yamler | |
when "1.8" | |
yaml_engine = 'syck' | |
end |
Started POST "/" for 74.219.112.36 at 2013-01-11 12:19:49 -0500 | |
Processing by HomeController#show as HTML | |
Parameters: {"probe"=>"\nhello\n"} | |
WARNING: Can't verify CSRF token authenticity | |
'tNP0fR/248lmaZccj/WleU2JCvcd1ctijY4LEgIwJ6s=' does not match: '' or '' | |
User ID: | |
CSRF Token: wzLcrQko1DJyQ+gh5gCTYGXRs0uNRuUUqvQyADf+Ejs= | |
Redirected to http://<server_ip>/login | |
Completed 302 Found in 2ms (ActiveRecord: 0.0ms) | |
Started POST "/" for 74.219.112.36 at 2013-01-11 12:19:50 -0500 |
#!/usr/bin/env ruby | |
require 'benchmark' | |
require 'date' | |
require 'securerandom' | |
Benchmark.bm(15) do|b| | |
ITERATE = 100_000 | |
timestamp = Proc.new {Time.now.strftime('%Y-%m-%d %H:%M:%S.%L')} | |
b.report("proc time call") do |
#!/usr/bin/env ruby -w -s | |
# -*- coding: utf-8 -*- | |
require 'axlsx' | |
## Some documentation ## | |
### Axlsx Gem ### | |
# Axlsx Docs: http://rubydoc.info/gems/axlsx/frames | |
# Axlsx::DataValidation: http://rubydoc.info/gems/axlsx/Axlsx/DataValidation |
# Write a program that prints the numbers from 1 to 100. But for multiples of | |
# three print “Fizz” instead of the number and for the multiples of five print | |
# “Buzz”. For numbers which are multiples of both three and five print | |
# “FizzBuzz”. | |
(1..100).each do |i| | |
f = "Fizz" if i % 3 == 0 # should we print fizz? | |
b = "Buzz" if i % 5 == 0 # should we print buzz? | |
if f||b # if fizz or buzz... |
# Write a program that prints the numbers from 1 to 100. But for multiples of | |
# three print “Fizz” instead of the number and for the multiples of five print | |
# “Buzz”. For numbers which are multiples of both three and five print | |
# “FizzBuzz”. | |
(1..100).each do |i| | |
f = "Fizz" if i % 3 == 0 | |
b = "Buzz" if i % 5 == 0 | |
if f||b |
module MyApps | |
# The MyApps module illustrates a common | |
# The first app class includes a call to Signal::trap | |
class App1 | |
def initialize | |
@pid = Process.pid | |
end |
# UFW commands issued | |
ufw default deny | |
ufw allow 22 | |
ufw allow 10000 | |
ufw allow 3306 from IP_REDACTED | |
ufw limit ssh/tcp | |
uwf logging on | |
ufw enable |