Skip to content

Instantly share code, notes, and snippets.

@jamstooks
Last active May 30, 2023 06:17
Show Gist options
  • Save jamstooks/178408072a641381cbb636c3d1de1822 to your computer and use it in GitHub Desktop.
Save jamstooks/178408072a641381cbb636c3d1de1822 to your computer and use it in GitHub Desktop.

Revisions

  1. jamstooks revised this gist Nov 18, 2018. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions cloud9.md
    Original file line number Diff line number Diff line change
    @@ -170,6 +170,13 @@ Note, I had to temporarily add `/usr/local/bin` to my root `$PATH` (unsure why):

    You might even add it to your `/root/.bashrc` file, if you want.

    ## Headless Chrome

    I need to test in chrome from time to time. [These guys](https://intoli.com/blog/installing-google-chrome-on-centos/)
    built a quick install script that makes this easy.

    curl https://intoli.com/install-google-chrome.sh | bash

    ## Need more space?

    It's easy to add more space, simply modify your EBS root volume. In the EC2 console scroll down to "Root device /dev/xvda", clikc on the link and then "modify volume."
  2. jamstooks revised this gist Nov 15, 2018. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions cloud9.md
    Original file line number Diff line number Diff line change
    @@ -172,5 +172,4 @@ You might even add it to your `/root/.bashrc` file, if you want.

    ## Need more space?

    [AWS Docs](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/recognize-expanded-volume-linux.html)
    [and a good tip](https://stackoverflow.com/a/42791031/295789)
    It's easy to add more space, simply modify your EBS root volume. In the EC2 console scroll down to "Root device /dev/xvda", clikc on the link and then "modify volume."
  3. jamstooks revised this gist Nov 15, 2018. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions cloud9.md
    Original file line number Diff line number Diff line change
    @@ -115,6 +115,7 @@ Note: you'll have to run `nvm use node` everytime you run `npm install` or `yarn

    and [yarn](https://yarnpkg.com/lang/en/docs/install/#centos-stable)

    curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
    sudo yum install yarn

    ### Bonus: Code Auto-Formatting
  4. jamstooks renamed this gist Oct 29, 2018. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  5. jamstooks revised this gist Oct 28, 2018. 1 changed file with 8 additions and 0 deletions.
    8 changes: 8 additions & 0 deletions setup.md
    Original file line number Diff line number Diff line change
    @@ -14,6 +14,14 @@ This will look something like:
    [2018-06-14 02:56:21]
    ec2-user:~/environment/bt-backend
    $

    ## Open files from the command line

    npm install -g c9

    Then you can:

    $ c9 file.txt

    ## Connect with Github

  6. jamstooks revised this gist Jun 20, 2018. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions setup.md
    Original file line number Diff line number Diff line change
    @@ -163,5 +163,5 @@ You might even add it to your `/root/.bashrc` file, if you want.

    ## Need more space?

    here's a good howto: https://stackoverflow.com/a/42791031/295789
    [AWS Docs](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/recognize-expanded-volume-linux.html)
    [and a good tip](https://stackoverflow.com/a/42791031/295789)
  7. jamstooks revised this gist Jun 20, 2018. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions setup.md
    Original file line number Diff line number Diff line change
    @@ -160,4 +160,8 @@ Note, I had to temporarily add `/usr/local/bin` to my root `$PATH` (unsure why):
    export PATH=$PATH:/usr/local/bin

    You might even add it to your `/root/.bashrc` file, if you want.

    ## Need more space?

    here's a good howto: https://stackoverflow.com/a/42791031/295789

  8. jamstooks revised this gist Jun 14, 2018. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion setup.md
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,13 @@ I'm not a big fan of their default bash prompt:

    echo "export PS1='[\D{%F %T}]\n\[\e]0;\w\a\]\[\e[32m\]\u:\[\e[33m\]\w\[\e[0m\]\n\$ '" >> ~/.bashrc
    source ~/.bashrc


    This will look something like:

    [2018-06-14 02:56:21]
    ec2-user:~/environment/bt-backend
    $

    ## Connect with Github

    git config --global user.email "[email protected]"
  9. jamstooks revised this gist Jun 14, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion setup.md
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@

    I'm not a big fan of their default bash prompt:

    echo "export PS1='\[\e]0;\w\a\]\[\e[32m\]\u:\[\e[33m\]\w\[\e[0m\]\n\$ '" >> ~/.bashrc
    echo "export PS1='[\D{%F %T}]\n\[\e]0;\w\a\]\[\e[32m\]\u:\[\e[33m\]\w\[\e[0m\]\n\$ '" >> ~/.bashrc
    source ~/.bashrc

    ## Connect with Github
  10. jamstooks revised this gist Jun 13, 2018. 1 changed file with 14 additions and 0 deletions.
    14 changes: 14 additions & 0 deletions setup.md
    Original file line number Diff line number Diff line change
    @@ -141,3 +141,17 @@ Then you might want a public command alias
    source ~/.bashrc

    to serve on: `http://$PUBLIC_IP:8081/`.

    ## Using Heroku?
    Unfortunately, you have to manually install that... [ref](https://devcenter.heroku.com/articles/heroku-cli)

    cd ~
    curl https://cli-assets.heroku.com/install.sh | sudo sh

    Note, I had to temporarily add `/usr/local/bin` to my root `$PATH` (unsure why):

    sudo su
    export PATH=$PATH:/usr/local/bin

    You might even add it to your `/root/.bashrc` file, if you want.

  11. jamstooks revised this gist Jun 4, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion setup.md
    Original file line number Diff line number Diff line change
    @@ -112,7 +112,7 @@ I've been finding that using Prettier on my JS code is helpful

    In *Preferences > Javascript Support > Custom Code Formatter*, I use:

    prettier --single-quote es5 --write $file
    prettier es5 --write $file

    then check *Format Code on Save*.

  12. jamstooks revised this gist Jun 2, 2018. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion setup.md
    Original file line number Diff line number Diff line change
    @@ -96,7 +96,9 @@ I'd recommend using [nvm](https://github.com/creationix/nvm).
    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
    nvm install node
    nvm use node


    Note: you'll have to run `nvm use node` everytime you run `npm install` or `yarn install`.

    and [yarn](https://yarnpkg.com/lang/en/docs/install/#centos-stable)

    sudo yum install yarn
  13. jamstooks revised this gist Jun 2, 2018. No changes.
  14. jamstooks revised this gist Jun 2, 2018. 1 changed file with 6 additions and 5 deletions.
    11 changes: 6 additions & 5 deletions setup.md
    Original file line number Diff line number Diff line change
    @@ -30,7 +30,7 @@ Then upgrade pip and install virtualenvwrapper:
    sudo pip-3.6 install --upgrade pip
    sudo /usr/local/bin/pip install virtualenvwrapper
    echo "export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3" >> ~/.bashrc
    echo "export WORKON_HOME=$HOME/environment/Envs" >> ~/.bashrc
    echo "export WORKON_HOME=\$HOME/environment/Envs" >> ~/.bashrc
    echo "source /usr/local/bin/virtualenvwrapper.sh" >> ~/.bashrc
    source ~/.bashrc

    @@ -120,21 +120,22 @@ In some cases, I need to
    [make my apps public](https://docs.aws.amazon.com/cloud9/latest/user-guide/app-preview.html#app-preview-share)
    on the internet.
    Normally I'd use an auto-deployed dev environment to share with others,
    but if you're working with API endpoints and AJAX, you may find you need
    to use the public IP
    but if you're working with API endpoints and AJAX or running multiple servers,
    you may find you need to use the public IP.

    I set up a few environment vars for this:

    echo "export INSTANCE_ID=\`curl -s http://169.254.169.254/latest/meta-data/instance-id\`" >> ~/.bashrc
    echo "export PUBLIC_IP=\`curl -s http://169.254.169.254/latest/meta-data/public-ipv4\`" >> ~/.bashrc
    echo "export PRIVATE_IP=\`ip -4 addr show eth0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}'\`" >> ~/.bashrc
    echo "export SECOND_PORT=8081" >> ~/.bashrc
    source ~/.bashrc

    Note: if you're using ipv6... [ref](https://stackoverflow.com/a/26694162/295789):

    Then you might want a public command alias

    echo "alias djrp='printf "\\nserving publicly on http://$PUBLIC_IP:$PORT/\\n\\n";dj runserver $PRIVATE_IP:$PORT'" >> ~/.bashrc
    echo "alias djrp='printf \"\\nserving publicly on http://\$PUBLIC_IP:\$SECOND_PORT/\\n\\n\";dj runserver \$PRIVATE_IP:\$SECOND_PORT'" >> ~/.bashrc
    source ~/.bashrc

    to serve on: `http://$PUBLIC_IP:$PORT/`
    to serve on: `http://$PUBLIC_IP:8081/`.
  15. jamstooks revised this gist Jun 1, 2018. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions setup.md
    Original file line number Diff line number Diff line change
    @@ -54,7 +54,7 @@ I like the auto-format on save pattern. If you do too, you can:

    sudo /usr/local/bin/pip install --upgrade autopep8

    and update Preferences > Python Support > Custom Code Formatter to `autopep8 --in-place $file`
    and update *Preferences > Python Support > Custom Code Formatter* to `autopep8 --in-place $file`

    ## Postgresql setup

    @@ -108,7 +108,7 @@ I've been finding that using Prettier on my JS code is helpful

    npm install -g prettier

    In Preferences > Javascript Support > Custom Code Formatter i use:
    In *Preferences > Javascript Support > Custom Code Formatter*, I use:

    prettier --single-quote es5 --write $file

  16. jamstooks revised this gist Jun 1, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion setup.md
    Original file line number Diff line number Diff line change
    @@ -50,7 +50,7 @@ I like to create a few Django shortcuts (**djr** is really the most important be

    ### Bonus: Code Auto-Formatting

    I like the auto-format on save pattern. If you do you can:
    I like the auto-format on save pattern. If you do too, you can:

    sudo /usr/local/bin/pip install --upgrade autopep8

  17. jamstooks revised this gist Jun 1, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion setup.md
    Original file line number Diff line number Diff line change
    @@ -40,7 +40,7 @@ I create multiple envs for testing, like `p2`, `p3`, or `p2-dj1-10`
    mkvirtualenv -p /usr/bin/python3 p3
    mkvirtualenv -p /usr/bin/python2.7 p2

    I like to create a few Django shortcuts:
    I like to create a few Django shortcuts (**djr** is really the most important because of the env vars):

    echo "alias dj='python manage.py'" >> ~/.bashrc
    echo "alias djr='dj runserver \$IP:\$PORT'" >> ~/.bashrc
  18. jamstooks revised this gist Jun 1, 2018. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion setup.md
    Original file line number Diff line number Diff line change
    @@ -32,6 +32,7 @@ Then upgrade pip and install virtualenvwrapper:
    echo "export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3" >> ~/.bashrc
    echo "export WORKON_HOME=$HOME/environment/Envs" >> ~/.bashrc
    echo "source /usr/local/bin/virtualenvwrapper.sh" >> ~/.bashrc
    source ~/.bashrc

    Now to create your virtualenvs... I usually just create one for my project, but sometimes
    I create multiple envs for testing, like `p2`, `p3`, or `p2-dj1-10`
    @@ -45,6 +46,7 @@ I like to create a few Django shortcuts:
    echo "alias djr='dj runserver \$IP:\$PORT'" >> ~/.bashrc
    echo "alias djt='dj test'" >> ~/.bashrc
    echo "alias djs='dj shell'" >> ~/.bashrc
    source ~/.bashrc

    ### Bonus: Code Auto-Formatting

    @@ -126,11 +128,13 @@ I set up a few environment vars for this:
    echo "export INSTANCE_ID=\`curl -s http://169.254.169.254/latest/meta-data/instance-id\`" >> ~/.bashrc
    echo "export PUBLIC_IP=\`curl -s http://169.254.169.254/latest/meta-data/public-ipv4\`" >> ~/.bashrc
    echo "export PRIVATE_IP=\`ip -4 addr show eth0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}'\`" >> ~/.bashrc
    source ~/.bashrc

    Note: if you're using ipv6... [ref](https://stackoverflow.com/a/26694162/295789):

    Then you might want a public command alias

    echo "alias djrp='printf "\\nserving publicly on http://$PUBLIC_IP:$PORT/\\n\\n";dj runserver $PRIVATE_IP:$PORT'" >> ~/.bashrc
    source ~/.bashrc

    to serve on: `http://$PUBLIC_IP:$PORT/`
    to serve on: `http://$PUBLIC_IP:$PORT/`
  19. jamstooks revised this gist Jun 1, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion setup.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # My Cloud9 Setup for Python/Django and Node
    # My AWS Cloud9 Setup for Python/Django and Node

    ## Getting setup

  20. jamstooks revised this gist Jun 1, 2018. 2 changed files with 136 additions and 90 deletions.
    136 changes: 136 additions & 0 deletions setup.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,136 @@
    # My Cloud9 Setup for Python/Django and Node

    ## Getting setup

    sudo yum -y update

    I'm not a big fan of their default bash prompt:

    echo "export PS1='\[\e]0;\w\a\]\[\e[32m\]\u:\[\e[33m\]\w\[\e[0m\]\n\$ '" >> ~/.bashrc
    source ~/.bashrc

    ## Connect with Github

    git config --global user.email "[email protected]"
    git config --global user.email

    [Gihub SSH instructions](https://help.github.com/articles/connecting-to-github-with-ssh/)

    ssh-keygen -t rsa -b 4096 -C "[email protected]"
    ssh -T [email protected]

    ## Python/Django Setup

    (OPTIONAL: remove `alias python=python3` altogether in ~/.bashrc) - I haven't tried this in a while. YMMV

    If you're on to Python3 these days,
    start by changing `alias python=python27` to `alias python=python3` in ~/.bashrc.
    Then upgrade pip and install virtualenvwrapper:

    sudo pip-3.6 install --upgrade pip
    sudo /usr/local/bin/pip install virtualenvwrapper
    echo "export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3" >> ~/.bashrc
    echo "export WORKON_HOME=$HOME/environment/Envs" >> ~/.bashrc
    echo "source /usr/local/bin/virtualenvwrapper.sh" >> ~/.bashrc

    Now to create your virtualenvs... I usually just create one for my project, but sometimes
    I create multiple envs for testing, like `p2`, `p3`, or `p2-dj1-10`

    mkvirtualenv -p /usr/bin/python3 p3
    mkvirtualenv -p /usr/bin/python2.7 p2

    I like to create a few Django shortcuts:

    echo "alias dj='python manage.py'" >> ~/.bashrc
    echo "alias djr='dj runserver \$IP:\$PORT'" >> ~/.bashrc
    echo "alias djt='dj test'" >> ~/.bashrc
    echo "alias djs='dj shell'" >> ~/.bashrc

    ### Bonus: Code Auto-Formatting

    I like the auto-format on save pattern. If you do you can:

    sudo /usr/local/bin/pip install --upgrade autopep8

    and update Preferences > Python Support > Custom Code Formatter to `autopep8 --in-place $file`

    ## Postgresql setup

    I'd recommend reading this [blog post](https://medium.com/@floodfx/setting-up-postgres-on-cloud9-ide-720e5b879154).
    Follow instructions in blog post... *OR* write the sed command yourself :)

    Here are some commands.

    sudo yum install postgresql postgresql-server postgresql-devel postgresql-contrib postgresql-docs
    sudo service postgresql initdb
    sudo service postgresql start

    sudo su - postgres
    psql -U postgres

    then:

    CREATE USER "ec2-user" SUPERUSER;

    also consider

    ALTER ROLE "ec2-user" SET client_encoding TO 'utf8';
    ALTER ROLE "ec2-user" SET default_transaction_isolation TO 'read committed';
    ALTER ROLE "ec2-user" SET timezone TO 'UTC';

    ## MongoDB
    Just read [this](https://docs.mongodb.com/manual/tutorial/install-mongodb-on-amazon/). Then you can:

    sudo service mongod start

    ## MySQL mysql55 is already installed

    sudo service mysqld start

    ## Node setup

    I'd recommend using [nvm](https://github.com/creationix/nvm).

    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
    nvm install node
    nvm use node

    and [yarn](https://yarnpkg.com/lang/en/docs/install/#centos-stable)

    sudo yum install yarn

    ### Bonus: Code Auto-Formatting

    The default is `esformatter -i "$file"`, but
    I've been finding that using Prettier on my JS code is helpful

    npm install -g prettier

    In Preferences > Javascript Support > Custom Code Formatter i use:

    prettier --single-quote es5 --write $file

    then check *Format Code on Save*.

    ## Remote Access

    In some cases, I need to
    [make my apps public](https://docs.aws.amazon.com/cloud9/latest/user-guide/app-preview.html#app-preview-share)
    on the internet.
    Normally I'd use an auto-deployed dev environment to share with others,
    but if you're working with API endpoints and AJAX, you may find you need
    to use the public IP

    I set up a few environment vars for this:

    echo "export INSTANCE_ID=\`curl -s http://169.254.169.254/latest/meta-data/instance-id\`" >> ~/.bashrc
    echo "export PUBLIC_IP=\`curl -s http://169.254.169.254/latest/meta-data/public-ipv4\`" >> ~/.bashrc
    echo "export PRIVATE_IP=\`ip -4 addr show eth0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}'\`" >> ~/.bashrc

    Note: if you're using ipv6... [ref](https://stackoverflow.com/a/26694162/295789):

    Then you might want a public command alias

    echo "alias djrp='printf "\\nserving publicly on http://$PUBLIC_IP:$PORT/\\n\\n";dj runserver $PRIVATE_IP:$PORT'" >> ~/.bashrc

    to serve on: `http://$PUBLIC_IP:$PORT/`
    90 changes: 0 additions & 90 deletions setup.sh
    Original file line number Diff line number Diff line change
    @@ -1,90 +0,0 @@
    sudo yum -y update

    # start by changing `alias python=python27` to `alias python=python3` in ~/.bashrc

    sudo pip-3.6 install --upgrade pip

    # for some reason `pip` is not found with sudo, so I use the full path.
    sudo /usr/local/bin/pip install virtualenvwrapper

    echo "export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3" >> ~/.bashrc
    echo "export WORKON_HOME=$HOME/environment/Envs" >> ~/.bashrc
    echo "source /usr/local/bin/virtualenvwrapper.sh" >> ~/.bashrc
    echo "export PS1='\[\e]0;\w\a\]\[\e[32m\]\u:\[\e[33m\]\w\[\e[0m\]\n\$ '" >> ~/.bashrc
    source ~/.bashrc

    mkvirtualenv -p /usr/bin/python3 p3
    mkvirtualenv -p /usr/bin/python2.7 p2

    # for testing, I sometimes create many virtual envs, like p2-dj1-10

    # OPTIONAL: remove `alias python=python3` altogether in ~/.bashrc

    echo "alias dj='python manage.py'" >> ~/.bashrc
    echo "alias djr='dj runserver \$IP:\$PORT'" >> ~/.bashrc
    echo "alias djt='dj test'" >> ~/.bashrc
    echo "alias djs='dj shell'" >> ~/.bashrc

    # Set up git profile
    git config --global user.email "[email protected]"
    # confirm
    git config --global user.email

    # https://help.github.com/articles/connecting-to-github-with-ssh/
    ssh-keygen -t rsa -b 4096 -C "[email protected]"
    # add to github
    ssh -T [email protected]

    # Postgresql setup
    # https://medium.com/@floodfx/setting-up-postgres-on-cloud9-ide-720e5b879154
    sudo yum install postgresql postgresql-server postgresql-devel postgresql-contrib postgresql-docs
    sudo service postgresql initdb
    # Follow instructions in blog post... OR write the sed command yourself :)
    sudo service postgresql start

    sudo su - postgres
    psql -U postgres
    CREATE USER "ec2-user" SUPERUSER;

    # also consider
    # ALTER ROLE "ec2-user" SET client_encoding TO 'utf8';
    # ALTER ROLE "ec2-user" SET default_transaction_isolation TO 'read committed';
    # ALTER ROLE "ec2-user" SET timezone TO 'UTC';

    # MongoDB
    # https://docs.mongodb.com/manual/tutorial/install-mongodb-on-amazon/
    sudo service mongod start

    # MySQL mysql55 is already installed
    sudo service mysqld start

    # Add github ssh connection
    # https://help.github.com/articles/connecting-to-github-with-ssh/

    # A little extra for easy access to vars
    # Really only necessary if you're going to need remote access
    # https://docs.aws.amazon.com/cloud9/latest/user-guide/app-preview.html#app-preview-share
    echo "export INSTANCE_ID=\`curl -s http://169.254.169.254/latest/meta-data/instance-id\`" >> ~/.bashrc
    echo "export PUBLIC_IP=\`curl -s http://169.254.169.254/latest/meta-data/public-ipv4\`" >> ~/.bashrc
    # if you're using ipv4 [ref](https://stackoverflow.com/a/26694162/295789):
    echo "export PRIVATE_IP=\`ip -4 addr show eth0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}'\`" >> ~/.bashrc

    # and then you might want a public command
    echo "alias djrp='dj runserver \$PRIVATE_IP:\$PORT'" >> ~/.bashrc
    # to serve on:
    # http://$PUBLIC_IP:$PORT/

    # Node setup
    # use nvm: https://github.com/creationix/nvm
    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
    nvm install node
    nvm use node
    # https://yarnpkg.com/lang/en/docs/install/#centos-stable
    sudo yum install yarn

    # I've been finding that using Prettier on my JS code is helpful
    npm install -g prettier
    # in Preferences > Javascript Support > Custom Code Formatter i use:
    prettier --single-quote --trailing-comma es5 --write $file
    # the default is: esformatter -i "$file"
    # then check Format Code on Save
  21. jamstooks revised this gist Jun 1, 2018. 1 changed file with 15 additions and 8 deletions.
    23 changes: 15 additions & 8 deletions setup.sh
    Original file line number Diff line number Diff line change
    @@ -61,14 +61,6 @@ sudo service mysqld start
    # Add github ssh connection
    # https://help.github.com/articles/connecting-to-github-with-ssh/

    # Node setup
    # use nvm: https://github.com/creationix/nvm
    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
    nvm install node
    nvm use node
    # https://yarnpkg.com/lang/en/docs/install/#centos-stable
    sudo yum install yarn

    # A little extra for easy access to vars
    # Really only necessary if you're going to need remote access
    # https://docs.aws.amazon.com/cloud9/latest/user-guide/app-preview.html#app-preview-share
    @@ -81,3 +73,18 @@ echo "export PRIVATE_IP=\`ip -4 addr show eth0 | grep -oP '(?<=inet\s)\d+(\.\d+)
    echo "alias djrp='dj runserver \$PRIVATE_IP:\$PORT'" >> ~/.bashrc
    # to serve on:
    # http://$PUBLIC_IP:$PORT/

    # Node setup
    # use nvm: https://github.com/creationix/nvm
    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
    nvm install node
    nvm use node
    # https://yarnpkg.com/lang/en/docs/install/#centos-stable
    sudo yum install yarn

    # I've been finding that using Prettier on my JS code is helpful
    npm install -g prettier
    # in Preferences > Javascript Support > Custom Code Formatter i use:
    prettier --single-quote --trailing-comma es5 --write $file
    # the default is: esformatter -i "$file"
    # then check Format Code on Save
  22. jamstooks revised this gist May 31, 2018. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion setup.sh
    Original file line number Diff line number Diff line change
    @@ -78,4 +78,6 @@ echo "export PUBLIC_IP=\`curl -s http://169.254.169.254/latest/meta-data/public-
    echo "export PRIVATE_IP=\`ip -4 addr show eth0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}'\`" >> ~/.bashrc

    # and then you might want a public command
    echo "alias djrp='dj runserver \$PUBLIC_IP:\$PORT'" >> ~/.bashrc
    echo "alias djrp='dj runserver \$PRIVATE_IP:\$PORT'" >> ~/.bashrc
    # to serve on:
    # http://$PUBLIC_IP:$PORT/
  23. jamstooks revised this gist May 31, 2018. 1 changed file with 5 additions and 4 deletions.
    9 changes: 5 additions & 4 deletions setup.sh
    Original file line number Diff line number Diff line change
    @@ -46,8 +46,6 @@ sudo su - postgres
    psql -U postgres
    CREATE USER "ec2-user" SUPERUSER;



    # also consider
    # ALTER ROLE "ec2-user" SET client_encoding TO 'utf8';
    # ALTER ROLE "ec2-user" SET default_transaction_isolation TO 'read committed';
    @@ -74,7 +72,10 @@ sudo yum install yarn
    # A little extra for easy access to vars
    # Really only necessary if you're going to need remote access
    # https://docs.aws.amazon.com/cloud9/latest/user-guide/app-preview.html#app-preview-share
    echo "export INSTANCE_ID=\`curl http://169.254.169.254/latest/meta-data/instance-id\`" >> ~/.bashrc
    echo "export PUBLIC_IP=\`curl http://169.254.169.254/latest/meta-data/public-ipv4\`" >> ~/.bashrc
    echo "export INSTANCE_ID=\`curl -s http://169.254.169.254/latest/meta-data/instance-id\`" >> ~/.bashrc
    echo "export PUBLIC_IP=\`curl -s http://169.254.169.254/latest/meta-data/public-ipv4\`" >> ~/.bashrc
    # if you're using ipv4 [ref](https://stackoverflow.com/a/26694162/295789):
    echo "export PRIVATE_IP=\`ip -4 addr show eth0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}'\`" >> ~/.bashrc

    # and then you might want a public command
    echo "alias djrp='dj runserver \$PUBLIC_IP:\$PORT'" >> ~/.bashrc
  24. jamstooks revised this gist May 31, 2018. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions setup.sh
    Original file line number Diff line number Diff line change
    @@ -74,5 +74,7 @@ sudo yum install yarn
    # A little extra for easy access to vars
    # Really only necessary if you're going to need remote access
    # https://docs.aws.amazon.com/cloud9/latest/user-guide/app-preview.html#app-preview-share
    echo "export INSTANCE_ID=`curl http://169.254.169.254/latest/meta-data/instance-id`" >> ~/.bashrc
    echo "export PUBLIC_IP=`curl http://169.254.169.254/latest/meta-data/public-ipv4`" >> ~/.bashrc
    echo "export INSTANCE_ID=\`curl http://169.254.169.254/latest/meta-data/instance-id\`" >> ~/.bashrc
    echo "export PUBLIC_IP=\`curl http://169.254.169.254/latest/meta-data/public-ipv4\`" >> ~/.bashrc
    # if you're using ipv4 [ref](https://stackoverflow.com/a/26694162/295789):
    echo "export PRIVATE_IP=\`ip -4 addr show eth0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}'\`" >> ~/.bashrc
  25. jamstooks revised this gist May 31, 2018. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions setup.sh
    Original file line number Diff line number Diff line change
    @@ -71,3 +71,8 @@ nvm use node
    # https://yarnpkg.com/lang/en/docs/install/#centos-stable
    sudo yum install yarn

    # A little extra for easy access to vars
    # Really only necessary if you're going to need remote access
    # https://docs.aws.amazon.com/cloud9/latest/user-guide/app-preview.html#app-preview-share
    echo "export INSTANCE_ID=`curl http://169.254.169.254/latest/meta-data/instance-id`" >> ~/.bashrc
    echo "export PUBLIC_IP=`curl http://169.254.169.254/latest/meta-data/public-ipv4`" >> ~/.bashrc
  26. jamstooks revised this gist May 28, 2018. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions setup.sh
    Original file line number Diff line number Diff line change
    @@ -68,5 +68,6 @@ sudo service mysqld start
    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
    nvm install node
    nvm use node
    # https://yarnpkg.com/lang/en/docs/install/#centos-stable
    sudo yum install yarn

  27. jamstooks revised this gist May 23, 2018. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion setup.sh
    Original file line number Diff line number Diff line change
    @@ -42,7 +42,13 @@ sudo service postgresql initdb
    # Follow instructions in blog post... OR write the sed command yourself :)
    sudo service postgresql start

    # also consider:
    sudo su - postgres
    psql -U postgres
    CREATE USER "ec2-user" SUPERUSER;



    # also consider
    # ALTER ROLE "ec2-user" SET client_encoding TO 'utf8';
    # ALTER ROLE "ec2-user" SET default_transaction_isolation TO 'read committed';
    # ALTER ROLE "ec2-user" SET timezone TO 'UTC';
  28. jamstooks revised this gist May 23, 2018. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion setup.sh
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,9 @@ sudo yum -y update
    # start by changing `alias python=python27` to `alias python=python3` in ~/.bashrc

    sudo pip-3.6 install --upgrade pip
    sudo pip-3.6 install virtualenvwrapper

    # for some reason `pip` is not found with sudo, so I use the full path.
    sudo /usr/local/bin/pip install virtualenvwrapper

    echo "export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3" >> ~/.bashrc
    echo "export WORKON_HOME=$HOME/environment/Envs" >> ~/.bashrc
  29. jamstooks revised this gist Apr 9, 2018. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions setup.sh
    Original file line number Diff line number Diff line change
    @@ -60,4 +60,5 @@ sudo service mysqld start
    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
    nvm install node
    nvm use node
    sudo yum install yarn

  30. jamstooks revised this gist Apr 9, 2018. 1 changed file with 8 additions and 1 deletion.
    9 changes: 8 additions & 1 deletion setup.sh
    Original file line number Diff line number Diff line change
    @@ -53,4 +53,11 @@ sudo service mongod start
    sudo service mysqld start

    # Add github ssh connection
    # https://help.github.com/articles/connecting-to-github-with-ssh/
    # https://help.github.com/articles/connecting-to-github-with-ssh/

    # Node setup
    # use nvm: https://github.com/creationix/nvm
    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
    nvm install node
    nvm use node