sudo apt-get update
sudo apt-get remove docker docker-engine docker.io
sudo apt install docker.io
sudo systemctl enable docker - sets Docker to run at startup.
sudo curl -L "https://github.com/docker/compose/releases/download/1.23.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo docker-compose --version
sudo chmod +x /usr/local/bin/docker-compose
This file contains hidden or 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
/** | |
* * Decorator for methods returning T[]; where T has property fieldName | |
* @param fieldName: string, property name to sort by; reference _.orderBy documentation | |
* @param direction: string; reference _.orderBy documentation | |
*/ | |
export function Sort<T>(fieldName: keyof T, direction: SortDirection = 'asc'): any { | |
return function(target: any, propertyKey: string, descriptor: PropertyDescriptor): PropertyDescriptor { | |
const original = descriptor.value; | |
descriptor.value = function(...args: any[]): any { | |
const result = original.apply(this, args); |
This file contains hidden or 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
# Install wget | |
yum install wget -y | |
# Install certbot-auto | |
wget https://dl.eff.org/certbot-auto | |
chmod a+x certbot-auto | |
# Obtain SSL certificate with Nginx plugin for the domain | |
sudo ./certbot-auto --nginx -d app.com --debug |
This file contains hidden or 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
from typing import List, Any, Dict | |
from collections import Counter | |
""" | |
Write a function that receives two sequences: A and B of integers and returns one sequence C. | |
Sequence C should contain all elements from sequence A (maintaining the order) except those, | |
that are present in sequence B p times, where p is a prime number. | |
""" | |
This file contains hidden or 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
type Nullable<T> = T | null; | |
type Falsy<T> = T | false | undefined | null; | |
interface Dictionary<T> { | |
[P: string]: T; | |
} | |
type BooleanDict = Dictionary<Boolean> |
- Connect to your EC2 instance
- Install zsh :
sudo apt-get update && sudo apt-get install zsh
- Edit your passwd configuration file to tell which shell to use for user (check with whoami)
:
sudo vim /etc/passwd` - Look for
ubuntu
user, and replacebin/bash
bybin/zsh
- Install OhMyZsh :
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
- Disconnect from your instance and reconnect it.
git clone https://github.com/zsh-users/zsh-autosuggestions.git $ZSH_CUSTOM/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting
- Add in
.zshrc
line:plugins=(git zsh-autosuggestions zsh-syntax-highlighting)
. Remember to remove previousplugins=(git)
This file contains hidden or 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
from matplotlib import animation | |
predictions_history = [] | |
# append arrays of Y_test values to predictions hostory | |
fig, ax = plt.subplots() | |
ax.grid() | |
scatter = ax.scatter(X_train,Y_train, s=5, c='r') | |
parabola, = ax.plot(X_train, predictions_history[0]) | |
# initialization function: plot the background of each frame |
This file contains hidden or 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 urllib.request | |
import tarfile | |
def get_data(file_url, file_name='downloaded') | |
urllib.request.urlretrieve(file_url) | |
with tarfile.open(file_name, "r:gz") as f: | |
f.extractall() | |
Run Jupyter notebook on server
- run on instance:
jupyter notebook --no-browser --port=<host port>
- in other terminal tab
ssh -i <pem key> -L <client port>:localhost:<host port> user@<ip>
- in browser hit
localhost:<client port>
NewerOlder