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
| #!/bin/bash | |
| set -e | |
| cluster=$1 | |
| service=$2 | |
| container=$3 | |
| debug=$4 # pass word "debug" as 4th arg to see debug output | |
| check_val () { | |
| if [[ -z "${1}" ]]; then |
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
| """ | |
| Use KMS to encrypt or decrypt a file. | |
| Ex, | |
| python kmscrypt.py encrypt myfile.txt myfile.txt.ct | |
| python kmscrypt.py decrypt myfile.txt.ct myfile-copy.txt | |
| """ |
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
| import requests | |
| def _fake_requests_send(self, request, **kwargs): | |
| raise Exception("Un-mocked request! request: {0}".format(request.__dict__)) | |
| _real_requests_send = requests.sessions.Session.send | |
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
| import sys | |
| t = MyThing.objects.iterator() | |
| while True: | |
| try: | |
| record = it.next() | |
| sys.stdout.write('.') | |
| except StopIteration: | |
| break | |
| except Exception as ex: |
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
| def fix_data(model_manager, fields_to_update_with_defaults_dict, commit=False): | |
| bad_ids = [] | |
| all_ids = model_manager.values_list('id', flat=True) | |
| print "There are {} total IDs.".format(len(all_ids)) | |
| for b_id in all_ids: | |
| try: | |
| b = model_manager.get(id=b_id) | |
| except: | |
| bad_ids.append(b_id) |
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
| #!/usr/bin/env ruby | |
| Dir.chdir(ARGV[0]) | |
| raw_changeset_hashes = `hg log -r "head() and not(closed()) and not(date(-30)) and not outgoing()" --template "{node}\n"` | |
| changeset_hashes = raw_changeset_hashes.split(/\n/) | |
| if (changeset_hashes.length > 0) | |
| changeset_hashes.each do | h | | |
| if (system("hg up #{h}")) | |
| system('hg ci --close-branch -m "Closed automatically. Last changeset aged past 30 days"') | |
| system('hg nudge') |