- To warm and froth milk:
Push the on button once
- blue indicator lights up
- To only warm milk:
Push the on button two time
- blue indicator lights up (not helpful)
- To only froth milk:
Push the on button three times
- the blue indicator flashes
dP. .dP .d8888b. .d8888b. 88d888b. d888888b `8bd8' 88' `"" Y8ooooo. 88' `88 .d8P' .d88b. 88. ... 88 88 .Y8P dP' `dP `88888P' `88888P' dP d888888P
from requests import get, post, put | |
from json import dumps, loads | |
from sys import argv | |
from math import ceil | |
commands = [] | |
def addShard(idx, shard): | |
commands.append({ | |
"allocate" : { | |
"index" : idx, | |
"shard" : int(shard), | |
"allow_primary" : False, | |
"node" : backup_node | |
} | |
}) | |
state = loads(get('http://localhost:9200/_cluster/state?filter_metadata=true').content) | |
data_nodes = [] | |
for node in state['nodes']: | |
if "data" in state['nodes'][node]['attributes'] and state['nodes'][node]['attributes']['data'] == "false": | |
continue | |
data_nodes.append({ 'node': node, 'address': state['nodes'][node]['transport_address']}) | |
replica_count = int(ceil(len(data_nodes)/2.0)) | |
if len(argv) != 2: | |
print "You must specify which node is the backup node or the 'reset' command. Available nodes right now are:" | |
for node in data_nodes: | |
print "\t- %s (%s)" % (node['node'], node['address']) | |
quit() | |
if argv[1] == "reset": | |
put('http://localhost:9200/_settings', data='{ "index.routing.allocation.disable_allocation": false }') | |
put('http://localhost:9200/_settings', data='{ "index" : { "number_of_replicas" : %d } }' % replica_count) | |
quit() | |
backup_node = argv[1] | |
if backup_node not in state['nodes']: | |
print "Invalid data node" | |
quit() | |
put('http://localhost:9200/_settings', data='{ "index.routing.allocation.disable_allocation": true }') | |
put('http://localhost:9200/_settings', data='{ "index" : { "number_of_replicas" : %d } }' % (replica_count+1)) | |
for idx in state['routing_table']['indices']: | |
for shard in state['routing_table']['indices'][idx]['shards']: | |
addShard(idx, shard) | |
# this is a lot of output, TODO: consolidate this into just what's useful | |
print dumps(loads(post('http://localhost:9200/_cluster/reroute?pretty', data=dumps({ "commands": commands })).content), indent=4) | |
Push the on button once
- blue indicator lights up
Push the on button two time
- blue indicator lights up (not helpful)
Push the on button three times
- the blue indicator flashes
import subprocess | |
from json import dumps | |
# NOTE: Files will be written to the current directory, without any checks to prevent overwriting. Archiving and/or version control are not considered here, but highly encouraged. | |
# get a list of all webtasks for the current user | |
list_request = subprocess.run(['wt', 'ls'], stdout=subprocess.PIPE, text=True) | |
# transform that output into a list of task names | |
tasks = [ ln.replace('Name:','').strip() for ln in list_request.stdout.split("\n") if 'Name:' in ln ] | |
for task in tasks: | |
print("processing", task) | |
# the output contains some meta information, might as well grab that while we're here | |
# it does include any npm modules configured so if you're looking to migrate to | |
# another service, host, etc this is useful information | |
meta = [] | |
code = [] | |
in_code = False | |
# grab the info for this specific webtask | |
task_request = subprocess.run(['wt', 'inspect', '--fetch-code', task], stdout=subprocess.PIPE, text=True) | |
# iterate through the lines of output splitting meta from code and stashing respectively | |
for line in task_request.stdout.split("\n"): | |
if in_code: | |
# we're past the meta section so this is all code now | |
code.append(line) | |
elif line == 'Code:': | |
# this is the beginning of the code section, we don't need this line | |
in_code = True | |
else: | |
# we're still in the header section so stash this line in meta | |
meta.append(line) | |
# write the meta file | |
with open("%s.meta" % task, 'w') as fp: | |
fp.write("\n".join(meta)) | |
# write the code file | |
with open("%s.js" % task, 'w') as fp: | |
fp.write("\n".join(code)) | |
This needs to be done for every user and needs to be done for every machine (stored in a cookie or local storage).
Once you have switched from the parent account to a subaccount, your profile menu usually appears in the upper right corner will show the Display Name
in a bubble colored with the chosen Color
(below).
Note: you can switch back to the parent org by selecting Back to [ YOUR USERNAME ]
in that same profile menu.
My Organization
Organizational Structure
chart copy the account numbers and names of the subaccounts you wish to accessBack to [ YOUR USERNAME ]
option in the profile menu).Switch role
Switch Role
againPreparation
above)OrganizationAccountAccessRole
Switch Role
import hashlib | |
from json import dumps | |
from collections import OrderedDict | |
# composerFileContents should be the dict version of the composer.json file | |
def getContentHash(composerFileContents): | |
relevant = OrderedDict((key, composerFileContents[key]) for key in composerFileContents.keys() if key in ['name','version','require','require-dev','conflict','replace','provide','minimum-stability','prefer-stable','repositories','extra']) | |
if 'config' in composerFileContents and 'platform' in composerFileContents['config']: | |
relevant['config']['platform'] = composerFileContents['config']['platform'] | |
# hacky fix to cover the differences between JSON encoding in Python vs PHP | |
encstr = dumps(OrderedDict((key, relevant[key]) for key in sorted(relevant.keys())),separators=(',', ':')).replace("/", "\\/").encode() | |
return hashlib.md5(encstr).hexdigest() |