Reorder and clean up aliases
This commit is contained in:
@@ -31,22 +31,27 @@ def vpn(con, bwname):
|
||||
|
||||
def _unlock(args):
|
||||
bw_unlock()
|
||||
aliases['unlock'] = _unlock
|
||||
|
||||
def _ivr(args):
|
||||
vpn("350Main", "IVR Technology")
|
||||
aliases['ivr'] = _ivr
|
||||
|
||||
def _glrestart(args):
|
||||
sudo nixos-container run gitlab -- systemctl restart gitlab
|
||||
sudo nixos-container run gitlab -- systemctl restart nginx
|
||||
aliases['glrestart'] = _glrestart
|
||||
|
||||
def _cfetch(args):
|
||||
bw_unlock()
|
||||
$CIRCLECI_CLI_TOKEN=$(bw get password CircleCI)
|
||||
compass workspace exec bazel run src/go/compass.com/tools/circleci_results_cache/fetch/cmd/fetch:fetch
|
||||
aliases['cfetch'] = _cfetch
|
||||
|
||||
def _aws_creds(args):
|
||||
$AWS_ACCESS_KEY_ID=$(bw get username "AWS Access Key")
|
||||
$AWS_SECRET_ACCESS_KEY=$(bw get password "AWS Access Key")
|
||||
aliases['aws_creds'] = _aws_creds
|
||||
|
||||
def _rebuild(args):
|
||||
system = uname()
|
||||
@@ -54,17 +59,21 @@ def _rebuild(args):
|
||||
darwin-rebuild --flake ~/.config/darwin switch
|
||||
else:
|
||||
sudo nixos-rebuild switch
|
||||
aliases['rebuild'] = _rebuild
|
||||
|
||||
def _yaml2json(args, stdin=None, stdout=None):
|
||||
import sys, yaml, json
|
||||
from yaml import CLoader
|
||||
json.dump(yaml.load(stdin, Loader=CLoader), stdout, indent=4)
|
||||
aliases['yaml2json'] = _yaml2json
|
||||
|
||||
def _py2env(args):
|
||||
vox new @(args[0]) -p /usr/bin/python2
|
||||
aliases['py2env'] = _py2env
|
||||
|
||||
def _py3env(args):
|
||||
vox new @(args[0])
|
||||
aliases['py3env'] = _py3env
|
||||
|
||||
def _rundock(args):
|
||||
if Path('/usr/bin/podman').exists():
|
||||
@@ -72,10 +81,12 @@ def _rundock(args):
|
||||
else:
|
||||
e = 'docker'
|
||||
@(e) exec -ti @(args[0]) /bin/bash
|
||||
aliases['rundock'] = _rundock
|
||||
|
||||
def _pip_extras(args):
|
||||
import importlib_metadata
|
||||
print(importlib_metadata.metadata(args[0]).get_all('Provides-Extra'))
|
||||
aliases['pip_extras'] = _pip_extras
|
||||
|
||||
# Container stuff
|
||||
def _newdock(args):
|
||||
@@ -85,9 +96,11 @@ def _newdock(args):
|
||||
e = 'docker'
|
||||
@(e) run -P --privileged=true -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v @(getcwd()):/dmnt -v /etc/pki:/etc/pki:ro -d --name @(args[1]) @(args[0]) /sbin/init
|
||||
rundock @(args[1])
|
||||
aliases['newdock'] = _newdock
|
||||
|
||||
def _unknown_host(args):
|
||||
sed -i -e @(args[0])d ~/.ssh/known_hosts
|
||||
aliases['unknown_host'] = _unknown_host
|
||||
|
||||
def _bake(args):
|
||||
from pathlib import Path
|
||||
@@ -95,21 +108,8 @@ def _bake(args):
|
||||
if not templates.exists():
|
||||
git clone src:greg/copier-templates.git ~/.copier-templates
|
||||
copier copy @(str(templates / args[0])) .
|
||||
|
||||
aliases['aws_creds'] = _aws_creds
|
||||
aliases['glrestart'] = _glrestart
|
||||
aliases['bake'] = _bake
|
||||
aliases['unlock'] = _unlock
|
||||
aliases['cfetch'] = _cfetch
|
||||
aliases['ivr'] = _ivr
|
||||
aliases['newdock'] = _newdock
|
||||
aliases['pip_extras'] = _pip_extras
|
||||
aliases['py2env'] = _py2env
|
||||
aliases['py3env'] = _py3env
|
||||
aliases['rebuild'] = _rebuild
|
||||
aliases['rundock'] = _rundock
|
||||
aliases['unknown_host'] = _unknown_host
|
||||
aliases['yaml2json'] = _yaml2json
|
||||
|
||||
###
|
||||
#
|
||||
# Other random nice-to-have things
|
||||
|
||||
Reference in New Issue
Block a user