2016年11月22日 星期二

[Android][AWS] How to connent to AWS S3 get data


get Keys form AWS S3

AmazonS3 s3 = new AmazonS3Client(CRED);
ListObjectsRequest lor = new ListObjectsRequest()
                             .withBucketName("myBucket")
                             .withPrefix("code/");
ObjectListing objectListing = s3.listObjects(lor);
for (S3ObjectSummary summary: objectListing.getObjectSummaries()) {
    System.out.println(summary.getKey());
}


 AWSCredentials creden=new BasicAWSCredentials(accessKey,secretKey);
    AmazonS3Client s3Client=new AmazonS3Client(creden);
S3Object object = s3Client.getObject(new GetObjectRequest(
                "BucketName", "keyName"));

        BufferedReader reader = new BufferedReader(new InputStreamReader(
                object.getObjectContent()));
        Writer writer = new OutputStreamWriter(new FileOutputStream(file));

        while (true) {
            String line = reader.readLine();
            if (line == null)
                break;
            writer.write(line + "\n");
        }
    writer.flush();
    writer.close();
    reader.close();



http://stackoverflow.com/questions/17561432/amazon-s3-listing-directories

2016年10月17日 星期一

How to Modify the Shell Path in macOS

1. cd  cd~
2. vi .bash_profile
3. export PATH="/Users/charles.lo/Library/Android/sdk/platform-tools:$PATH"

MAC finder show hide hidden file

顯示隱藏檔案:defaults write com.apple.finder AppleShowAllFiles TRUE;\killall Finder

不顯示隱藏檔案:defaults write com.apple.finder AppleShowAllFiles FALSE;\killall Finder

Install Geany on Mac OSX

About the App

Install the App

  1. Press Command+Space and type Terminal and press enter/return key.
  2. Run in Terminal app:
    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null ; brew install caskroom/cask/brew-cask 2> /dev/null
    and press enter/return key. Wait for the command to finish.
  3. Run:
    brew cask install geany

2016年10月14日 星期五

Git tab autocomplete on OSX 10.11 El Capitan



Step 1: Download auto completion script:


>> cd ~ 
>> curl -O https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash


Step 2: Update .bash_profile


>> echo "source ~/git-completion.bash" >> .bash_profile


2016年10月13日 星期四

How to Enable Tab Completion in Mac OS X Terminal



  • Use pico, nano, vi or whatever your favorite text editor is to edit/create .inputrc, I’ll use pico for this walkthrough.
pico .inputrc
  • Paste in the following three lines of rules:
set completion-ignore-case on
set show-all-if-ambiguous on
TAB: menu-complete
  • Press Control+O to save changes to .inputrc followed by Control+X to quit
  • Close and reopen Terminal for the rules to take effect
  • Start typing a path or command and press the Tab key to see this feature in action