Skip to content

Instantly share code, notes, and snippets.

@honorlin
honorlin / gist:d676bfe1d4312482d3d6
Created January 14, 2016 05:51
Rails production environment on Ubuntu 14.04 LTS use Unicrom
$ adduser apps
@honorlin
honorlin / digital_ocean_setup.md
Last active January 14, 2016 07:18 — forked from ChuckJHardy/digital_ocean_setup.md
DigitalOcean Ubuntu 14.04 x64 + Rails 4 + Nginx + Unicorn + PostgreSQL + Capistrano 3 Setup Instructions

DigitalOcean Ubuntu 14.04 x64 + Rails 4 + Nginx + Unicorn + PostgreSQL + Capistrano 3

SSH into Root

$ ssh root@123.123.123.123

Change Root Password

<!doctype html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$(".btn0").click(function(){
if ($("#h3-0").html().indexOf("index") < 0) {
$("#h3-0").html(function(m,n){
@honorlin
honorlin / gist:b34d1bba6514d74c24cf
Created August 8, 2015 10:37
Ubuntu Install Lastest ImageMagick-6.9.1-10
sudo -i
cd
apt-get install build-essential checkinstall && apt-get build-dep imagemagick -y
curl -O http://www.imagemagick.org/download/ImageMagick-6.9.1-10.tar.gz
tar xzvf ImageMagick-6.9.1-10.tar.gz
cd ImageMagick-6.9.1-10/
./configure --prefix=/opt/imagemagick-6.9.1-10 && make
checkinstall
@honorlin
honorlin / gist:095f65d68fdc508b44c4
Created May 8, 2015 14:09
ERROR - sh load_data.sh
Loading menus
NOTE: Gem.cache is deprecated, use Gem::source_index. It will be removed on or after 2011-08-01.
Gem.cache called from ./../config/boot.rb:26.
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /home/apps/.rvm/rubies/ruby-1.8.7-head/lib/ruby/site_ruby/1.8/rubygems.rb:1144.
NOTE: Gem::SourceIndex#search is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#search called from ./../config/boot.rb:26.
/home/apps/.rvm/rubies/ruby-1.8.7-head/lib/ruby/site_ruby/1.8/rubygems/deprecate.rb:62:Warning: Gem::SourceIndex#search support for String patterns is deprecated, use #find_name
Loading perms
load_data.sh: 10: ./mysql2pgsql.rb: not found
require 'spec_helper'
describe "root have any permissions", :type => :request do
before do
delete '/signout'
visit "signin"
within(".login_body") do
fill_in 'username', :with => 'root'
fill_in 'password', :with => 'root'
require 'spec_helper'
describe "root have any permissions", :type => :request do
before do
post '/signin', :username => "root", :password => "root"
end
describe "it can access any page" do
it "can access /policy/policies" do
def self.get_class_data(keywords)
job = in_effect
condition = ""
keywords.each { |keyword| condition += with_contains_keyword(keyword)}
condition = condition[0 , condition.length - 3 ]
job.where(condition)
end
def self.with_contains_keyword(keyword)
"lower(job_info) LIKE '%#{keyword.downcase}%' or "
@honorlin
honorlin / gist:575aa565e4a1955bc60d
Last active August 29, 2015 14:05
java password generator
*way 1.
import java.security.SecureRandom;
public final class SessionIdentifierGenerator {
private SecureRandom random = new SecureRandom();
public String nextSessionId() {
return new BigInteger(130, random).toString(32);
}