Rails 3.0 introduced support for routing constrained by subdomains.
A subdomain can be specified explicitly, like this:
match '/' => 'home#index', :constraints => { :subdomain => 'www' }
sudo apt-get update | |
sudo apt-get install libjemalloc-dev | |
RUBY_CONFIGURE_OPTS='--with-jemalloc' rbenv install 2.6.3 | |
# test (look for jemalloc warnings) | |
MALLOC_CONF=invalid_flag:foo ruby -v |
# lib/custom_logger.rb | |
class CustomLogger < Logger | |
def format_message(severity, timestamp, progname, msg) | |
"#{timestamp.to_formatted_s(:db)} #{severity} #{msg}\n" | |
end | |
end | |
logfile = File.open("#{Rails.root}/log/custom.log", 'a') # create log file | |
logfile.sync = true # automatically flushes data to file | |
CUSTOM_LOGGER = CustomLogger.new(logfile) # constant accessible anywhere |
--[[ | |
redis_factory.lua | |
Redis factory method. | |
You can also find it at https://gist.github.com/karminski/33fa9149d2f95ff5d802 | |
@version 151019:5 | |
@author karminski <[email protected]> | |
@license MIT |
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
# | |
# See http://www.cnblogs.com/ma6174/archive/2012/05/25/2508378.html | |
import pexpect | |
import paramiko | |
import threading | |
import yaml |
require_relative 'customer.rb' | |
require_relative 'contact.rb' | |
require_relative 'agent.rb' | |
module Api | |
module V1 | |
module Entities | |
class Ticket < Grape::Entity | |
expose :id |
2.1 原厂固件中,直接web页面升级 2.2 已刷openwrt的话,telent/ssh登录,下载bin文件到/tmp,运行'sysupgrade -i /tmp/openwrt-ar71xx-ubnt-rspro-squashfs-sysupgrade.bin'
class Api::RegistrationsController < Api::BaseController | |
respond_to :json | |
def create | |
user = User.new(params[:user]) | |
if user.save | |
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201 | |
return | |
else |
#!/usr/bin/env ruby | |
# Usuage | |
# things 'thisweek' | |
# things 'lastweek' | |
# things 'thismonth' | |
require 'fileutils' | |
require 'date' | |
# please install the following 5 gems. |
# .railsrc | |
-B #Skip Bundle | |
-T #Skip Test-Unit | |
-d postgresql #Use postgres |