# Connect to your instance from your terminal
ssh -i /path_to_the_file/file_name.pem ubuntu@ip # Public IP From EC2 Instance
# When running this after the first download, it will through an error
# It will say that this instance isn't secure, for that will run
# The following cmd
chmod 400 /Downloads/example-key-1.pem
# Because the Pen file doesn't have the right permission to execute it
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 factorial = (n) => { | |
let memo = [] | |
memo[0] = 1 | |
for(let i = 1; i <= n; i++) { | |
memo[i] = i * memo[i - 1]; | |
} | |
return memo[n] | |
} |
You can install Python packages with pip3 install They will install into the site-package directory /usr/local/lib/python3.9/site-packages
tkinter is no longer included with this formula, but it is available separately: brew install [email protected]
See: https://docs.brew.sh/Homebrew-and-Python ==> [email protected]
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
# USING SENDGRID | |
# create your apikey, you will use it as the password | |
# add gem 'dotenv-rails' | |
# create .env in the root directory and remember to add it to .gitignore | |
# Add SENDGRID_PASSWORD=SG.xxxxxxx to .env where "SG.xxxxxxx" is the APIKEY you generated | |
#First configure Devise email in config/initializers/devise.rb: | |
# Verify the email as single sender at https://app.sendgrid.com/settings/sender_auth | |
config.mailer_sender = "[email protected]" |
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 fs = require('fs'); | |
const dic = fs.readFileSync('example.in', 'utf8'); | |
const lines = dic.split('\n'); | |
let output = []; | |
const testCases = lines.shift() * 1; | |
let caseLength = []; | |
let counter = 0; | |
let linesObj = {}; | |
let lineNum = 0; |
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
# Generate Random Passwords | |
curl 'https://www.random.org/passwords/?num=2&len=24&format=plain&rnd=new' | |
# Create deploy user | |
sudo adduser deploy | |
sudo adduser deploy sudo | |
su deploy | |
cd ../deploy/ | |
# Generate ssh keys |
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
# Why do we need KudeURI? Because the URI.join method doing something stupid: | |
# | |
# URI.join('http://example.com/subpath', 'hello', '?token=secret') | |
# => “http://example.com/hello?token=secret” | |
# | |
# But what I expected is “http://example.com/subpath/hello?token=secret", the subpath is gone. | |
# By using SmartURI, you can handle the case above gracefully: | |
# | |
# SmartURI.join('http://example.com/subpath', 'hello', query: { token: secret }) | |
# => "http://example.com/subpath/hello?token=secret" |
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
import React, { Component } from "react"; | |
import { | |
deepEquals, | |
getDefaultFormState | |
} from "@rjsf/core/lib/utils"; | |
import PropTypes from "prop-types"; | |
export function getFieldName(name) { | |
const DEFAULT_COMPONENT_TYPES = { |
Source deployment_aws_capistrano
Step by step instructions to setup your EC2 server for deploying a Rails application. Reference here
- Login to your EC2 instance
ubuntu@ip-172-30-0-195:~$ pwd
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
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
RewriteRule ^index\.html$ - [L] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME} !-l | |
RewriteRule . /index.html [L] |