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
| docker run --restart=unless-stopped -d -h consul1 --name consul1 -v /mnt:/data \ | |
| consul members | |
| docker run --restart=unless-stopped -h mgr1 --name mgr1 -d -p 3375:2375 swarm manage --replications advertise 10.0.1.5:3375 consul://10.0.1.5:8500/ |
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
| aws rds describe-db-instances | |
| aws rds describe-db-parameter-groups |
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
| aws rds create-db-snapshot --db-instance-identifier pluraldemo --db-snapshot-identifier (snapshot_name) | |
| aws rds restore-db-instance-from-db-snapshot --db-instance-identifier pluraldemo (snapshot_name) --db-snapshot-identifier (snapshot_name) |
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
| n = input() | |
| boots = map(int, raw_input().split()) | |
| orders = [map(int, raw_input().split()) for _ in range(input())] | |
| result = 0 | |
| for i in orders: | |
| if i[0] in boots: | |
| result += i[1] | |
| boots.remove(i[0]) | |
| print result |
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 collections import defaultdict | |
| d = defaultdict(list) | |
| n, m = list(map(int, raw_input().split())) | |
| for i in range(n): | |
| d[raw_input()].append(i + 1) | |
| for i in range(m): | |
| print(' '.join(map(str, d[raw_input()])) or -1) |
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 collections import namedtuple | |
| n, Student = input(), namedtuple('Student', raw_input()) | |
| print "%.2f" %( sum([float(stud.MARKS) for stud in [Student(*raw_input().split()) for _ in xrange(n)]]) / n ) |
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 collections import OrderedDict | |
| d = OrderedDict() | |
| for _ in range(int(input())): | |
| item, space, quantity = input().rpartition(' ') | |
| d[item] = d.get(item, 0) + int(quantity) | |
| for item, quantity in d.items(): | |
| print(item, quantity) |
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
| https://code.google.com/codejam/ |
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 collections import Counter | |
| n = int(raw_input()) | |
| words = [raw_input().strip() for _ in range(n)] | |
| counts = Counter(words) | |
| print len(counts) | |
| for word in words: | |
| derp = counts.pop(word, None) |
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 collections import deque | |
| d = deque() | |
| for _ in range(int(input())): | |
| inp = input().split() | |
| getattr(d, inp[0])(*[inp[1]] if len(inp) > 1 else []) | |
| print(*[item for item in d]) |