Skip to content

Instantly share code, notes, and snippets.

@lazybios
lazybios / deploy_to_vps.sh
Last active August 29, 2015 14:15
deploy_to_vps shell script
# update and basic tools
sudo apt-get -y update
sudo apt-get -y install curl git-core python-software-properties
# install nginx
sudo add-apt-repository ppa:nginx/stable
sudo apt-get -y update
sudo apt-get -y install nginx
# start nginx service test service
service nginx start
# create db migration file
rails g migration CreateIssues
# execute migration
rake db:migrate
# add new column
rails generate migration add_email_to_users email:string
<table width=200 style="table-layout:fixed;word-wrap:break-word;word-break:break-all;" >
<tr>
<td>&nbsp; dsfdf安师大发的安师大发的安师大发的安师大发的安师大发的安师大发的安师大发的安师大发的安师大发的安师大发的安师大发的安师大发的安师大发的安师大发的安师大发的安师大发的安师大发大发的安师大发的安师大发的安师大发的安师大发的安师师大发的安师大发的安师大发的安师大发的安师大发的安师大发的安师大发的安师大发的安师大发的安师大发的安师大发的安师大发的安师大发的安师大发的安师大发的安师大发的安师大发的安师大发的安师大发的安师大发的ed
<td>
</tr>
</table>
# update and install basic tools
sudo yum -y update
sudo yum -y install curl git-core
# install nginx
sudo yum -y install epel-release
sudo yum -y install nginx
service nginx start
curl localhost

Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

If your file my.cnf (usually in the /etc/mysql/ folder) is correctly configured with

socket=/var/lib/mysql/mysql.sock you can check if mysql is running with the following command:

mysqladmin -u root -p status try changing your permission to mysql folder. If you are working locally, you can try:

如果需要指定Rails环境,例如production,可以输入 RAILS_ENV=production rake db:create db:migrate
# listen 80 default_server;
The argument default_server means this virtual host will answer requests on port 80 that don’t specifically match another virtual host’s listen statement.
# listen [::]:80 default_server ipv6only=on;
The second statement listens over IPv6 and behaves in the same way.
删除Gemfile中unicorn的注释
bundle
@lazybios
lazybios / loading.py
Created February 27, 2015 03:11
text loading
spinsize = 10
spinpos = 0
spindir = 1
def spin():
global spinsize,spinpos,spindir
spinstr = '.'*spinpos + \
'|' + '.'* (spinsize - spinpos -1)
sys.stdout.write('\r'+spinstr+' ')
sys.stdout.flush()
@lazybios
lazybios / tweetbot.py
Created March 4, 2015 05:27
tweet bot proto
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import tweepy
import time
import sys
CONSUMER_KEY = "replace yours"
CONSUMER_SECRET = "replace yours"
@lazybios
lazybios / xv_extractor.py
Created March 5, 2015 09:02
Convert xv to flv
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
xv extractor
Convert xv to flv
Copyright: Ted <[email protected]>
License: BSD
"""
import sys
ps -e -o user,pid,%cpu,%mem,rss,cmd --sort=-rss | head