Skip to content

Instantly share code, notes, and snippets.

Sandy Xu sandyxu

  • Shanghai, China
Block or report user

Report or block sandyxu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sandyxu
sandyxu / ssh-add-private-key.md
Created Jul 8, 2016
SSHKit::Runner::ExecuteError: Exception while executing git stderr: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
View ssh-add-private-key.md

报错信息如下:

SSHKit::Runner::ExecuteError: Exception while executing as gdw_dev@115.29.148.211: git exit status: 128
git stdout: Nothing written
git stderr: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
fatal: The remote end hung up unexpectedly

SSHKit::Command::Failed: git exit status: 128
git stdout: Nothing written
@sandyxu
sandyxu / gem-env-path
Last active Oct 28, 2015
Display information about the RubyGems environment
View gem-env-path
gem help environment
Arguments:
packageversion display the package version
gemdir display the path where gems are installed
gempath display path used to search for gems
version display the gem format version
remotesources display the remote gem servers
platform display the supported gem platforms
<omitted> display everything
@sandyxu
sandyxu / seo-wiki.md
Created Jun 11, 2015
seo 优化细节
View seo-wiki.md

一、链接伪静态问题 1、分类链接,如:http://www.ikcrm.com/news?q%5Bnews_type_eq%5D=1应伪静态重写成http://www.ikcrm.com/news/type/1 2、标签链接,如:http://www.ikcrm.com/news?q%5Btags_blogs_tag_id_eq%5D=4应伪静态重写成http://www.ikcrm.com/news/tag/4 3、分页标签,如:http://www.ikcrm.com/news?page=2应为伪静态重写为http://www.ikcrm.com/news/page/2

二、标签使用问题 1、h1标签,每个页面有且仅可使用一次;h2标签每个页面可使用多次。(全站所有页面均须自从此规则) 2、首页h1标签重复使用 3、首页新闻列表页未使用h2标签,新闻标题使用h2标签 4、新闻中心(http://www.ikcrm.com/news)h2标签应分配给每条新闻标题

@sandyxu
sandyxu / _form.html.erb
Created Jun 11, 2015
how to use carrierwave
View _form.html.erb
<%= form_for Attachment.new do |f| %>
<%= f.label :file, '上传文档', class: 'btn btn-primary btn-sm' %>
<%= f.file_field :file %>
<span class="text-danger">文件大小不能超过20M</span>
<%= f.submit 'save', class: 'btn btn-primary btn-sm' %>
<% end %>
@sandyxu
sandyxu / nginx.conf
Last active Aug 29, 2015
config and redirect all http to https in nginx
View nginx.conf
upstream ikcrm_www_development_unicorn {
server unix:/tmp/unicorn.ikcrm_www_development.sock fail_timeout=0;
}
server {
listen 80;
server_name test.www.ikcrm.com;
return 301 https://$server_name$request_uri;
}
server {
@sandyxu
sandyxu / es.sh
Last active Aug 29, 2015 — forked from rajraj/es.sh
View es.sh
cd ~
sudo yum update
sudo yum install java-1.7.0-openjdk.i686 -y
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.9.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share
@sandyxu
sandyxu / Linux 系统中的目录
Created Feb 26, 2015
Linux 系统中的目录
View Linux 系统中的目录
目录 评论
/ 根目录,万物起源。
/bin 包含系统启动和运行所必须的二进制程序。
/boot
包含 Linux 内核,最初的 RMA 磁盘映像(系统启动时,由驱动程序所需),和 启动加载程序。
有趣的文件:
/boot/grub/grub.conf or menu.lst, 被用来配置启动加载程序。
/boot/vmlinuz,Linux 内核。
@sandyxu
sandyxu / elasticsearch-ik-plugin.md
Last active Aug 29, 2015
config elasticsearch and ik Analysis (Chinese word)
View elasticsearch-ik-plugin.md
View commands.txt
#1 Generate Public & Private Keypair
#2 Create receipt.json - eg below - careful with line-endings, etc if line breaks
#3 Create signature & Encode
openssl dgst -binary -sha1 -sign private.pem receipt.json | openssl base64 > signature.txt
#4 Verify using OpenSSL & public key
openssl base64 -d -in signature.txt -out signature.sha1 | openssl dgst -sha1 -verify public.pem -signature signature.sha1 receipt.json
View verify_appstore_in_app.php
function verify_app_store_in_app($receipt, $is_sandbox)
{
//$sandbox should be TRUE if you want to test against itunes sandbox servers
if ($is_sandbox)
$verify_host = "ssl://sandbox.itunes.apple.com";
else
$verify_host = "ssl://buy.itunes.apple.com";
$json='{"receipt-data" : "'.$receipt.'" }';
//opening socket to itunes
You can’t perform that action at this time.