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
from xml.etree import ElementTree | |
prefix = '{http://www.w3.org/2005/Atom}' | |
tree = ElementTree.parse('/blog-08-22-2017.xml') | |
root = tree.getroot() | |
def real_tag(tag): | |
return prefix+tag |
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
int kadane2d(int[][] m){ | |
int row = m.length; | |
if(row==0)return 0; | |
int col = m[0].length; | |
int ret = Integer.MIN_VALUE; | |
for (int left = 0; left < col; left++) { | |
int[] sum = new int[row]; // reuse this | |
for (int right = left; right < col; right++) { |
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 boto3 | |
s3 = boto3.resource('s3') | |
bucket = s3.Bucket('<your_bucket>') | |
size = 0 | |
for o in bucket.objects.all(): | |
if '<your_filter>' in o.key: | |
print o, o.size | |
size += o.size | |
print 's3 size = %.3f GB' % (size/1024/1024/1024) |