git log --branches --not --remotes --no-walk --decorate --oneline
(or after your working copy of a branch gets out of sync with the remote branch for any reason)
git fetch
| # You need to add a GPG public key to your local keyring before you can use it (located in ~/.gnupg) | |
| # You can specify a custom keyring file using the option --keyring <full_path_to_keyring> | |
| # For commands that operate on the keyring (such as import, list, etc.) you also need to include --no-default-keyring to | |
| # tell GPG to not look at/modify the default keyring | |
| gpg --import <key> | |
| # Generate key and add it to your default keyring | |
| gpg --gen-key | |
| # Encrypt - selects the key based on the recipient email (will be shown when you import the key) |
| # Basic Usage | |
| # 1. SSH into remote host | |
| # 2. $ screen | |
| # 3. run commands | |
| # 4. C-a C-d (detach) | |
| # Write stdout to a logfile | |
| # screen -L | |
| # Attach to the existing session |
| // using the debugger | |
| // 1. start with node inspect <script> | |
| // 2. add debugger statement(s) in code | |
| // 3. when execution stops on a debugger statement, use the repl command to get into a repl | |
| // 4. use c <ENTER> to continue execution | |
| // using the debugger + Jest | |
| // 1. start with: node inspect $(npm bin)/jest <test.ts> --runInBand | |
| // 2. same as steps 2-4 above |
| -- JSON decoding | |
| import Json.Decode | |
| type alias Document = { message : String } | |
| -- a decoder of type String that decodes the "message" field | |
| message = Json.Decode.field "message" Json.Decode.string | |
| -- a decode of type Document | |
| doc = Json.Decode.map Document message |
| # When using stubbed responses & a proc, you must explicitly pass in a proc - the implicit block parameter is ignored | |
| # works | |
| client.stub_responses(:get_object, proc { |context| { body: StringIO.new("Hi") } }) | |
| # does not work | |
| client.stub_responses(:get_object) do |context| | |
| # will never get here b/c the implicit block parameter is ignored | |
| { body: StringIO.new("HI") } | |
| end |
| ; Use this to drop into a debugger when a error occurs: M-x toggle-debug-on-error | |
| ; Trying to figure out how namespaced elisp functions work: https://www.greghendershott.com/2017/02/emacs-themes.html | |
| (defun dh/foo (x) | |
| "adds 4 to x" | |
| (+ x 4)) | |
| (dh/foo 1) | |
| (defun dh/bar (x, fn) | |
| "adds 5 to fn(x)" | |
| (+ 5 (fn x))) |
| # Run specs with a given random seed | |
| # rspec --seed <seed> | |
| # Returning different values from consecutive stub invocations | |
| allow(thing).to receive(:message).and_return(1, 2, 3, 4) | |
| # Yielding multiple times from a test double | |
| allow(thing).to receive(:each).and_yield(1).and_yield(2).and_yield(3).and_yield(4) | |
| # Lightweight custom matcher |
| Establish a local SSH tunnel to a remote server | |
| $ ssh -f <user>@<ip> -L <local_port>:<ip>:<remote_port> -N | |
| Generate a SSH public/private key pair (4096 bits, with no comment at the end of the public key) | |
| $ ssh-keygen -b 4096 -C "" | |
| Extract the public key from a private key | |
| $ openssl rsa -in private_key.pem -pubout # PEM formatted | |
| $ ssh-keygen -y -f private_key.pem # SSH formatted |