Skip to content

Instantly share code, notes, and snippets.

@apprentice1988
apprentice1988 / keymap.txt
Created November 1, 2017 07:25
sublime Keymap - User
[
{ "keys": ["ctrl+j"], "command": "move_to", "args": {"to": "bol", "extend": false} },
{ "keys": ["ctrl+l"], "command": "move_to", "args": {"to": "eol", "extend": false} },
{ "keys": ["command+b"], "command": "erb" },
{ "keys": ["command+alt+n"], "command": "quick_create_file" },
{ "keys": ["command+k"], "command": "toggle_side_bar" },
{ "keys": ["ctrl+u"], "command": "delete_word", "args": { "forward": false, "sub_words": true } },
{ "keys": ["ctrl+'"], "command": "delete_word", "args": { "forward": true, "sub_words": true } },
{ "keys": ["ctrl+;"], "command": "scroll_lines", "args": {"amount": 10.0} },
{ "keys": ["ctrl+/"], "command": "scroll_lines", "args": {"amount": -10.0} },
@apprentice1988
apprentice1988 / config.md
Last active October 10, 2016 06:08
aliyun 配置rails, nginx, unicorn环境

首先设置语言

cd /usr/share/locales
sudo ./install-language-pack zh_CN

安装RUBY必要的环境依赖

sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libpq-dev imagemagick libmagickwand-dev
@apprentice1988
apprentice1988 / gist:b8b3b059b48ad4f30fed
Created March 9, 2016 14:23
Add this to /etc/hosts to escape block
#######################################################################################
# Fork github highsee/Hosts
# __ __
# / \ / \
# \__/ | |
# __ | | __
# / \______| | ________ ________ __| |__ ________
# | ______ | / __ \ / _____| |__ __| / _____|

首先设置语言

cd /usr/share/locales
sudo ./install-language-pack zh_CN

安装RUBY必要的环境依赖

sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libpq-dev imagemagick libmagickwand-dev
@apprentice1988
apprentice1988 / tutorial1.txt
Last active December 1, 2015 15:27
配置DO
参考https://gorails.com/deploy/ubuntu/14.04和https://coderwall.com/p/yz8cha
把ip放入/etc/hosts 文件中, 比如demo: 123.23.3.4
=====================================
adduser jizilong
groupmod --new-name deploy jizilong # change group name
==================
visudo # edit previllege
#在Root下面添加新创建的user及其权限
Root ALL (ALL:ALL) ALL
@apprentice1988
apprentice1988 / 升级npm 和node的shell 命令
Last active February 15, 2017 03:42
升级 npm 和 node 版本
sudo npm update npm -g
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
@apprentice1988
apprentice1988 / Copy a Remote File to S3 with Ruby
Created April 20, 2014 01:54
Copy a Remote File to S3 with Ruby
require 'net/http'
AWS::S3::Base.establish_connection!({
access_key_id: 'your-access-key-id',
secret_access_key: 'your-secret-access-key'
})
# Use the Google Logo as an example
#
url = URI("https://www.google.com/images/srpr/logo3w.png")
#!/usr/bin/env ruby
require 'thor'
require 'rest_client'
require 'base64'
require 'qiniu-rs'
class QiniuUploader < Thor
desc "upload", "Upload a file to qiniu cloud storage"
def upload
bucket = 'mybucket'
VERSION=3.0.7
rm -rf redis-$VERSION
wget http://redis.googlecode.com/files/redis-2.2.5.tar.gz -O redis-$VERSION.tar.gz
tar -xzvf redis-$VERSION.tar.gz
cd redis-$VERSION
./configure --prefix=/usr
make
rm -rf /tmp/redis-$VERSION.$$
mkdir /tmp/redis-$VERSION.$$
mkdir -p /tmp/redis-$VERSION.$$/usr/bin
@apprentice1988
apprentice1988 / css 继承
Last active January 3, 2016 20:39
css 继承 - 在comment处添加属性,后面的以'button-'开始的css都会自动继承该属性
[class*=“button-“] {
/* base button properties */
}
.button-primary { ... }
.button-plain { ... }