Updates.
This commit is contained in:
parent
171caaa7cf
commit
07b7550718
12
bash.md
12
bash.md
|
@ -188,6 +188,18 @@ or
|
|||
set -o errtrace
|
||||
trap traperr ERR
|
||||
|
||||
### Case/switch
|
||||
|
||||
case $1 in
|
||||
start | up)
|
||||
vagrant up
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|ssh}"
|
||||
;;
|
||||
esac
|
||||
|
||||
References
|
||||
----------
|
||||
|
||||
|
|
82
heroku.md
82
heroku.md
|
@ -1,14 +1,69 @@
|
|||
|
||||
## Create an app
|
||||
## `create` - Create an app
|
||||
|
||||
heroku create sushi
|
||||
|
||||
## Custom domains
|
||||
## `sharing` - Collaboration
|
||||
|
||||
heroku addon:add custom_domains
|
||||
# Manage collaborators
|
||||
heroku sharing # List
|
||||
heroku sharing:add me@xy.com
|
||||
heroku sharing:remove me@xy.com
|
||||
|
||||
heroku domains:add example.com
|
||||
heroku domains:add www.example.com
|
||||
# Transfer to another owner
|
||||
heroku sharing:transfer new@owner.com
|
||||
|
||||
## `pg` - Postgresql
|
||||
|
||||
# Start a database
|
||||
heroku addons:add heroku-postgresql
|
||||
heroku pg:promote HEROKU_POSTGRESQL_PURPLE_URL
|
||||
|
||||
# Enable backups
|
||||
heroku addons:add pgbackups:auto-month
|
||||
|
||||
## `ps` - Managing processes
|
||||
|
||||
heroku ps # list
|
||||
heroku ps:scale web=1 # spawn more dynos
|
||||
|
||||
## `run` - Running
|
||||
|
||||
heroku run bash
|
||||
heroku run console # Rails console
|
||||
heroku run rake assets:precompile
|
||||
|
||||
## `config` - Environment var configuration
|
||||
|
||||
heroku config # List
|
||||
heroku config -s # List in shell format
|
||||
|
||||
heroku config:get KEY
|
||||
|
||||
heroku config:set KEY=val
|
||||
heroku config:set KEY1=val KEY2=val ...
|
||||
|
||||
heroku config:unset KEY1
|
||||
|
||||
## `apps` - Applications
|
||||
|
||||
heroku apps # list
|
||||
heroku apps:create [NAME]
|
||||
heroku apps:destroy
|
||||
heroku apps:info
|
||||
heroku apps:open # open in browser
|
||||
heroku apps:rename NEWNAME
|
||||
|
||||
## `domains` - Custom domains
|
||||
|
||||
heroku addon:add custom_domains
|
||||
|
||||
# Add both!
|
||||
heroku domains:add example.com
|
||||
heroku domains:add www.example.com
|
||||
|
||||
# Removing:
|
||||
heroku domains:clear
|
||||
heroku domains:remove example.com
|
||||
|
||||
## DNS records
|
||||
|
||||
|
@ -30,15 +85,22 @@
|
|||
|
||||
## htpasswd (for PHP apps)
|
||||
|
||||
Create an .htaccess file in the webroot:
|
||||
Create an `.htaccess` file in the webroot:
|
||||
|
||||
AuthUserFile /app/www/.htpasswd
|
||||
AuthType Basic
|
||||
AuthName "Restricted Access"
|
||||
Require valid-user
|
||||
|
||||
Create a .htpasswd file:
|
||||
Create a `.htpasswd` file:
|
||||
|
||||
htpasswd -c .htpasswd [username]
|
||||
$ htpasswd -c .htpasswd [username]
|
||||
|
||||
https://gist.github.com/3316425
|
||||
See https://gist.github.com/3316425
|
||||
|
||||
## References:
|
||||
|
||||
* https://addons.heroku.com/
|
||||
* https://devcenter.heroku.com/
|
||||
* https://devcenter.heroku.com/articles/custom-domains
|
||||
* https://devcenter.heroku.com/articles/heroku-postgresql
|
||||
|
|
|
@ -0,0 +1,87 @@
|
|||
### Require
|
||||
|
||||
require 'shelljs/global'
|
||||
|
||||
### Paths
|
||||
|
||||
cd 'dir'
|
||||
|
||||
mkdir 'dir'
|
||||
mkdir '-p', 'dir'
|
||||
|
||||
### File manip
|
||||
|
||||
cp 'src', 'dest'
|
||||
cp '-rf', 'src', 'dest'
|
||||
|
||||
rm 'file'
|
||||
rm '-rf', 'file'
|
||||
|
||||
mv 'src', 'dest'
|
||||
mv ['src1','src2'], 'dest'
|
||||
|
||||
chmod '644', 'file'
|
||||
chmod 755, 'file'
|
||||
chmod 'u+x', 'file'
|
||||
|
||||
### Tests
|
||||
|
||||
test '-b', 'path' # block device
|
||||
test '-d', 'path' # dir
|
||||
test '-e', 'path' # exists
|
||||
test '-f', 'path' # file
|
||||
test '-L', 'path' # symlink
|
||||
|
||||
### Cat and output
|
||||
|
||||
src = cat('file*.txt')
|
||||
|
||||
"hello".to('output.txt');
|
||||
"hello".toEnd('append.txt');
|
||||
|
||||
cat('input.txt').to('output.txt');
|
||||
|
||||
### Utils
|
||||
|
||||
which('x')
|
||||
pwd()
|
||||
|
||||
echo 'hi'
|
||||
|
||||
exec('node --version').code
|
||||
exec('node --version').output
|
||||
exec('node --version', {silent:true}).output
|
||||
|
||||
exec 'node --version', (code, output) ->
|
||||
echo "exit code #{code}"
|
||||
|
||||
tempdir()
|
||||
|
||||
error() # null if no error
|
||||
|
||||
### Make
|
||||
|
||||
require 'shelljs/make'
|
||||
|
||||
target.all = ->
|
||||
target.bundle()
|
||||
target.docs()
|
||||
|
||||
target.bundle = ->
|
||||
cd __dirname
|
||||
mkdir 'build'
|
||||
cd 'lib'
|
||||
(cat '*.js').to '../build/output.js'
|
||||
|
||||
target.docs = ->
|
||||
cd __dirname
|
||||
mkdir 'docs'
|
||||
cd 'lib'
|
||||
for file in ls '*.js'
|
||||
text = grep '//@', file # extract special comments
|
||||
text.replace '//@', '' # remove comment tags
|
||||
text.to 'docs/my_docs.md'
|
||||
|
||||
### References
|
||||
|
||||
* https://github.com/arturadib/shelljs
|
Loading…
Reference in New Issue