Skip to content

Instantly share code, notes, and snippets.

#################################
#
# 本清单基于 ubuntu 12.04,
#
# 只是一个清单,不是一个可以安全执行的脚本
#
#################################
# create a linode,login as root, and create a common user for all the tasks
ssh root@the_ip_of_this_linode
@lazybios
lazybios / 0_reuse_code.js
Last active August 29, 2015 14:23
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@lazybios
lazybios / cancan-grape.rb
Last active August 26, 2015 15:04 — forked from thomasbiddle/cancan-grape.rb
CanCan helper for a Grape API implementation
def authorize!(role={}, object)
ability = Ability.new(current_user)
unless ability.can?(role, object)
unauthorized!
end
end
@lazybios
lazybios / Rakefile
Last active September 5, 2015 15:32 — forked from twistedmind/Rakefile
directory "tmp"
file "tmp/hello.tmp" => "tmp" do
sh "echo 'Hello' > 'tmp/hello.tmp'"
end
task :default => 'morning:turn_off_alarm'
namespace :morning do
desc "Turn off alarm."
@lazybios
lazybios / jaccard_recommendation.rb
Last active September 18, 2015 06:13 — forked from otobrglez/jaccard_recommendation.rb
Simple recommendation system written in Ruby based on Jaccard index.
#!/usr/bin/env ruby
# Please read http://otobrglez.opalab.com for more information about this code.
class Book < Struct.new(:title)
def words
@words ||= self.title.gsub(/[a-zA-Z]{3,}/).map(&:downcase).uniq.sort
end
@lazybios
lazybios / route.sh
Created September 28, 2015 15:12 — forked from kevinzhow/route.sh
AnyConnect 路由表
route = 8.0.0.0/255.0.0.0
route = 58.0.0.0/255.0.0.0
route = 23.0.0.0/255.0.0.0
route = 117.0.0.0/255.0.0.0
route = 199.0.0.0/255.0.0.0
route = 190.0.0.0/255.0.0.0
route = 198.0.0.0/255.0.0.0
route = 173.0.0.0/255.0.0.0
route = 174.0.0.0/255.0.0.0
route = 168.0.0.0/255.0.0.0
@lazybios
lazybios / gist:e58a0e208b804e6c368a
Created October 6, 2015 09:39 — forked from BenjaminKim/gist:6590816
Calculate average of response time in Rails 3 server.
cat log/production.log| grep "^Completed .* in [0-9]*ms .*" | sed "s/.* in \([0-9]*\)ms.*/\1/" | awk '{ s += $1 } END { print "sum: ", s, " average: ", s/NR, " samples: ", NR }'
@lazybios
lazybios / digital_ocean_setup.md
Created October 16, 2015 14:38 — forked from ChuckJHardy/digital_ocean_setup.md
DigitalOcean Ubuntu 14.04 x64 + Rails 4 + Nginx + Unicorn + PostgreSQL + Capistrano 3 Setup Instructions
@lazybios
lazybios / Rakefile
Created October 20, 2015 00:20 — forked from jerodsanto/Rakefile
A code dump showing how we generate "The Changelog Weekly" using the Trello API
require "rubygems"
require "bundler"
require_relative "lib/importer"
Bundler.setup
desc "Import from Trello board"
task :import do
Importer.new(File.dirname(__FILE__)).import ENV["ISSUE"]
end
@lazybios
lazybios / .railsrc
Created December 21, 2015 10:48 — forked from ivanoats/.railsrc
# .railsrc
-B #Skip Bundle
-T #Skip Test-Unit
-d postgresql #Use postgres