This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BOOK_REPO=<git url to example repo> | |
EXCODE=temp/example_code | |
# make top-level temp directory | |
mkdir -p ../$EXCODE | |
# add top-level temp directory to gitignore | |
if ! grep -q $EXCODE ../.gitignore; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# update and dependencies | |
sudo yum update -y | |
sudo yum install docker -y | |
# start docker | |
sudo service docker start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# update and dependencies | |
sudo yum update -y | |
sudo yum install ruby -y | |
sudo yum install wget -y | |
# install codedeploy agent | |
cd /home/ec2-user | |
wget https://aws-codedeploy-us-east-1.s3.us-east-1.amazonaws.com/latest/install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo amazon-linux-extras install epel -y | |
sudo yum install stress -y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
yum update -y | |
yum install -y httpd | |
instanceId=$(curl http://169.254.169.254/latest/meta-data/instance-id) | |
echo "<h1>Hello World from $instanceId</h1>" > /var/www/html/index.html | |
systemctl start httpd | |
systemctl enable httpd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
yum update -y | |
yum install -y httpd | |
echo '<h1>Hello World</h1>' > /var/www/html/index.html | |
systemctl start httpd | |
systemctl enable httpd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# PostgreSQL | |
``` | |
create role postgres with password 'postgres'; | |
alter role postgres with login; | |
create database db_one owner=postgres; | |
grant all privileges on database testdb to postgres; | |
\connect db_one | |
create table person (name varchar, age int); | |
insert into person (name, age) values ("John Doe"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :sandbox do | |
desc "run main" | |
task :main => [:environment, :one] do | |
puts "Running main" | |
end | |
desc "run one" | |
task :one => :two do | |
puts "Running one" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :rails_rakes do | |
desc "say hi" | |
task :hi => :environment do | |
puts "Hi" | |
end | |
desc "say hi with arg" | |
task :hi_with_arg, [:name] => :environment do |t, args| | |
puts "Hi #{args[:name]}" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const randNum = (n) => Math.floor(Math.random() * n) + 1; | |
const makeArr = (n) => Array.from(Array(n)).map(() => 0); | |
const seqFn = (fn) => makeArr(20).map(() => fn()); |
NewerOlder