Skip to content

Instantly share code, notes, and snippets.

@EuniceMadya
EuniceMadya / Simple_Mock.java
Last active April 11, 2019 02:13
simple Mockito with void innvocation
public class Simple_Mock{
class Mission{
public Mission(){
}
public void complete(int arg){
// code
}
public boolean isComplete(){
//code
return false;
ar = [[-1 for i in range (5)] for j in range (10)] # this means creating an array with 5 cols and 10 rows
ar[9][4] #this would result in -1, means the 10th row, 5th col, i.e. the right-bottom corner of the array
ar[4][9]
len(ar) #number of rows
len(ar[0]) #number of cols
@EuniceMadya
EuniceMadya / s3_multipart_upload.py
Created June 2, 2019 02:51
S3 upload (multipart upload multipartupload)
# this is a simplified version of seeing how to upload
# referencing from https://gist.github.com/teasherm/bb73f21ed2f3b46bc1c2ca48ec2c1cf5
import boto3
import os
from boto3.s3.transfer import TransferConfig
def upload_to_s3(filename, path):
bucket_name = 'BUCKET_name' #should be a bucket name
s3 = boto3.client('s3')
@EuniceMadya
EuniceMadya / s3_download.py
Created June 2, 2019 02:52
Download file from S3 bucket
def download(filename, path):
s3.download_file(bucket_name, filename, path+filename) # the path is where you want to put you documents