http://guides.rubyonrails.org/migrations.html
- add_column
- add_index
- change_column
- change_table
- create_table
- drop_table
| #!/usr/bin/env python | |
| ## Mysql-Python basic examples. | |
| ## All code is taken from [here](http://zetcode.com/databases/mysqlpythontutorial/) | |
| ## Gist created only for quick reference purpose | |
| import sys | |
| import _mysql | |
| import MySQLdb as mdb |
http://guides.rubyonrails.org/migrations.html
| yum install -y git git-core zlib zlib-devel gcc-c++ patch readline readline-devel \ | |
| libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake \ | |
| libtool bison curl sqlite-devel ImageMagick ImageMagick-devel mysql-devel | |
| cd ~ | |
| git clone git://github.com/sstephenson/rbenv.git .rbenv | |
| echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile | |
| echo 'eval "$(rbenv init -)"' >> ~/.bash_profile | |
| git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build |
| #!/usr/bin/python | |
| import subprocess | |
| import os | |
| import sys | |
| #res = subprocess.Popen(['ls','-al','/ahome'],stdout=subprocess.PIPE,stderr=subprocess.PIPE); | |
| #output,error = res.communicate() | |
| #if res.returncode: | |
| # #raise Exception(error) |
If you have your code defined in classes in lib/ folder you may have problems to load that code in production.
Autoloading is disabled in the production environment by default because of thread safety.
Change config/application.rb:
config.autoload_paths << Rails.root.join("lib")
config.eager_load_paths << Rails.root.join("lib")
| # Advanced config for NGINX | |
| server_tokens off; | |
| add_header X-XSS-Protection "1; mode=block"; | |
| add_header X-Content-Type-Options nosniff; | |
| # Redirect all HTTP traffic to HTTPS | |
| server { | |
| listen 80; | |
| server_name www.domain.com domain.com; | |
| return 301 https://$host$request_uri; |
| #!/bin/sh | |
| set -ex | |
| PATH=/bin:/sbin:/usr/bin:/usr/sbin | |
| KEYMAP="us us" | |
| HOST=alpine | |
| USER=anon | |
| ROOT_FS=ext4 | |
| BOOT_FS=ext4 |
| #!/bin/bash | |
| # | |
| # This script configures WordPress file permissions based on recommendations | |
| # from http://codex.wordpress.org/Hardening_WordPress#File_permissions | |
| # | |
| # Author: Michael Conigliaro <mike [at] conigliaro [dot] org> | |
| # | |
| WP_OWNER=www-data # <-- wordpress owner | |
| WP_GROUP=www-data # <-- wordpress group | |
| WP_ROOT=$1 # <-- wordpress root directory |
| RESTORE=$(echo -en '\033[0m') | |
| RED=$(echo -en '\033[00;31m') | |
| GREEN=$(echo -en '\033[00;32m') | |
| YELLOW=$(echo -en '\033[00;33m') | |
| BLUE=$(echo -en '\033[00;34m') | |
| MAGENTA=$(echo -en '\033[00;35m') | |
| PURPLE=$(echo -en '\033[00;35m') | |
| CYAN=$(echo -en '\033[00;36m') | |
| LIGHTGRAY=$(echo -en '\033[00;37m') | |
| LRED=$(echo -en '\033[01;31m') |
| mike@rbci:~$ psql -U postgres | |
| psql (9.0.3) | |
| Type "help" for help. | |
| postgres=# update pg_database set datallowconn = TRUE where datname = 'template0'; | |
| UPDATE 1 | |
| postgres=# \c template0 | |
| You are now connected to database "template0". | |
| template0=# update pg_database set datistemplate = FALSE where datname = 'template1'; | |
| UPDATE 1 |