###SSH into a remote machine###
ssh [email protected]
#or by ip address
ssh [email protected]
exit: exit
###Install Something###
#If it's a new server, update apt-get first thing
###SSH into a remote machine###
ssh [email protected]
#or by ip address
ssh [email protected]
exit: exit
###Install Something###
#If it's a new server, update apt-get first thing
import pandas as pd | |
import numpy as np | |
from sklearn.feature_extraction import DictVectorizer | |
def encode_onehot(df, cols): | |
""" | |
One-hot encoding is applied to columns specified in a pandas DataFrame. | |
Modified from: https://gist.github.com/kljensen/5452382 | |
#!/bin/bash | |
# setup python dev | |
sudo apt-get install build-essential git make libncurses-dev zip libfreetype6-dev libxft-dev python-pip python-dev python-virtualenv libssl-dev libffi-dev python-matplotlib | |
wget http://repo.continuum.io/archive/Anaconda2-4.1.0-Linux-x86_64.sh | |
bash ~/Anaconda3-4.0.0-Linux-x86_64.sh | |
echo "boto==2.39.0 |
#!/bin/bash | |
# Copyright 2015 Google, Inc. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software |
# Install build tools | |
sudo apt-get update | |
sudo apt-get install -y build-essential git python-pip curl software-properties-common libfreetype6-dev libxft-dev libncurses-dev libopenblas-dev gfortran python3-matplotlib libblas-dev liblapack-dev libatlas-base-dev python3-dev linux-headers-generic linux-image-extra-virtual unzip python3-numpy swig python3-pandas python-sklearn unzip python3-pip | |
# Install CUDA 7 | |
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1410/x86_64/cuda-repo-ubuntu1410_7.0-28_amd64.deb | |
# wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1504/x86_64/cuda-repo-ubuntu1504_7.5-18_amd64.deb | |
sudo dpkg -i cuda-repo-ubuntu1504_7.0-28_amd64.deb | |
sudo apt-get update | |
sudo apt-get install -y cuda |
#ifdef __ANDROID__ | |
#include "jni.h" | |
#include "android/log.h" | |
#define LOG_TAG "psx" | |
#define PRINTMSGS(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__) | |
#endif | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <math.h> |
wget -qO- https://get.docker.com/ | sh | |
sudo apt-get update | |
sudo apt-get install \ | |
linux-image-extra-$(uname -r) \ | |
linux-image-extra-virtual | |
sudo apt-get install \ | |
apt-transport-https \ | |
ca-certificates \ | |
curl \ |
from functools import reduce | |
def golden_max_slice(A): | |
max_ending = max_slice = 0 | |
if all(a > 0 for a in A): | |
return reduce((lambda x, y: x + y), A) | |
if all(a < 0 for a in A): | |
return max(A) | |
''' | |
Problem: | |
You are given a non-empty, zero-indexed array A of n (1 ¬ n ¬ 100 000) integers a0, a1, . . . , an−1 (0 ¬ ai ¬ 1 000). This array represents number of mushrooms growing on the consecutive spots along a road. You are also given integers k and m (0 ¬ k, m < n). | |
A mushroom picker is at spot number k on the road and should perform m moves. In | |
one move she moves to an adjacent spot. She collects all the mushrooms growing on spots she visits. The goal is to calculate the maximum number of mushrooms that the mushroom picker can collect in m moves. | |
''' | |
import math |