Skip to content

Instantly share code, notes, and snippets.

@jrussett
Last active February 16, 2024 21:47
Show Gist options
  • Save jrussett/30cf7c89e4d920968734a2ff4b8bcfee to your computer and use it in GitHub Desktop.
Save jrussett/30cf7c89e4d920968734a2ff4b8bcfee to your computer and use it in GitHub Desktop.
Quick Reference

How to focus rake tests:

it 'does some sort of testing', :focus => true do

run_integration_specs(spec_path: 'spec/gocli/integration', tags: 'focus') or

rspec --tag focus spec/my_spec.rb

How to run bosh integration tests as a one-off in fly:

SPEC_PATH=spec/gocli/integration DB=postgresql CONCOURSE_TARGET=production be rake fly:integration

How to run BRATS as a one-off:

  • When running older versions of concourse, using the -x flag, and referencing tmp directories as inputs, make sure to git init . && git add -N . to have it not be mad af.
  • You probably want to run priviledged with -p
  • Check the task yml and sh (specifically the exports) for all the fun answers.

Tmux:

  • Ctrl + Space + S Sessions

Vim: Qutiting: ZZ :wq :x :cq - exit with an error code so git doesn't commit

Basic Movements:

  • w start of next word
  • b start of previous word
  • e end of next word
  • ge end of prev word

Inserting/Appending:

  • Shift + a move to end of line and append
  • Shift + i move to first char of line and insert

Line Movements:

  • 0 start of current line
  • ^ start of first word of current line
  • $ end of current line

Buffer Movements:

  • gg top of buffer
  • G bottom of buffer
  • <N>G or <N>gg move to line N

Moving Lines:

  • Alt + J or Alt + K move the selected (or under cursor) line(s) up and down :D

  • * will select the word/whatever under the cursor and find the next instance of it

  • n next instance of that thing

Collapsing:

  • z + c to collapse

  • z + o to open

  • z + a to collapse or open

  • z + M collapse all levels (everything)

  • z + R open all levels (everything)

  • z + m collapse a level / increase fold level

  • z + r open a level

Context-Aware splitting and joining

  • g + S split the line onto multiple lines based on context
  • g + J join the line onto a single line based on context

Ctrl + v to visually select Ctrl + n to add cursors on each line After visually selecting, use I to apply an insert to multiple lines Alt + m select everything under the cursor

Casing: c + r + _ or c + r + s changes case to snake case c + r + c changes case to camel case

daa delete around argument

ctags and navigating to function declarations:

  • :!ctags -R to generate the ctags (while in nvim)
  • Ctrl + ] go to declaration
  • g + ] list declarations
  • In go g + d will go to the definition (without the use of ctags)

Navigating quick fixes in vim unimpaired: [ + q last/prev/up an item in the list ] + q next/down an item in the list

Searching for stuff under the cursor:

  • Space + s + g with no arguments
  • Ctrl + r + Ctrl + w will paste whats under the cursor

Read in contents of file under cursor

  • :r

Checking Resources

Checking resources on bosh-io-release resources: fly -t TEAM check-resource --resource=PIPELINE/RESOURCE --from=version:261.4

Checking Pivotal Network (Pivnet) resources: fly -t TEAM cr -r PIPELINE/RESOURCE -f product_version:2.4.6#2019-04-16T20:20:23.919Z One can get the correct product version via https://network.pivotal.io/api/v2/products/p-isolation-segment/releases/, combine version key with software_files_updated_at

Checking time resources: fly -t <your target> check-resource -r PIPELINE/RESOURCE --from "time:2000-01-01T00:00:00Z" # the important part

Easily script Tile build with timestamp names

export version="0.1.0-build.$(date '+%s')"; ./build.sh <( echo "${version}" ) .; om upload-product -p "pas-for-kubernetes-${version}.pivotal"

relengy (local version file)

export version="2.12.0-build.$(date '+%s')";echo "$version" > $PWD/version; STUB_RELEASES=true ./bin/build <( echo "${version}" ) .; smith om -- upload-product -p "srt-${version}.pivotal

@jrussett
Copy link
Author

investigate gq(q)

@jrussett
Copy link
Author

jrussett commented Feb 8, 2019

See the TCP ports current bound on (listening on) the system:

ss -ltnp

-l LISTENING
-t for TCP
-n NO hostname lookup
-p display the PROCESS using the socket

@jrussett
Copy link
Author

jrussett commented Apr 5, 2019

@jrussett
Copy link
Author

jrussett commented May 8, 2019

Run ginkgo tests (ONLY ONE):

--focus=REGEXP

If provided, Ginkgo will only run specs with descriptions that match the regular expression REGEXP.

@jrussett
Copy link
Author

:% is a vim built in for :1,$ aka all the lines

@jrussett
Copy link
Author

Docker Login on mac fails

Error:

Error saving credentials: error storing credentials - err: exit status 1, out: `error storing credentials - err: exit status 1, out: `User interaction is not allowed.``

Solution:

Disable Docker Preferences > General > "Securely store Docker logins in macOS keychain"

@jrussett
Copy link
Author

jrussett commented Dec 12, 2019

Lifting the Service Account and CA from the current k8s config

CA

kubectl config view --raw --minify -o jsonpath='{.clusters[0].cluster.certificate-authority-data}' | base64 --decode

or
kubectl config view --minify -o json --raw | jq '.clusters[0].cluster["certificate-authority-data"]' -r | base64 --decode

Service Account Secret

kubectl config view --raw --minify -o jsonpath='{.users[0].user.token}'

@jrussett
Copy link
Author

Alt + N goes to the next instance of the errors.

@jrussett
Copy link
Author

jrussett commented Apr 9, 2020

:messages to view the latest messages that appeared in vim.

@jrussett
Copy link
Author

For a different version:

version=$(date '+%Y.%m.%d.%k.%m.%S')

Produces form:

2024.02.16.21.02.03

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