Skip to content

Instantly share code, notes, and snippets.

@david-crespo
Last active February 7, 2024 16:39
Show Gist options
  • Save david-crespo/b5cd941045dc518a61e1eab1a5d1f50e to your computer and use it in GitHub Desktop.
Save david-crespo/b5cd941045dc518a61e1eab1a5d1f50e to your computer and use it in GitHub Desktop.
remove articles

What I ran to get this

rg -U '\n\n/// ' nexus/src/external_api/http_entrypoints.rs | 
  rg '///' | 
  codeblock txt | 
  ai -a 'this is a list of endpoint descriptions. I want to remove articles to make them more concise. for example, "fetch a sled" should become "fetch sled". output the full list of descriptions without articles'

user

this is a list of endpoint descriptions. I want to remove articles to make them more concise. for example, "fetch a sled" should become "fetch sled". output the full list of descriptions without articles

/// Returns a description of the external nexus API
/// Ping API
/// Fetch the top-level IAM policy
/// Update the top-level IAM policy
/// Fetch the current silo's IAM policy
/// Update the current silo's IAM policy
/// View the resource utilization of the user's current silo
/// View the current utilization of a given silo
/// Lists resource quotas for all silos
/// View the resource quotas of a given silo
/// Update the resource quotas of a given silo
/// List silos
/// Create a silo
/// Fetch a silo
/// List IP pools linked to silo
/// Delete a silo
/// Fetch a silo's IAM policy
/// Update a silo's IAM policy
/// List built-in (system) users in a silo
/// Path parameters for Silo User requests
/// Fetch a built-in (system) user
/// List a silo's IdP's name
/// Create a SAML IdP
/// Fetch a SAML IdP
/// Create a user
/// Delete a user
/// Set or invalidate a user's password
/// List projects
/// Create a project
/// Fetch a project
/// Delete a project
/// Fetch a project's IAM policy
/// Update a project's IAM policy
/// List all IP pools
/// Fetch an IP pool
/// List IP pools
/// Create an IP pool
/// Fetch an IP pool
/// Delete an IP pool
/// Update an IP pool
/// List an IP pool's linked silos
/// Link an IP pool to a silo
/// Unlink an IP pool from a silo
/// Make IP pool default for silo
/// Fetch the Oxide service IP pool
/// List ranges for an IP pool
/// Add a range to an IP pool
/// Remove a range from an IP pool
/// List IP ranges for the Oxide service pool
/// Add IP range to Oxide service pool
/// Remove IP range from Oxide service pool
/// List all floating IPs
/// Create a floating IP
/// Delete a floating IP
/// Fetch a floating IP
/// Attach a floating IP to an instance or other resource
/// Detach a floating IP from an instance or other resource
/// List disks
/// Fetch a disk
/// Delete a disk
/// Fetch disk metrics
/// Start importing blocks into a disk
/// Import blocks into a disk
/// Stop importing blocks into a disk
/// Confirm disk block import completion
/// List instances
/// Create an instance
/// Fetch an instance
/// Delete an instance
/// Reboot an instance
/// Boot an instance
/// Stop an instance
/// Fetch an instance's serial console
/// Stream an instance's serial console
/// List the SSH public keys added to the instance via cloud-init during instance creation
/// List an instance's disks
/// Attach a disk to an instance
/// Detach a disk from an instance
/// List certificates for external endpoints
/// Create a new system-wide x.509 certificate
/// Path parameters for Certificate requests
/// Fetch a certificate
/// Delete a certificate
/// Create an address lot
/// Delete an address lot
/// List address lots
/// List the blocks in an address lot
/// Create a loopback address
/// Delete a loopback address
/// List loopback addresses
/// Create switch port settings
/// Delete switch port settings
/// List switch port settings
/// Get information about a switch port
/// List switch ports
/// Apply switch port settings
/// Clear switch port settings
/// Create a new BGP configuration
/// List BGP configurations
/// Delete a BGP configuration
/// Create a new BGP announce set
/// Delete a BGP announce set
/// Enable a BFD session
/// Disable a BFD session
/// Get BFD status
/// List images
/// Create an image
/// Fetch an image
/// Delete an image
/// Promote a project image
/// Demote a silo image
/// List network interfaces
/// Create a network interface
/// Delete a network interface
/// Fetch a network interface
/// Update a network interface
/// List external IP addresses
/// Allocate and attach an ephemeral IP to an instance
/// Detach and deallocate an ephemeral IP from an instance
/// List snapshots
/// Create a snapshot
/// Fetch a snapshot
/// Delete a snapshot
/// List VPCs
/// Create a VPC
/// Fetch a VPC
/// Update a VPC
/// Delete a VPC
/// List subnets
/// Create a subnet
/// Fetch a subnet
/// Delete a subnet
/// Update a subnet
/// List network interfaces
/// Replace firewall rules
/// List routers
/// Fetch a router
/// Create a VPC router
/// Delete a router
/// Update a router
/// List routes
/// Fetch a route
/// Create a router
/// Delete a route
/// Update a route
/// List racks
/// Path parameters for Rack requests
/// Fetch a rack
/// List uninitialized sleds in a given rack
/// Add a sled to an initialized rack
/// List sleds
/// Fetch a sled
/// Set the sled's provision state
/// List instances running on a given sled
/// List physical disks
/// List switches
/// Fetch a switch
/// List physical disks attached to sleds
/// Access metrics data
/// Access metrics data
/// Upload a TUF repository
/// Get the description of a repository by system version.
/// List users
/// List groups
/// Fetch group
/// List built-in users
/// Fetch a built-in user
/// Path parameters for global (system) role requests
/// List built-in roles
/// Fetch a built-in role
/// Fetch the user associated with the current session
/// Fetch the silo groups the current user belongs to
/// List SSH public keys
/// Create an SSH public key
/// Fetch an SSH public key
/// Delete an SSH public key

assistant

/// Returns description of external nexus API
/// Ping API
/// Fetch top-level IAM policy
/// Update top-level IAM policy
/// Fetch current silo's IAM policy
/// Update current silo's IAM policy
/// View resource utilization of user's current silo
/// View current utilization of given silo
/// Lists resource quotas for all silos
/// View resource quotas of given silo
/// Update resource quotas of given silo
/// List silos
/// Create silo
/// Fetch silo
/// List IP pools linked to silo
/// Delete silo
/// Fetch silo's IAM policy
/// Update silo's IAM policy
/// List built-in (system) users in silo
/// Path parameters for Silo User requests
/// Fetch built-in (system) user
/// List silo's IdP's name
/// Create SAML IdP
/// Fetch SAML IdP
/// Create user
/// Delete user
/// Set or invalidate user's password
/// List projects
/// Create project
/// Fetch project
/// Delete project
/// Fetch project's IAM policy
/// Update project's IAM policy
/// List all IP pools
/// Fetch IP pool
/// List IP pools
/// Create IP pool
/// Fetch IP pool
/// Delete IP pool
/// Update IP pool
/// List IP pool's linked silos
/// Link IP pool to silo
/// Unlink IP pool from silo
/// Make IP pool default for silo
/// Fetch Oxide service IP pool
/// List ranges for IP pool
/// Add range to IP pool
/// Remove range from IP pool
/// List IP ranges for Oxide service pool
/// Add IP range to Oxide service pool
/// Remove IP range from Oxide service pool
/// List all floating IPs
/// Create floating IP
/// Delete floating IP
/// Fetch floating IP
/// Attach floating IP to instance or other resource
/// Detach floating IP from instance or other resource
/// List disks
/// Fetch disk
/// Delete disk
/// Fetch disk metrics
/// Start importing blocks into disk
/// Import blocks into disk
/// Stop importing blocks into disk
/// Confirm disk block import completion
/// List instances
/// Create instance
/// Fetch instance
/// Delete instance
/// Reboot instance
/// Boot instance
/// Stop instance
/// Fetch instance's serial console
/// Stream instance's serial console
/// List SSH public keys added to instance via cloud-init during instance creation
/// List instance's disks
/// Attach disk to instance
/// Detach disk from instance
/// List certificates for external endpoints
/// Create new system-wide x.509 certificate
/// Path parameters for Certificate requests
/// Fetch certificate
/// Delete certificate
/// Create address lot
/// Delete address lot
/// List address lots
/// List blocks in address lot
/// Create loopback address
/// Delete loopback address
/// List loopback addresses
/// Create switch port settings
/// Delete switch port settings
/// List switch port settings
/// Get information about switch port
/// List switch ports
/// Apply switch port settings
/// Clear switch port settings
/// Create new BGP configuration
/// List BGP configurations
/// Delete BGP configuration
/// Create new BGP announce set
/// Delete BGP announce set
/// Enable BFD session
/// Disable BFD session
/// Get BFD status
/// List images
/// Create image
/// Fetch image
/// Delete image
/// Promote project image
/// Demote silo image
/// List network interfaces
/// Create network interface
/// Delete network interface
/// Fetch network interface
/// Update network interface
/// List external IP addresses
/// Allocate and attach ephemeral IP to instance
/// Detach and deallocate ephemeral IP from instance
/// List snapshots
/// Create snapshot
/// Fetch snapshot
/// Delete snapshot
/// List VPCs
/// Create VPC
/// Fetch VPC
/// Update VPC
/// Delete VPC
/// List subnets
/// Create subnet
/// Fetch subnet
/// Delete subnet
/// Update subnet
/// List network interfaces
/// Replace firewall rules
/// List routers
/// Fetch router
/// Create VPC router
/// Delete router
/// Update router
/// List routes
/// Fetch route
/// Create router
/// Delete route
/// Update route
/// List racks
/// Path parameters for Rack requests
/// Fetch rack
/// List uninitialized sleds in given rack
/// Add sled to initialized rack
/// List sleds
/// Fetch sled
/// Set sled's provision state
/// List instances running on given sled
/// List physical disks
/// List switches
/// Fetch switch
/// List physical disks attached to sleds
/// Access metrics data
/// Access metrics data
/// Upload TUF repository
/// Get description of repository by system version.
/// List users
/// List groups
/// Fetch group
/// List built-in users
/// Fetch built-in user
/// Path parameters for global (system) role requests
/// List built-in roles
/// Fetch built-in role
/// Fetch user associated with current session
/// Fetch silo groups current user belongs to
/// List SSH public keys
/// Create SSH public key
/// Fetch SSH public key
/// Delete SSH public key

user

generate a shell script that uses sed to replace each old description with the new one. the file is called http_entrypoints.rs

assistant

sed -i '' \
-e 's/Returns a description of the external nexus API/Returns description of external nexus API/g' \
-e 's/Fetch the top-level IAM policy/Fetch top-level IAM policy/g' \
-e 's/Update the top-level IAM policy/Update top-level IAM policy/g' \
-e 's/Fetch the current silo.s IAM policy/Fetch current silo.s IAM policy/g' \
-e 's/Update the current silo.s IAM policy/Update current silo.s IAM policy/g' \
-e 's/View the resource utilization of the user.s current silo/View resource utilization of user.s current silo/g' \
-e 's/View the current utilization of a given silo/View current utilization of given silo/g' \
-e 's/View the resource quotas of a given silo/View resource quotas of given silo/g' \
-e 's/Update the resource quotas of a given silo/Update resource quotas of given silo/g' \
-e 's/Fetch a silo/Fetch silo/g' \
-e 's/Fetch a silo.s IAM policy/Fetch silo.s IAM policy/g' \
-e 's/Update a silo.s IAM policy/Update silo.s IAM policy/g' \
-e 's/Fetch a built-in (system) user/Fetch built-in (system) user/g' \
-e 's/Create a SAML IdP/Create SAML IdP/g' \
-e 's/Fetch a SAML IdP/Fetch SAML IdP/g' \
-e 's/Create a user/Create user/g' \
-e 's/Delete a user/Delete user/g' \
-e 's/Set or invalidate a user.s password/Set or invalidate user.s password/g' \
-e 's/Create a project/Create project/g' \
-e 's/Fetch a project/Fetch project/g' \
-e 's/Delete a project/Delete project/g' \
-e 's/Fetch a project.s IAM policy/Fetch project.s IAM policy/g' \
-e 's/Update a project.s IAM policy/Update project.s IAM policy/g' \
-e 's/Fetch an IP pool/Fetch IP pool/g' \
-e 's/Create an IP pool/Create IP pool/g' \
-e 's/Delete an IP pool/Delete IP pool/g' \
-e 's/Update an IP pool/Update IP pool/g' \
-e 's/List an IP pool.s linked silos/List IP pool.s linked silos/g' \
-e 's/Link an IP pool to a silo/Link IP pool to silo/g' \
-e 's/Unlink an IP pool from a silo/Unlink IP pool from silo/g' \
-e 's/Make IP pool default for silo/g' \
-e 's/Fetch the Oxide service IP pool/Fetch Oxide service IP pool/g' \
-e 's/List ranges for an IP pool/List ranges for IP pool/g' \
-e 's/Add a range to an IP pool/Add range to IP pool/g' \
-e 's/Remove a range from an IP pool/Remove range from IP pool/g' \
-e 's/List all floating IPs/List all floating IPs/g' \
-e 's/Create a floating IP/Create floating IP/g' \
-e 's/Delete a floating IP/Delete floating IP/g' \
-e 's/Fetch a floating IP/Fetch floating IP/g' \
-e 's/Attach a floating IP to an instance or other resource/Attach floating IP to instance or other resource/g' \
-e 's/Detach a floating IP from an instance or other resource/Detach floating IP from instance or other resource/g' \
-e 's/Fetch a disk/Fetch disk/g' \
-e 's/Delete a disk/Delete disk/g' \
-e 's/Start importing blocks into a disk/Start importing blocks into disk/g' \
-e 's/Import blocks into a disk/Import blocks into disk/g' \
-e 's/Stop importing blocks into a disk/Stop importing blocks into disk/g' \
-e 's/Create an instance/Create instance/g' \
-e 's/Fetch an instance/Fetch instance/g' \
-e 's/Delete an instance/Delete instance/g' \
-e 's/Boot an instance/Boot instance/g' \
-e 's/Stop an instance/Stop instance/g' \
-e 's/Fetch an instance.s serial console/Fetch instance.s serial console/g' \
-e 's/Stream an instance.s serial console/Stream instance.s serial console/g' \
-e 's/List the SSH public keys added to the instance via cloud-init during instance creation/List SSH public keys added to instance via cloud-init during instance creation/g' \
-e 's/List an instance.s disks/List instance.s disks/g' \
-e 's/Attach a disk to an instance/Attach disk to instance/g' \
-e 's/Detach a disk from an instance/Detach disk from instance/g' \
-e 's/Create a new system-wide x.509 certificate/Create new system-wide x.509 certificate/g' \
-e 's/Fetch a certificate/Fetch certificate/g' \
-e 's/Delete a certificate/Delete certificate/g' \
-e 's/Create an address lot/Create address lot/g' \
-e 's/Delete an address lot/Delete address lot/g' \
-e 's/List the blocks in an address lot/List blocks in address lot/g' \
-e 's/Create a loopback address/Create loopback address/g' \
-e 's/Delete a loopback address/Delete loopback address/g' \
-e 's/Create switch port settings/Create switch port settings/g' \
-e 's/Delete switch port settings/Delete switch port settings/g' \
-e 's/Get information about a switch port/Get information about switch port/g' \
-e 's/Create a new BGP configuration/Create new BGP configuration/g' \
-e 's/Delete a BGP configuration/Delete BGP configuration/g' \
-e 's/Create a new BGP announce set/Create new BGP announce set/g' \
-e 's/Delete a BGP announce set/Delete BGP announce set/g' \
-e 's/Create an image/Create image/g' \
-e 's/Fetch an image/Fetch image/g' \
-e 's/Delete an image/Delete image/g' \
-e 's/Promote a project image/Promote project image/g' \
-e 's/Demote a silo image/Demote silo image/g' \
-e 's/Create a network interface/Create network interface/g' \
-e 's/Delete a network interface/Delete network interface/g' \
-e 's/Fetch a network interface/Fetch network interface/g' \
-e 's/Update a network interface/Update network interface/g' \
-e 's/Allocate and attach an ephemeral IP to an instance/Allocate and attach ephemeral IP to instance/g' \
-e 's/Detach and deallocate an ephemeral IP from an instance/Detach and deallocate ephemeral IP from instance/g' \
-e 's/Create a snapshot/Create snapshot/g' \
-e 's/Fetch a snapshot/Fetch snapshot/g' \
-e 's/Delete a snapshot/Delete snapshot/g' \
-e 's/Create a VPC/Create VPC/g' \
-e 's/Fetch a VPC/Fetch VPC/g' \
-e 's/Delete a VPC/Delete VPC/g' \
-e 's/Create a subnet/Create subnet/g' \
-e 's/Fetch a subnet/Fetch subnet/g' \
-e 's/Delete a subnet/Delete subnet/g' \
-e 's/Update a subnet/Update subnet/g' \
-e 's/Fetch a router/Fetch router/g' \
-e 's/Create a VPC router/Create VPC router/g' \
-e 's/Delete a router/Delete router/g' \
-e 's/Update a router/Update router/g' \
-e 's/Fetch a route/Fetch route/g' \
-e 's/Create a router/Create router/g' \
-e 's/Delete a route/Delete route/g' \
-e 's/Update a route/Update route/g' \
-e 's/Fetch a rack/Fetch rack/g' \
-e 's/Add a sled to an initialized rack/Add sled to initialized rack/g' \
-e 's/Fetch a sled/Fetch sled/g' \
-e 's/Set the sled.s provision state/Set sled.s provision state/g' \
-e 's/List instances running on a given sled/List instances running on given sled/g' \
-e 's/Fetch a switch/Fetch switch/g' \
-e 's/Get the description of a repository by system version./Get description of repository by system version./g' \
-e 's/Fetch a built-in user/Fetch built-in user/g' \
-e 's/Fetch a built-in role/Fetch built-in role/g' \
-e 's/Fetch the user associated with the current session/Fetch user associated with current session/g' \
-e 's/Fetch the silo groups the current user belongs to/Fetch silo groups current user belongs to/g' \
-e 's/Fetch an SSH public key/Fetch SSH public key/g' \
http_entrypoints.rs
@david-crespo
Copy link
Author

I had to tweak the above command to change all the single quotes to double quotes and convert the .s into 's, plus I had to remove the bad line

-e 's/Make IP pool default for silo/g' \

but it works otherwise. Wild!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment