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MTQZJFQYIWLPJ7D2LVN6QFN3AC
JPYY22Q5VCEZDNEBTHXYXUQWA2JUGOPHRYDSWIQM7KXHGTWS3GOQC
2P4N7P2I5G7VI6MLRW3LBTOTQJUPGGTR35X7XZSRWLPIJSGTKZIQC
MTWL5VOWRJZVR262KDQLY6WXTH2OY7YANNXZ7BKLN2R7G7JKNSHQC
RQAM2DALWSFFSYJUHCENWU2MVW6YQS5ZB3ZX7NJKQ3NIF2IBXKNAC
IIDU4QUMJGBATIMHZ6BQEXUUZ5PTSNEG5N2DVGJEOEJINYMNQ3XAC
IGM75BIHVB7ITQCKH27R7ND5FFFBUTRE76ZWYGYMSWOSLDH7JCGAC
JTUFSX4JQXMWPJ7I434LH7UYDRG6CJCADVKFROZCUW2IPX6AJ4ZQC
PNRVNQAR5O3OUU7QLQFUHE3RRDPHTN55MTMXQZ27TKYHNFGNXB2AC
7XDSK4NCXZTGTYEKI4ZPL763GDQQYMYP6OJZW2JGSQ7B5JVV7BKAC
XC5KCVUWLPJA4Q5IVLLQ25YWTE3DRUCJ3F3X4PW2VFCH4FQW7CAQC
IMOTK232APTO5HACVM2LWJXLF77PYVDGWPCMFBX3NMQUWRAFCUOAC
K6HI6ALCDQQONHZAJ7HUTDNRWECT6A5WM5EW6KNXFOPJZJVOLYIQC
GI4RONJBJVXXCLIUUZ4IEGH3FS3TCZZXLNJ3WQQJ4CPTJENKFKCAC
HKFGC6XAMYU7UYXEMYAA3D6W6BE6CQYTLIWOAJHJ3T7NMKCQPLEAC
ONMM7DGS45XMAQXFZBYP4BBCTZJWCECNGCNOI6UFGYZGJ5TYXPAAC
from collections import (
defaultdict,
Sequence,
)
import re
import subprocess
import six
def find_credentials(search_term):
lastpass_accounts = subprocess.Popen(
'lpass ls',
shell=True,
stdout=subprocess.PIPE,
matching_accounts = map(
lambda account: tuple(
# produces: (account_name, account_id)
re.sub('[\[\]]', '', account).strip().split(' id:')
),
(
if re.match(
'.*{}.*'.format(search_term),
account,
re.IGNORECASE
)
)
)
# TODO: allow user to fuzzy find when multiple matches
# fzf won't work in a jupyter console :(
account_name, account_id = list(matching_accounts)[0]
password = subprocess.Popen(
'lpass show -p {}'.format(account_id),
shell=True,
stdout=subprocess.PIPE,
return account_name, password
class EventbriteAPI(object):
_BASE_EVENTBRITE_API_URL = 'https://www.{domain}.com/v3/'
BASE_EVENTBRITE_API_URL_PROD = _BASE_EVENTBRITE_API_URL.format(domain='eventbriteapi')
BASE_EVENTBRITE_API_URL_QA = _BASE_EVENTBRITE_API_URL.format(domain='evbqaapi')
BASE_EVENTBRITE_API_URL_DEV = _BASE_EVENTBRITE_API_URL.format(domain='evbdevapi')
EVENTBRITE_API_URL_MAP = {
'prod': BASE_EVENTBRITE_API_URL_PROD,
'qa': BASE_EVENTBRITE_API_URL_QA,
'dev': BASE_EVENTBRITE_API_URL_DEV
}
self.base_url = self.EVENTBRITE_API_URL_MAP.get(self.environment, self.BASE_EVENTBRITE_API_URL_QA)
def reset_token(self, credentials=None):
self.token = credentials or find_credentials('{} token'.format(self.environment))[1]
def retrieve_n_pages(self, path, pages=None, **kwargs):
headers.update(kwargs.pop('headers', {}))
results = defaultdict(list)
continuation_token = None
next_page = 1
parameters.update(kwargs.pop('params', {}))
api_response = get(
headers=headers,
params=parameters,
**kwargs
)
if not api_response.ok:
results['errors'].append({
'request': api_response.request,
'error': api_response.text
})
break
response_json = api_response.json()
for key, val in six.iteritems(response_json):
if isinstance(val, Sequence):
results[key].extend(val)
else:
results[key].append(val)
return results
def get_events(self, pages=None, **kwargs):
return self.retrieve_n_pages(
'/users/me/events/',
pages=pages,
**kwargs
)['events']
def verify_response_properties(self, response, props):
'''pass in a dictionary of properties to an optional validaion function to
check that a response has that property and is truthy or the validation function returns something truthy '''
def verify_properties(dictionary, props):
errors = []
for prop, validation_func in six.iteritems(props):
try:
response_property_value = dictionary[prop]
except KeyError:
errors.append({
'type': 'PROP_NOT_IN_RESPONSE',
'message': 'prop {} is not included in response'.format(prop),
'property_value': dictionary
})
continue
try:
is_valid = validation_func(response_property_value)
except TypeError:
# type error is not a vailure because the validation function is optional
continue
except Exception as exc:
errors.append({
'type': 'EXCEPTION_DURING_VALIDATION',
'message': 'An exception was raised during validation: {}'.format(exc),
'property_value': response_property_value
})
if not is_valid:
errors.append({
'type': 'VALIDATION_FAILIRE',
'message': 'validation failed for prop {} with validation func {} resulting in: {}'.format(
prop,
validation_func.__name__,
is_valid
),
'property_value': response_property_value
})
return errors
errors = []
if isinstance(response, Sequence):
for dictionary_obj in response:
errors.extend(verify_properties(dictionary_obj, props))
else:
errors = verify_properties(response, props)
return errors
def published_events_have_ticket_classes(self, pages=None):
published_events = self.get_events(
pages=pages,
params={
# 'status': 'live,started,ended,completed',
'expand': 'ticket_classes'
}
)
errors = self.verify_response_properties(published_events, {'ticket_classes': True})
is_ok = not bool(errors)
return (is_ok, len(published_events), errors)
pagination = response_json.pop('pagination', {})
current_page_number = int(pagination.get('page_number', 0))
next_page = current_page_number + 1
has_more_items = bool(pagination.get('has_more_items'))
continuation_token = pagination.get('continuation')
self.eventbrite_url_format_str.format(path=path),
while has_more_items and pages <= next(iteration_counter):
parameters = dict(continuation=continuation_token) if continuation_token else dict(page=next_page)
has_more_items = True
iteration_counter = itertools.count()
pages = pages or 0
headers = self.base_headers()
def post_ticket_classes_to_event_legacy(self, event_id, **kwargs):
path = 'events/{event_id}/ticket_classes/'.format(event_id=event_id)
headers = self.base_headers()
headers.update(kwargs.pop('headers', {}))
params = kwargs.pop('params', {})
return post(
self.eventbrite_url_format_str.format(path=path),
headers=headers,
params=params,
**kwargs
)
try:
self.organization_id = self._get_organization_id()
except (KeyError, IndexError, AttributeError) as exc:
print(self.token, exc)
self.organization_id = None
def is_legacy_user(self):
return not bool(self.organization_id)
def _get_organization_id(self):
api_response = get(
self.base_url + 'users/me/organizations/',
headers=self.base_headers()
)
if not api_response.ok:
raise EventbriteAPIException('Getting organization information failed')
return api_response.json()['organizations'][0]['id']
def post_ticket_classes_to_event(self, event_id, **kwargs):
if self.is_legacy_user():
return self.post_ticket_classes_to_event_legacy(self, event_id, **kwargs)
path = '{base_url}events/{event_id}/ticket_classes/'.format(base_url=self.base_url, event_id=event_id)
headers = self.base_headers()
headers.update(kwargs.pop('headers', {}))
params = kwargs.pop('params', {})
return post(
path,
headers=headers,
params=params,
**kwargs
)
self.base_headers = lambda: {'Authorization': 'Bearer {}'.format(self.token)}
self.organization_id = None
self.token = None
self.reset_token(credentials=credentials)
self.eventbrite_url_format_str = '{base_url}{organization_base}{path}'.format(
base_url=self.base_url,
organization_base='organizations/{}/'.format(self.organization_id) or '',
path='{path}'
)
def __init__(self, environment=None, credentials=None):
self.environment = environment or 'qa'
).stdout.read().decode('utf-8').strip()
account for account in lastpass_accounts
).stdout.read().decode('utf-8').split('\n')
class EventbriteAPIException(Exception):
pass
from requests import get, post # noqa: F401
from datetime import datetime # noqa: F401
import itertools
import json # noqa: F401
This is the IPython startup directory
.py and .ipy files in this directory will be run *prior* to any code or files specified
via the exec_lines or exec_files configurables whenever you load this profile.
Files will be run in lexicographical order, so you can control the execution order of files
with a prefix, e.g.::
00-first.py
50-middle.py
99-last.ipy
# This file contains fish universal variable definitions.
# VERSION: 3.0
SETUVAR __fish_classic_git_prompt_initialized:\x1d
SETUVAR __fish_init_2_39_8:\x1d
SETUVAR __fish_init_2_3_0:\x1d
SETUVAR fish_color_autosuggestion:555\x1ebrblack
SETUVAR fish_color_cancel:\x2dr
SETUVAR fish_color_command:\x2d\x2dbold
SETUVAR fish_color_comment:red
SETUVAR fish_color_cwd:green
SETUVAR fish_color_cwd_root:red
SETUVAR fish_color_end:brmagenta
SETUVAR fish_color_error:brred
SETUVAR fish_color_escape:bryellow\x1e\x2d\x2dbold
SETUVAR fish_color_history_current:\x2d\x2dbold
SETUVAR fish_color_host:normal
SETUVAR fish_color_match:\x2d\x2dbackground\x3dbrblue
SETUVAR fish_color_normal:normal
SETUVAR fish_color_operator:bryellow
SETUVAR fish_color_param:cyan
SETUVAR fish_color_quote:yellow
SETUVAR fish_color_redirection:brblue
SETUVAR fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack
SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack
SETUVAR fish_color_status:red
SETUVAR fish_color_user:brgreen
SETUVAR fish_color_valid_path:\x2d\x2dunderline
SETUVAR fish_greeting:Welcome\x20to\x20fish\x2c\x20the\x20friendly\x20interactive\x20shell
SETUVAR fish_pager_color_completion:\x1d
SETUVAR fish_pager_color_description:B3A06D\x1eyellow
SETUVAR fish_pager_color_prefix:white\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
SETUVAR fish_user_paths:/usr/local/opt/fzf/bin
function __fish_using_command
set cmd (commandline -opc)
if [ (count $cmd) -eq (count $argv) ]
for i in (seq (count $argv))
if [ $cmd[$i] != $argv[$i] ]
return 1
end
end
return 0
end
return 1
end
complete -c rustup -n "__fish_using_command rustup" -s v -l verbose -d 'Enable verbose output'
complete -c rustup -n "__fish_using_command rustup" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup" -f -a "show" -d 'Show the active and installed toolchains'
complete -c rustup -n "__fish_using_command rustup" -f -a "install" -d 'Update Rust toolchains'
complete -c rustup -n "__fish_using_command rustup" -f -a "uninstall" -d 'Uninstall Rust toolchains'
complete -c rustup -n "__fish_using_command rustup" -f -a "update" -d 'Update Rust toolchains and rustup'
complete -c rustup -n "__fish_using_command rustup" -f -a "default" -d 'Set the default toolchain'
complete -c rustup -n "__fish_using_command rustup" -f -a "toolchain" -d 'Modify or query the installed toolchains'
complete -c rustup -n "__fish_using_command rustup" -f -a "target" -d 'Modify a toolchain\'s supported targets'
complete -c rustup -n "__fish_using_command rustup" -f -a "component" -d 'Modify a toolchain\'s installed components'
complete -c rustup -n "__fish_using_command rustup" -f -a "override" -d 'Modify directory toolchain overrides'
complete -c rustup -n "__fish_using_command rustup" -f -a "run" -d 'Run a command with an environment configured for a given toolchain'
complete -c rustup -n "__fish_using_command rustup" -f -a "which" -d 'Display which binary will be run for a given command'
complete -c rustup -n "__fish_using_command rustup" -f -a "doc" -d 'Open the documentation for the current toolchain'
complete -c rustup -n "__fish_using_command rustup" -f -a "man" -d 'View the man page for a given command'
complete -c rustup -n "__fish_using_command rustup" -f -a "self" -d 'Modify the rustup installation'
complete -c rustup -n "__fish_using_command rustup" -f -a "telemetry" -d 'rustup telemetry commands'
complete -c rustup -n "__fish_using_command rustup" -f -a "set" -d 'Alter rustup settings'
complete -c rustup -n "__fish_using_command rustup" -f -a "completions" -d 'Generate completion scripts for your shell'
complete -c rustup -n "__fish_using_command rustup" -f -a "help" -d 'Prints this message or the help of the given subcommand(s)'
complete -c rustup -n "__fish_using_command rustup show" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup show" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup install" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup install" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup uninstall" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup uninstall" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup update" -l no-self-update -d 'Don\'t perform self update when running the `rustup` command'
complete -c rustup -n "__fish_using_command rustup update" -l force -d 'Force an update, even if some components are missing'
complete -c rustup -n "__fish_using_command rustup update" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup update" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup default" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup default" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup toolchain" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup toolchain" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup toolchain" -f -a "list" -d 'List installed toolchains'
complete -c rustup -n "__fish_using_command rustup toolchain" -f -a "install" -d 'Install or update a given toolchain'
complete -c rustup -n "__fish_using_command rustup toolchain" -f -a "uninstall" -d 'Uninstall a toolchain'
complete -c rustup -n "__fish_using_command rustup toolchain" -f -a "link" -d 'Create a custom toolchain by symlinking to a directory'
complete -c rustup -n "__fish_using_command rustup toolchain" -f -a "help" -d 'Prints this message or the help of the given subcommand(s)'
complete -c rustup -n "__fish_using_command rustup toolchain list" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup toolchain list" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup toolchain install" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup toolchain install" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup toolchain uninstall" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup toolchain uninstall" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup toolchain link" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup toolchain link" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup toolchain help" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup toolchain help" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup target" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup target" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup target" -f -a "list" -d 'List installed and available targets'
complete -c rustup -n "__fish_using_command rustup target" -f -a "add" -d 'Add a target to a Rust toolchain'
complete -c rustup -n "__fish_using_command rustup target" -f -a "remove" -d 'Remove a target from a Rust toolchain'
complete -c rustup -n "__fish_using_command rustup target" -f -a "help" -d 'Prints this message or the help of the given subcommand(s)'
complete -c rustup -n "__fish_using_command rustup target list" -l toolchain -d 'Toolchain name, such as \'stable\', \'nightly\', or \'1.8.0\'. For more information see `rustup help toolchain`'
complete -c rustup -n "__fish_using_command rustup target list" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup target list" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup target add" -l toolchain -d 'Toolchain name, such as \'stable\', \'nightly\', or \'1.8.0\'. For more information see `rustup help toolchain`'
complete -c rustup -n "__fish_using_command rustup target add" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup target add" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup target remove" -l toolchain -d 'Toolchain name, such as \'stable\', \'nightly\', or \'1.8.0\'. For more information see `rustup help toolchain`'
complete -c rustup -n "__fish_using_command rustup target remove" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup target remove" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup target help" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup target help" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup component" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup component" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup component" -f -a "list" -d 'List installed and available components'
complete -c rustup -n "__fish_using_command rustup component" -f -a "add" -d 'Add a component to a Rust toolchain'
complete -c rustup -n "__fish_using_command rustup component" -f -a "remove" -d 'Remove a component from a Rust toolchain'
complete -c rustup -n "__fish_using_command rustup component" -f -a "help" -d 'Prints this message or the help of the given subcommand(s)'
complete -c rustup -n "__fish_using_command rustup component list" -l toolchain -d 'Toolchain name, such as \'stable\', \'nightly\', or \'1.8.0\'. For more information see `rustup help toolchain`'
complete -c rustup -n "__fish_using_command rustup component list" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup component list" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup component add" -l toolchain -d 'Toolchain name, such as \'stable\', \'nightly\', or \'1.8.0\'. For more information see `rustup help toolchain`'
complete -c rustup -n "__fish_using_command rustup component add" -l target
complete -c rustup -n "__fish_using_command rustup component add" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup component add" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup component remove" -l toolchain -d 'Toolchain name, such as \'stable\', \'nightly\', or \'1.8.0\'. For more information see `rustup help toolchain`'
complete -c rustup -n "__fish_using_command rustup component remove" -l target
complete -c rustup -n "__fish_using_command rustup component remove" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup component remove" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup component help" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup component help" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup override" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup override" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup override" -f -a "list" -d 'List directory toolchain overrides'
complete -c rustup -n "__fish_using_command rustup override" -f -a "set" -d 'Set the override toolchain for a directory'
complete -c rustup -n "__fish_using_command rustup override" -f -a "unset" -d 'Remove the override toolchain for a directory'
complete -c rustup -n "__fish_using_command rustup override" -f -a "help" -d 'Prints this message or the help of the given subcommand(s)'
complete -c rustup -n "__fish_using_command rustup override list" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup override list" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup override set" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup override set" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup override unset" -l path -d 'Path to the directory'
complete -c rustup -n "__fish_using_command rustup override unset" -l nonexistent -d 'Remove override toolchain for all nonexistent directories'
complete -c rustup -n "__fish_using_command rustup override unset" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup override unset" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup override help" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup override help" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup run" -l install -d 'Install the requested toolchain if needed'
complete -c rustup -n "__fish_using_command rustup run" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup run" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup which" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup which" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup doc" -l book -d 'The Rust Programming Language book'
complete -c rustup -n "__fish_using_command rustup doc" -l std -d 'Standard library API documentation'
complete -c rustup -n "__fish_using_command rustup doc" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup doc" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup man" -l toolchain -d 'Toolchain name, such as \'stable\', \'nightly\', or \'1.8.0\'. For more information see `rustup help toolchain`'
complete -c rustup -n "__fish_using_command rustup man" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup man" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup self" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup self" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup self" -f -a "update" -d 'Download and install updates to rustup'
complete -c rustup -n "__fish_using_command rustup self" -f -a "uninstall" -d 'Uninstall rustup.'
complete -c rustup -n "__fish_using_command rustup self" -f -a "upgrade-data" -d 'Upgrade the internal data format.'
complete -c rustup -n "__fish_using_command rustup self" -f -a "help" -d 'Prints this message or the help of the given subcommand(s)'
complete -c rustup -n "__fish_using_command rustup self update" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup self update" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup self uninstall" -s y
complete -c rustup -n "__fish_using_command rustup self uninstall" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup self uninstall" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup self upgrade-data" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup self upgrade-data" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup self help" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup self help" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup telemetry" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup telemetry" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup telemetry" -f -a "enable" -d 'Enable rustup telemetry'
complete -c rustup -n "__fish_using_command rustup telemetry" -f -a "disable" -d 'Disable rustup telemetry'
complete -c rustup -n "__fish_using_command rustup telemetry" -f -a "analyze" -d 'Analyze stored telemetry'
complete -c rustup -n "__fish_using_command rustup telemetry" -f -a "help" -d 'Prints this message or the help of the given subcommand(s)'
complete -c rustup -n "__fish_using_command rustup telemetry enable" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup telemetry enable" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup telemetry disable" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup telemetry disable" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup telemetry analyze" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup telemetry analyze" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup telemetry help" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup telemetry help" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup set" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup set" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup set" -f -a "default-host" -d 'The triple used to identify toolchains when not specified'
complete -c rustup -n "__fish_using_command rustup set" -f -a "help" -d 'Prints this message or the help of the given subcommand(s)'
complete -c rustup -n "__fish_using_command rustup set default-host" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup set default-host" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup set help" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup set help" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup completions" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup completions" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_using_command rustup help" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_using_command rustup help" -s V -l version -d 'Prints version information'
function __fish_using_command
set cmd (commandline -opc)
if [ (count $cmd) -eq (count $argv) ]
for i in (seq (count $argv))
if [ $cmd[$i] != $argv[$i] ]
return 1
end
end
return 0
end
return 1
end
complete -c rg -n "__fish_using_command rg" -s e -l regexp -d "Use pattern to search."
complete -c rg -n "__fish_using_command rg" -l color -d "When to use color. [default: auto]" -r -f -a "never auto always ansi"
complete -c rg -n "__fish_using_command rg" -l colors -d "Configure color settings and styles."
complete -c rg -n "__fish_using_command rg" -s E -l encoding -d "Specify the text encoding of files to search."
complete -c rg -n "__fish_using_command rg" -s g -l glob -d "Include or exclude files/directories."
complete -c rg -n "__fish_using_command rg" -l iglob -d "Include or exclude files/directories case insensitively."
complete -c rg -n "__fish_using_command rg" -s t -l type -d "Only search files matching TYPE."
complete -c rg -n "__fish_using_command rg" -s T -l type-not -d "Do not search files matching TYPE."
complete -c rg -n "__fish_using_command rg" -s A -l after-context -d "Show NUM lines after each match."
complete -c rg -n "__fish_using_command rg" -s B -l before-context -d "Show NUM lines before each match."
complete -c rg -n "__fish_using_command rg" -s C -l context -d "Show NUM lines before and after each match."
complete -c rg -n "__fish_using_command rg" -l context-separator -d "Set the context separator string. [default: --]"
complete -c rg -n "__fish_using_command rg" -l dfa-size-limit -d "The upper size limit of the generated dfa."
complete -c rg -n "__fish_using_command rg" -s f -l file -d "Search for patterns from the given file."
complete -c rg -n "__fish_using_command rg" -l ignore-file -d "Specify additional ignore files."
complete -c rg -n "__fish_using_command rg" -s m -l max-count -d "Limit the number of matches."
complete -c rg -n "__fish_using_command rg" -l max-filesize -d "Ignore files larger than NUM in size."
complete -c rg -n "__fish_using_command rg" -l maxdepth -d "Descend at most NUM directories."
complete -c rg -n "__fish_using_command rg" -l path-separator -d "Path separator to use when printing file paths."
complete -c rg -n "__fish_using_command rg" -s r -l replace -d "Replace matches with string given."
complete -c rg -n "__fish_using_command rg" -l regex-size-limit -d "The upper size limit of the compiled regex."
complete -c rg -n "__fish_using_command rg" -s j -l threads -d "The approximate number of threads to use."
complete -c rg -n "__fish_using_command rg" -s M -l max-columns -d "Don't print lines longer than this limit in bytes."
complete -c rg -n "__fish_using_command rg" -l type-add -d "Add a new glob for a file type."
complete -c rg -n "__fish_using_command rg" -l type-clear -d "Clear globs for given file type."
complete -c rg -n "__fish_using_command rg" -l files -d "Print each file that would be searched."
complete -c rg -n "__fish_using_command rg" -l type-list -d "Show all supported file types."
complete -c rg -n "__fish_using_command rg" -s a -l text -d "Search binary files as if they were text."
complete -c rg -n "__fish_using_command rg" -s c -l count -d "Only show count of matches for each file."
complete -c rg -n "__fish_using_command rg" -s F -l fixed-strings -d "Treat the pattern as a literal string."
complete -c rg -n "__fish_using_command rg" -s i -l ignore-case -d "Case insensitive search."
complete -c rg -n "__fish_using_command rg" -s n -l line-number -d "Show line numbers."
complete -c rg -n "__fish_using_command rg" -s N -l no-line-number -d "Suppress line numbers."
complete -c rg -n "__fish_using_command rg" -s q -l quiet -d "Do not print anything to stdout."
complete -c rg -n "__fish_using_command rg" -s u -l unrestricted -d "Reduce the level of "smart" searching."
complete -c rg -n "__fish_using_command rg" -s v -l invert-match -d "Invert matching."
complete -c rg -n "__fish_using_command rg" -s w -l word-regexp -d "Only show matches surrounded by word boundaries."
complete -c rg -n "__fish_using_command rg" -s x -l line-regexp -d "Only show matches surrounded by line boundaries."
complete -c rg -n "__fish_using_command rg" -l column -d "Show column numbers"
complete -c rg -n "__fish_using_command rg" -l debug -d "Show debug messages."
complete -c rg -n "__fish_using_command rg" -s l -l files-with-matches -d "Only show the paths with at least one match."
complete -c rg -n "__fish_using_command rg" -l files-without-match -d "Only show the paths that contains zero matches."
complete -c rg -n "__fish_using_command rg" -s H -l with-filename -d "Show file name for each match."
complete -c rg -n "__fish_using_command rg" -l no-filename -d "Never show the file name for a match."
complete -c rg -n "__fish_using_command rg" -l heading -d "Show matches grouped by each file."
complete -c rg -n "__fish_using_command rg" -l no-heading -d "Don't group matches by each file."
complete -c rg -n "__fish_using_command rg" -l hidden -d "Search hidden files and directories."
complete -c rg -n "__fish_using_command rg" -s L -l follow -d "Follow symbolic links."
complete -c rg -n "__fish_using_command rg" -l mmap -d "Searching using memory maps when possible."
complete -c rg -n "__fish_using_command rg" -l no-messages -d "Suppress all error messages."
complete -c rg -n "__fish_using_command rg" -l no-mmap -d "Never use memory maps."
complete -c rg -n "__fish_using_command rg" -l no-ignore -d "Don't respect ignore files."
complete -c rg -n "__fish_using_command rg" -l no-ignore-parent -d "Don't respect ignore files in parent directories."
complete -c rg -n "__fish_using_command rg" -l no-ignore-vcs -d "Don't respect VCS ignore files"
complete -c rg -n "__fish_using_command rg" -s 0 -l null -d "Print NUL byte after file names"
complete -c rg -n "__fish_using_command rg" -s o -l only-matching -d "Print only matched parts of a line."
complete -c rg -n "__fish_using_command rg" -s p -l pretty -d "Alias for --color always --heading --line-number."
complete -c rg -n "__fish_using_command rg" -s s -l case-sensitive -d "Search case sensitively."
complete -c rg -n "__fish_using_command rg" -s S -l smart-case -d "Smart case search."
complete -c rg -n "__fish_using_command rg" -l sort-files -d "Sort results by file path. Implies --threads=1."
complete -c rg -n "__fish_using_command rg" -l vimgrep -d "Show results in vim compatible format."
complete -c rg -n "__fish_using_command rg" -s h -l help -d "Prints help information. Use --help for more details."
complete -c rg -n "__fish_using_command rg" -s V -l version -d "Prints version information"
set -x PYENV_ROOT $HOME/.pyenv
set -x PYENV_SHELL fish
set -x PYTHON_2_PATH $PYENV_ROOT/versions/misc2/bin
set -x PYTHON_3_PATH $PYENV_ROOT/versions/misc3/bin
set -x RUSTPATH $HOME/.cargo/bin
set -x FZF_DEFAULT_COMMAND 'fd --type f --follow --hidden --exclude .git'
set -x FZF_CTRL_T_COMMAND $FZF_DEFAULT_COMMAND
set -x PATH $RUSTPATH $PYTHON_2_PATH $PYTHON_3_PATH $PYENV_ROOT/bin $PYENV_ROOT/shims $HOME/.local/bin $DOTFILES/bin /usr/local/bin $PATH
set -x WORKON_HOME $PYENV_ROOT/versions/
fish_vi_key_bindings
end
set -x EVENTBRITE ~/eventbrite_github/eventbrite
set -x BAY_HOME $EVENTBRITE/docker-dev
# source private variables if exist
set -x PRIVATE_VARIABLES_FILE "$DOTFILES/fish/private_variables.fish"
test -e "$PRIVATE_VARIABLES_FILE"; and source $PRIVATE_VARIABLES_FILE
set -x EDITOR emacsclient -c
# source other misc variables if exist
set -x MISC_VARIABLES_FILE "$DOTFILES/fish/misc_variables.fish"
test -e "$MISC_VARIABLES_FILE"; and source $MISC_VARIABLES_FILE
set -l ALLOW_VI_IN_TERM 'xterm-256color' 'screen-256color'
if contains $TERM $ALLOW_VI_IN_TERM
set -x DOTFILES ~/dotfiles
function update_dotfiles
set do_git_pull true
set force_update_installed_workflows false
for arg in $argv
switch $arg
case --force-update-workflows
set force_update_installed_workflows true
case --no-git --no-git-pull --no-pull
set do_git_pull false
end
end
pushd (pwd)
if eval $do_git_pull
# get latest version from github
cd $DOTFILES
set curr_branch (git rev-parse --abbrev-ref HEAD)
git stash > /dev/null 2>&1
git checkout master > /dev/null 2>&1
git pull > /dev/null 2>&1; and echo "pulling the latest from github..."
git checkout "$curr_branch" > /dev/null 2>&1
git stash pop > /dev/null 2>&1
popd
end
if test (uname) = "Darwin"
set workflows_path $DOTFILES/osx/automator_workflows/
set os_services_path ~/Library/Services
# if force update all workflows
if eval $force_update_installed_workflows
# install all osx automator workflows
cp -r $workflows_path $os_services_path; and echo "installing all available workflows"
else
# install only the workflows that aren't already installed
for wf in (ls $workflows_path)
if not contains "$wf" (ls $os_services_path)
cp -r "$workflows_path/$wf" $os_services_path; and echo "installing new workflow: $wf"
end
end
end
end
end
function fish_prompt --description 'Write out the prompt'
set -l last_status $status
end
# what actually gets printed to the screen
echo -ns (set_color $fish_color_user) "$USER"
echo -ns $normal @ (set_color $fish_color_host) (prompt_hostname)
echo -ns $normal ' ' (set_color $color_cwd) (prompt_pwd)
echo -ns $normal (__fish_vcs_prompt)
echo $normal
echo -s "└--" $prompt_status "-"$suffix " "
set -l prompt_status
if test $last_status -ne 0
set prompt_status ' ' (set_color $fish_color_status) "[$last_status]" "$normal"
end
set -l color_cwd
set -l prefix
set -l suffix
switch $USER
case root toor
if set -q fish_color_cwd_root
set color_cwd $fish_color_cwd_root
else
set color_cwd $fish_color_cwd
end
set suffix '#'
case '*'
set color_cwd $fish_color_cwd
set suffix '$'
end
# initialize our new variables
if not set -q __fish_classic_git_prompt_initialized
set -qU fish_color_user
or set -U fish_color_user -o green
set -qU fish_color_host
or set -U fish_color_host -o cyan
set -qU fish_color_status
or set -U fish_color_status red
set -U __fish_classic_git_prompt_initialized
end
end
function __fish_repaint_bind_mode --on-variable fish_key_bindings --description "Event handler; repaint when fish_key_bindings changes"
if status --is-interactive
commandline -f repaint ^/dev/null
end
end
function __fish_repaint_host --on-variable fish_color_host --description "Event handler, repaint when fish_color_host changes"
if status --is-interactive
commandline -f repaint ^/dev/null
end
end
function __fish_repaint_status --on-variable fish_color_status --description "Event handler; repaint when fish_color_status changes"
if status --is-interactive
commandline -f repaint ^/dev/null
end
end
function __fish_repaint_user --on-variable fish_color_user --description "Event handler, repaint when fish_color_user changes"
if status --is-interactive
commandline -f repaint ^/dev/null
end
end
# Hack; fish_config only copies the fish_prompt function (see #736)
if not set -q -g __fish_classic_git_functions_defined
set -g __fish_classic_git_functions_defined
set -l normal (set_color normal)
function colorize
set STRING
set COLOR $normal
set BOLD_OUTPUT False
for arg in $argv
# echo 'arg' $arg
# echo
switch $arg
case ls list
set_color -c
case --bold -b
set BOLD_OUTPUT True
case '--color-*'
set COLOR (echo $arg | rg '(\-\-color\-)(\w+)' --replace '$2')
case '*'
set STRING $STRING $arg
end
end
if echo (set_color -c) | grep -qw "$COLOR"
set COLOR_ESC_SEQ (set_color $COLOR)
if eval $BOLD_OUTPUT
set COLOR_ESC_SEQ (set_color -o $COLOR)
end
echo $COLOR_ESC_SEQ $STRING (set_color $normal)
else
error_message "$COLOR is not an available color"
end
end
set_color normal
function ebmysql
set host $EB_MYSQL_PROD_HOST
set user $EB_OKTA_USER
set lpass_lookup okta
set args_to_pass
set index 2
set last_was_flag 0
for flag in $argv
set arg $argv[$index]
set arg_is_flag 1
set arg_is_flag 0
end
switch $flag
case --lpass --lastpass --last-pass
if test $arg_is_flag -eq 0
set lpass_lookup $arg
else
error_message "--lpass --lastpass --last-pass flag requires an argument"
end
case -p --pass --password
if test $arg_is_flag -eq 0
set password $arg
else
error_message "-p --pass --password flag requires an argument"
return 1
end
case -h --host
if test $arg_is_flag -eq 0
else
error_message "-h and --host flag requires an argument"
return 1
end
case -u --user
if test $arg_is_flag -eq 0
set user $arg
else
error_message "-u --user flag requires an argument"
return 1
end
case '*'
end
set index (math $index + 1)
end
# if password is unset, get from lpass
if test $password = ""
set password (script_lpass $lpass_lookup)
end
end
if isatty stdout
echo "preparing to log into mysql"
echo "$host @ $user"
echo "..."
end
/usr/local/bin/mysql $args_to_pass -h "$host" -u "$user" --password="$password"
# if user is unset, ask for input interactively
# this won't happen if your env variables are set properly
if test $user = ""
echo "Please input your user name for mysql:$host"
read user
end
if test $last_was_flag -eq 0
set args_to_pass $args_to_pass $flag
else
set last_was_flag 0
end
# pass these directly to mysql unless they are arguments to the flags handled above
set last_was_flag 1
set last_was_flag 1
set tmp_host (find_in_env $arg)
set host $tmp_host
if test $tmp_host = ""
set host $arg
end
# look up the host url from the environment, if none, use whatever is passed here directly
set last_was_flag 1
# don't lookup the password with lpass, just use whatever is passed in here and send it to mysql directly
set last_was_flag 1
# if lpass flag not used, defaulted to looking up okta, unless password is passed in with the -p flag
if not echo $arg | grep -qE '^\-+'
# parse arguments into something that can be passed to mysql
set password ""
function error_message
set ERR_STRING
set RING_ALERT_BELL False
set BOLD_OUTPUT False
set ERR_COLOR 'red'
set NO_COLOR False
for arg in $argv
switch $arg
case --alert -a
set RING_ALERT_BELL True
case --bold -b
set BOLD_OUTPUT True
case --warn -w
set ERR_COLOR 'yellow'
case --no-color
set NO_COLOR True
case '*'
set ERR_STRING $ERR_STRING $arg
end
end
set ERR_MSG $ERR_STRING
if not eval $NO_COLOR
set COLOR_FLAGS "--color-$ERR_COLOR"
if eval $BOLD_OUTPUT
set COLOR_FLAGS '--bold' $COLOR_FLAGS
end
set ERR_MSG (colorize $COLOR_FLAGS $ERR_STRING)
end
echo "$ERR_MSG" > /dev/stderr
if eval $RING_ALERT_BELL
echo -ne '\a'
end
end
function sync_personal_email
# get new mail from imap.fastmail.com
if test (hostname) = "notmuch-thesogu"
else
ssh thesogu "mbsync fastmail" > /dev/null
end
if test $status -eq 0
# index new mail
notmuch new > /dev/null ^ /dev/stdout | grep -v "Note: Ignoring non-mail file:" | tee /dev/stderr
# INFO: notmuch tags all new mail with: inbox new unread
# add personal tag
# add tags to things that I want to call out, but still see in my inbox
# archive stuff that's important but I don't want in inbox
# receipts and order confirmations
notmuch tag -inbox +receipts -- tag:new AND tag:personal "(receipt or confirmation or purchase or payment)" and "(from:lyft or form:uber or from:square or from:amazon or homedepot or paypal)" not subject:review
# filter out cruft that I don't really want to see
notmuch tag -inbox +social_media_notifications -- tag:new AND tag:personal "(from:@twitter.com or from:@facebookmail.com)"
# remove new tag from everything
notmuch tag -new tag:new
# do clean up
# tag messages from work email as sent
# remove inbox tag from emails that I've replied to
end
end
# notmuch tag -inbox -unread -- tag:inbox AND tag:replied
notmuch tag -inbox -unread +sent -- from:chris@thesogu.com AND tag:personal
# add tags to things I want to see, but not in my inbox
set LOW_PRIORITY_SEARCH "(tag:personal AND tag:new) AND (from:spam@spam.spam"
for phrase in (cat "$DOTFILES/low_priority_list")
set LOW_PRIORITY_SEARCH $LOW_PRIORITY_SEARCH " OR from:$phrase" # the leading space is intentional
end
set LOW_PRIORITY_SEARCH $LOW_PRIORITY_SEARCH ") AND (not tag:receipt)"
notmuch tag +low_priority -inbox -new -- "$SPAM_SEARCH"
# filter out spam
set SPAM_SEARCH "(tag:personal AND tag:new) AND (from:spam@spam.spam"
for email in (cat "$DOTFILES/email_spam_list" "$DOTFILES/personal_email_filter")
set SPAM_SEARCH $SPAM_SEARCH " OR from:$email" # the leading space is intentional
end
set SPAM_SEARCH $SPAM_SEARCH ") AND (not tag:receipt)"
notmuch tag +spam -inbox -new -- "$SPAM_SEARCH"
notmuch tag +personal -- tag:new AND "(from:$PERSONAL_EMAIL or to:$PERSONAL_EMAIL or from:$PERSONAL_GMAIL or to:%@gmail.com)"
mbsync fastmail > /dev/null
function sync_eventbrite_email
# get new mail from imap.gmail.com
if test $status -eq 0
# index new mail
notmuch new > /dev/null ^ /dev/stdout | grep -v "Note: Ignoring non-mail file:" | tee /dev/stderr
# INFO: notmuch tags all new mail with: inbox new unread
# add tags to things that I want to call out, but still see in my inbox
# add tags to things I want to see, but not in my inbox
notmuch tag +eventbrite_github -inbox -- tag:new from:notifications@github.com subject:eventbrite
# filter out cruft that I don't really want to see
notmuch tag -inbox +deleted +sentry -- tag:new from:sentry@eventbrite.com or from:site-errors@eventbrite.com
notmuch tag -inbox +low_priority +jenkins -- tag:new from:eng-ops@eventbrite.com
# do clean up
# tag messages from work email as sent
# remove inbox tag from emails that I've replied to
# remove new tag from everything
notmuch tag -new -- tag:new AND tag:eventbrite
end
end
# notmuch tag -inbox -unread -- tag:inbox tag:replied tag:new
notmuch tag -inbox -unread +sent -- from:$EVENTBRITE_EMAIL tag:new
notmuch tag -inbox +low_priority -- tag:new from:jira@eventbrite.com not "$MY_NAME"
notmuch tag +api_support -- tag:new "(to:api@eventbrite.com OR to:eventbrite-api@googlegroups.com)"
notmuch tag +jira_mention -- tag:new from:jira@eventbrite.com "('mentioned you on' OR 'Chris Cummings')"
# add eventbrite tag
notmuch tag +eventbrite -- tag:new "(to:@eventbrite.com or from:$EVENTBRITE_EMAIL_PATTERN or to:@evbqa.com or from:@evbqa.com)"
# filter out spam
set SPAM_SEARCH "(tag:eventbrite AND tag:new) AND (from:spam@spam.spam"
for email in (cat "$DOTFILES/email_spam_list" "$DOTFILES/eventbrite_email_filter")
set SPAM_SEARCH $SPAM_SEARCH " OR from:$email" # the leading space is intentional
end
set SPAM_SEARCH $SPAM_SEARCH ")"
mbsync ebmail > /dev/null
else
ssh thesogu "mbsync ebmail" > /dev/null
end
if test (hostname) = "notmuch-thesogu"
function ebapi
set host $EB_API_QA_URL
set host_pattern qa
set expansions
set parameters
set path
set token
set args_to_pass
for arg in $argv
switch $arg
case '--host=*' '--env=*'
set host_pattern (echo $arg | cut -d '=' -f 2)
set host (find_in_env "api.*$host_pattern")
if test $host = ""
set host $arg
end
case '-e=*' '--expansions=*'
set expansions (echo $arg | cut -d '=' -f 2)
case '-t=*' '--token=*'
set token (echo $arg | cut -d '=' -f 2)
case '-p=*' '--param=*' '--params=*' '--parameters=*'
set parameters "$parameters&"(echo $arg | rg '(\-{1,2}p\w*=)(.*)' -o --replace '$2')
case '/*/'
set path $arg
case '*'
set args_to_pass $args_to_pass $arg
end
end
set token_pattern "$host_pattern.*token"
while not test -n "$token"
set token (script_lpass $token_pattern)
if not test -n "$token"
echo "A token can't be found in last pass with pattern: '$token_pattern'"
echo "try searching for your token in lastpass"
echo "or CTRL C to exit"
read token_pattern -P '>>> '
end
end
end
set url "$host$path?expand=$expansions$parameters"
json_request $url $args_to_pass -H "Authorization: Bearer $token"
case '--help'
echo USAGE:
echo 'ebapi [ENDPOINT] [FLAGS]'
echo 'FLAGS AVAILABLE: -h -p -e -t'
echo 'host, parameter, expansion, token'
echo 'any other arguments are passed directly to curl'
return 0
function attach_or_new_tmux_session
set session_name misc
set confirmed False
for arg in $argv
switch $arg
case -f --force
set confirmed True
case '*'
if not echo $arg | grep -e '^-'
set session_name (to_lower $arg)
end
end
end
if not eval $confirmed
echo "attach to tmux session: $session_name? [Y/n]"
read user_input
switch (to_lower $user_input)
case y yes 1
set confirmed True
case '*'
return 1 # indicates failure to attach
end
end
if eval $confirmed
if is_attached_tmux_session
if not tmux has-session -t "$session_name" > /dev/null ^&1
tmux new-session -ds $session_name
end
echo "to avoid nesting sessions, choose the $session_name session with C-b s"
else
echo "attaching to tmux session: $session_name"
tmux new-session -As "$session_name"
end
end
end
function ws
set query ""
set search_engine_url 'https://duckduckgo.com/?q='
set search_engine 'duckduckgo'
set output "gui_browser"
for arg in $argv
case --url -u
set output "url"
case --terminal-browser -t
set output "w3m"
case --browser -b
set output "gui_browser"
case --google
set search_engine_url 'https://google.com/?q='
set search_engine 'google'
set search_engine_url 'https://duckduckgo.com/?q='
set search_engine 'duckduckgo'
case '*'
end
end
set url_regex '^\s+(https?://)?(www.)?([a-z]+\.){1,3}[a-z]{2,4}(/.*)?'
set results_temp_file (mktemp /tmp/ws_search_result.XXXXXXXXXX)
w3m -dump "$search_engine_url$query" > $results_temp_file
set user_selection (cat $results_temp_file | rg "$url_regex" | sed 's/ *//g' | fzf --preview "echo {}; echo \"--------------------\"; cat $results_temp_file | rg {} -B 4")
if not echo $user_selection | rg -q "https?://"
set user_selection "https://$user_selection"
end
rm $results_temp_file
if test $output = 'url'
echo $user_selection
else if test $output = 'w3m'
w3m $user_selection
else if test $output = 'gui_browser'
python -m webbrowser $user_selection
else
echo $user_selection
end
end
echo "Opening $search_engine in $output"
echo "query: $query" | sed 's/%20/ /g'
if test $query = ""
set query $arg
else
set query "$query%20$arg"
end
case --duckduckgo --ddg
switch $arg
function pyactivate --description 'activate a pyenv virtualenv by name'
set VENV_NAME
for arg in $argv
switch $arg
case --help
echo 'USAGE:'
echo " pyactivate [venv_name] activate a pyenv-virtualenv by name"
echo ' pyactivate ls list available pyenv-virtualenvs'
echo
echo ' options:'
echo ' --help display this message'
return 0
case ls list
pyenv versions
return 0
case '--*'
error_message --warn --bold "$arg is an unrecognized flag"
return 9
case '*'
if test -n $VENV_NAME
set VENV_NAME $arg
end
end
end
if not test -n "$VENV_NAME"
error_message --alert 'virtual environment name is a required arguemnt'
return 1
else
if echo (pyenv versions) | grep -qw "$VENV_NAME"
set VENV_DIR "$PYENV_ROOT/versions/$VENV_NAME"
source $VENV_DIR/bin/activate.fish
else
error_message 'virtual env does not exist'
return 2
end
end
end
function new_lines_count
# if there are arguments, don't read from stdin, pipe them through
if test (count $argv) -ne 0
if test -f "$argv"
cat "$argv" | wc -l | rg -o '\d{1,}'
else
echo "$argv" | wc -l | rg -o '\d{1,}'
end
else
wc -l | rg -o '\d{1,}'
end
end
end
function emacs --description 'convenience wrapper for starting an emacs client and server'
# open emacs in gui by default
set TERMINAL_EMACS false
set passed_args
for arg in $argv
switch $arg
case -t --terminal
set TERMINAL_EMACS true
case '*'
set passed_args $passed_args $arg
end
end
/usr/local/bin/emacs --daemon ^ /dev/null > /dev/null
end
if eval $TERMINAL_EMACS
else
end
if not ps aux | grep -v grep | grep --silent 'emacsclient \-c'
# create frame if one doesn't exist otherwise use existing gui frame
set passed_args -c $passed_args
end
/usr/local/bin/emacsclient $passed_args > /dev/null &
/usr/local/bin/emacsclient -t $passed_args
if not ps aux | grep -v grep | grep --silent 'emacs.* \-\-daemon'
# if there is not an emacs server running, start one
function ebpresto
error_if_not_set EB_PRESTO_SERVER EB_PRESTO_USER
if test $status -ne 0
return $status
end
set PRESTO_PATH /usr/local/bin/presto
if not test -e $PRESTO_PATH
error_message "presto does not appear to be installed at $PRESTO_PATH"
end
eval $PRESTO_PATH --server $EB_PRESTO_SERVER --user $EB_PRESTO_USER $argv
end
function ebapi_paginate
set results_file (mktemp /tmp/ebapi_paginate.XXXXXX)
ebapi $argv > $results_file
set pagination_object (echo $results_file | jq -c '.pagination')
set continuation_token (echo $pagination_object | jq '.continuation')
rm $results_file
end
function cdfinder
set -l current_path (run_apple_script '
tell application "Finder"
try
set currFolder to (folder of the front window as alias)
on error
set currFolder to (path to home folder as alias)
end try
return (POSIX path of currFolder)
end tell
')
echo " Finder is at: $current_path, changing directories"
cd "$current_path"
end
# filter account list by argv, store in tmp_file
set tmp_file (mktemp /tmp/getpass_tmp_file.XXXXXXXXXXXXXXX)
lpass ls | rg -i "$argv" > $tmp_file
set match_count (new_lines_count $tmp_file)
set lpass_id_regex '\d{5,}'
if test $match_count -eq 0
echo "Could not find $argv -" (lpass status)
return 1
else if test $match_count -ge 2
# fuzzy find account, pass account id back, lpass finds then copies pass to clipboard
lpass show -cp $choice
else
lpass show -cp (cat $tmp_file | rg -o $lpass_id_regex)
end
rm $tmp_file
end
set choice (cat $tmp_file | fzf)
if test $status -eq 130
# fzf was quit without a choice
return 0
end
set choice (echo $choice | rg -o $lpass_id_regex)
function pass --description 'fuzzy find passwords from lastpass-cli'
for arg in $argv
switch $arg
case --help
echo 'pass: fuzzy find passwords from lastpass-cli'
echo 'USEAGE: pass [pattern]'
echo 'Note: most flags will get passed to ripgrep'
return 0
end
end
function copy
end
# if there are arguments, don't read from stdin, pipe them through
if test (count $argv) -ne 0
if test -f "$argv"
cat $argv | pbcopy
else
echo $argv | pbcopy
end
else
pbcopy
end
function rgvim
end
end
if [ $choice ]
/usr/local/bin/nvim "+/"(to_lower $argv) $choice
set choice (rg -il $argv | fzf -0 -1 --ansi --preview "cat {} | rg $argv --context 3")
function prettify_terminal_command
set result
set count 1
for arg in $argv
echo $arg
if test $count -gt 1
set count (math $count + 1)
set next $argv[$count]
if test $count -eq 2
set result $result (simple_quote $arg)
end
else # this should always be the base command
set result $arg
end
# echo $arg \\
end
for w in $result
echo $w
end
end
function find_in_env
set fzf_helper_msg "Choose an environment variable"
if echo $argv | grep -q .
env | rg -i $argv | fzf -1 -0 --header "$fzf_helper_msg" | cut -d '=' -f 2
else
env | fzf -1 -0 --header "$fzf_helper_msg" | cut -d '=' -f 2
end
end
function nmshow
# tag:api_support and tag:api_answered and tag:cx_can_answer and from:support@eventbrite.com
end
notmuch-remote show --format=json $argv | jq . | parse_notmuch_email | parsed_email_jq
function require_bin_in_path
set COUNT_NOT_IN_PATH 0
for arg in $argv
which $arg > /dev/null
if test $status -ne 0
set COUNT_NOT_IN_PATH (math $COUNT_NOT_IN_PATH + 1)
end
end
return $COUNT_NOT_IN_PATH
end
echo $arg
function script_lpass
# if logged out, log in
if not lpass status -q
end
end
set result (/usr/local/bin/lpass show -p -G "$argv")
if echo $result | grep -iq "multiple matches found"
end
echo $result
set result (lpass show -p (lpass ls | grep -i -E "$argv" | fzf | rg -o --replace '$1' '\[id: (\d+)\]'))
/usr/local/bin/lpass login $EB_LAST_PASS_USER > /dev/null
function rm
error_message "you do not want to delete / or ~... dumbass"
return 1
end
/bin/rm $argv
end
if echo $argv | grep -qE '(^|\s+)(/|~)\*?($|\s)'
end
function update_brew_packages --description 'update selected (or all) brew packages'
set no_confirm false
for arg in $argv
switch $arg
case --all --force -f
set no_confirm true
case --help
echo 'update selected brew packages'
echo 'OPTIONS:'
echo ' -all, --force -f: update every outdated package without confirmation'
return 0
end
end
set outdated_list_tmp_file (mktemp /tmp/outdated_list_tmp_file.XXXXXXXXXXX)
brew outdated > $outdated_list_tmp_file
if test (new_lines_count $outdated_list_tmp_file) -ne 0
cat outdated_list_tmp_file | xargs brew upgrade
else
cat outdated_list_tmp_file | fzf -m -n 1 --tac --header='choose packages to update with tab' | xargs brew upgrade
end
end
rm $outdated_list_tmp_file
if eval $no_confirm
brew update > /dev/null
function simple_quote
for arg in $argv
if echo $arg | contains_spaces
else
end
end
end
echo $arg
set should_quote true
end
if echo $arg | grep -Eq "$URL_REGEX"
set should_quote true
end
if eval $should_quote
echo "'$arg'"
set should_quote false
error_if_not_set URL_REGEX
function json_request
end
error_if_bin_not_available jq curl; or return 1
set HELP_MSG 'USAGE: json_request [REQUIRED: (URL) ] [OPTIONAL: (ARGS PASSED TO CURL) (OTHER OPTIONAL ARGS) ]
REQUIRED ARGUMENTS:
* URL
OPTIONS:
* --dry-run -- dont actually send the request via curl
* --log-parse-failures -- cat out non-json responses
* --jq="" -- pass arguments, flags, options to jq
* --print-curl-command -- pretty print out the resulting command to easily share with others
* --share-to-clipboard -- dry run and print resulting command to clipboard
* any flag or option for curl -- see `man curl` for details
EXAMPLES:
* json_request https://www.evbqaapi.com/v3/users/me/ -H "Authorization: Bearer SOME-TOKEN"
INFO:
* every argument is passed directly to curl _except_ the --jq="" argument.
* the quoted, space delimited arguments to the right of --jq= are passed directly to jq
* uses the curl installed by homebrew if it exists
ERRORS:
* 1 - required arguments are missing
* 2 - one of the required commands or functions is not available in the path
* 3 - the response cannot be parsed as json
see `man curl` and `man jq` for help with flags and options
'
set CAT_JSON_PARSE_FAILURES false
set CURL_ARGS -sS
set DRY_RUN false
set PRINT_CURL_COMMAND_OUT false
set PRINT_TO_CLIPBOARD false
set RETURN_STATUS_CODE 0
for arg in $argv
switch $arg
case '--help'
echo "$HELP_MSG"
return 0
case '--dry-run'
set DRY_RUN true
case '--print-curl-command'
set PRINT_CURL_COMMAND_OUT true
case '--share-to-clipboard'
set DRY_RUN true
set PRINT_CURL_COMMAND_OUT true
set PRINT_TO_CLIPBOARD true
case '--jq=*'
case '--log-parse-failures'
set CAT_JSON_PARSE_FAILURES true
case '*'
set CURL_ARGS $CURL_ARGS (simple_quote $arg)
end
end
if test (count $CURL_ARGS) -lt 2
error_message "missing required argument: URL"
return 1
end
set JQ_ARGS $JQ_ARGS (echo $arg | cut -d '=' -f 2)
set JQ_ARGS ""
* json_request https://www.evbqaapi.com/v3/users/me/owned_events/ --jq="[.events[] | select(.status == "live")], .pagination"
# use homebrew curl if it exists
end
if eval $PRINT_CURL_COMMAND_OUT
# TODO: find a way to format this into something that's easy for someone to copy and paste into
# another terminal
set pretty_command "$CURL_COMMAND $CURL_ARGS"
if eval $PRINT_TO_CLIPBOARD
echo $pretty_command | pbcopy
else
echo $pretty_command
end
end
if not eval $DRY_RUN
set JSON_FILE (mktemp /tmp/json_request.XXXXXXXXXX)
eval $CURL_COMMAND $CURL_ARGS > $JSON_FILE
# pretty format json file if can be parsed as json
cat $JSON_FILE | jq $JQ_ARGS ^ /dev/null
if test $status -ne 0
# cat out raw response if cannot be parsed as json
error_message "Response could not be parsed from request"
error_message -w "$CURL_COMMAND $CURL_ARGS"
if eval $CAT_JSON_PARSE_FAILURES
cat $JSON_FILE
end
set RETURN_STATUS_CODE 3
end
rm $JSON_FILE
end
return $RETURN_STATUS_CODE
if test $JQ_ARGS = ""; set JQ_ARGS '.'; end
set CURL_COMMAND /usr/local/opt/curl/bin/curl
if not test -e $CURL_COMMAND
set CURL_COMMAND curl
set RG_ARGS
set N_LARGEST 0
for arg in $argv
switch $arg
case '-n*'
if test $num -gt 0
set RG_ARGS $RG_ARGS "-c"
set N_LARGEST $num
end
case '*'
set RG_ARGS $RG_ARGS $arg
end
end
from heapq import nlargest
from sys import stdin
end
end
if test -e "$PY_FILE"
rm $PY_FILE
eval $COMMAND
for match in nlargest($N_LARGEST, stdin.readlines(), key=lambda l: l.split(':')[-1]):
print(match.strip())
" > $PY_FILE
set COMMAND "$COMMAND | python $PY_FILE"
end
if test $USE_FZF -gt 0
set FILTER_FILE_NAME 'cut -f 1 -d :'
set FZF_COMMAND "fzf --preview 'cat {}'"
set COMMAND "$COMMAND | $FILTER_FILE_NAME | $FZF_COMMAND"
end
set COMMAND "rg $RG_ARGS"
if test $N_LARGEST -gt 0
set PY_FILE (mktemp /tmp/srch_py.XXXXXXXXXXXXX)
printf "
case '--print'
set USE_FZF 0
set -l num (echo $arg | rg --replace '$1' -- '-n(\d+)')
set USE_FZF 1
function srch -d 'wrapper around ripgrep and fzf. USAGE: find top 5 files by num of matches: $ srch PATTERN -g GLOB -n5'
(define-key notmuch-search-mode-map "r" 'notmuch-search-reply-to-thread)
(define-key notmuch-search-mode-map "R" 'notmuch-search-reply-to-thread-sender)
;; (setq smtpmail-debug-info t)
;; (setq smtpmail-debug-verbose t)
getbrew () {
which -s brew
if [[ $? != 0 ]] ; then
echo "homebrew isn't installed."
echo "installing homebrew..."
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
else
echo "updating homebrew"
brew update
fi
}
}
install_basics () {
echo "sweet, a new machine! installing the basics..."
getbrew
which -s git || brew install git
brew install vim
brew install tmux
brew install the_silver_searcher
}
echo "getting your config files from github"
getDotfiles
}
install_apps () {
brew cask install google-chrome
brew cask install iterm2
brew cask install lastpass
brew cask install spectacle
brew cask install slack
brew cask install atom
brew cask install evernote
getDotfiles () {
dir=`pwd`
mkdir -p ~/dotfiles
git clone https://github.com/mistahchris/dotfiles.git ~/dotfiles
# create a symlink for .vimrc and .bash_profile in ~
ln -s ~/dotfiles/.bash_profile ~/.bash_profile
ln -s ~/dotfiles.vimrc ~/.vimrc
}
install_languages () {
brew install python
brew install python3
brew install go
brew install java
brew install node
brew install swift