| Key/Command | Description |
|---|---|
| Tab | Auto-complete files and folder names |
| Ctrl + A | Go to the beginning of the line you are currently typing on |
| Ctrl + E | Go to the end of the line you are currently typing on |
| Ctrl + U | Clear the line before the cursor |
| Ctrl + K | Clear the line after the cursor |
| Ctrl + W | Delete the word before the cursor |
| Ctrl + T | Swap the last two characters before the cursor |
Kafka 0.11.0.0 (Confluent 3.3.0) added support to manipulate offsets for a consumer group via cli kafka-consumer-groups command.
- List the topics to which the group is subscribed
kafka-consumer-groups --bootstrap-server <kafkahost:port> --group <group_id> --describeNote the values under "CURRENT-OFFSET" and "LOG-END-OFFSET". "CURRENT-OFFSET" is the offset where this consumer group is currently at in each of the partitions.
- Reset the consumer offset for a topic (preview)
| # to undo a git push | |
| git push -f origin HEAD^:master | |
| # to get to previous commit (preserves working tree) | |
| git reset --soft HEAD | |
| # to get back to previous commit (you'll lose working tree) | |
| git reset --hard HEAD^ |
| <command> | |
| <ident value="only_if"> | |
| <pos line="38" column="2"/> | |
| </ident> | |
| <args_add_block value="false"> | |
| <args_add> | |
| <args_new/> | |
| <string_literal> | |
| <string_add> | |
| <string_add> |
| # Client id from Google Developer console | |
| # Client Secret from Google Developer console | |
| # Scope this is a space seprated list of the scopes of access you are requesting. | |
| # Authorization link. Place this in a browser and copy the code that is returned after you accept the scopes. | |
| https://accounts.google.com/o/oauth2/auth?client_id=[Application Client Id]&redirect_uri=urn:ietf:wg:oauth:2.0:oob&scope=[Scopes]&response_type=code | |
| # Exchange Authorization code for an access token and a refresh token. | |
| curl \ |
TIL - Today I Learned
Wednesday, 11/20/19
Explaining require and permit: params.require(:person).permit(:name, :age)
The params in a controller looks like a Hash, but it's actually an instance of ActionController::Parameters, which provides several methods such as require and permit.
The require method ensures that a specific parameter is present, and if it's not provided, the require method throws an error. It returns an instance of ActionController::Parameters for the key passed into require.
Originally published in June 2008
When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for me at first. In 30 minutes or less, it's difficult to get a solid read on a candidate's skill set without looking at code they've previously written. And in the corporate/enterprise world, I often don't have access to their previous work.
To ensure we hired competent ruby developers at my last job, I created a list of 15 ruby questions -- a ruby measuring stick if you will -- to select the cream of the crop that walked through our doors.
Candidates will typically give you a range of responses based on their experience and personality. So it's up to you to decide the correctness of their answer.
| #!/usr/bin/env ruby | |
| # sc - screenshot utility using imagemagick 'import' | |
| # Aftab: See this link: https://qr.ae/pGyZ0V | |
| require 'optparse' | |
| require 'ostruct' | |
| require 'shellwords' | |
| require 'fileutils' | |
| viewers = { |