sudo apt install zsh-autosuggestions zsh-syntax-highlighting zsh
| private Result getPeopleByGSI(@NotNull final String indexedReference, final String... attributes) { | |
| // make reference the index | |
| final DynamoDbIndex<People> index = DynamoUtil.peopleTable.index("someIndexedAttribute-index"); | |
| // Apply value to the indexed attribute (as the PartitionKey) | |
| final QueryConditional queryConditional = QueryConditional.keyEqualTo( | |
| Key.builder().partitionValue(indexedReference).build()); | |
| // Compose Filter expressions | |
| final List<String> expressions = new ArrayList<>(); | |
| final Expression.Builder expressionBuilder = Expression.builder(); |
| @Aspect | |
| @Component | |
| @Slf4j | |
| @ConditionalOnExpression("${aspect.enabled:true}") | |
| public class ExecutionTimeAdvice { | |
| @Around("@annotation(TrackExecutionTime)") | |
| public Object executionTime(ProceedingJoinPoint point) throws Throwable { | |
| long startTime = System.currentTimeMillis(); | |
| Object object = point.proceed(); |
A brief example on how to use npx to run gist based scripts.
Read the article here https://neutrondev.com/npm-vs-npx-whats-the-difference/ or watch it on YouTube https://www.youtube.com/watch?v=fSHWc8RTJug
First of all, please note that token expiration and revoking are two different things.
A JWT token that never expires is dangerous if the token is stolen then someone can always access the user's data.
Quoted from JWT RFC:
| /* | |
| * Migration | |
| */ | |
| 'use strict'; | |
| module.exports = { | |
| up: function(queryInterface, Sequelize) { | |
| return queryInterface.createTable('Users', { | |
| firstName: { | |
| type: Sequelize.STRING | |
| }, |
| function throttle(callback, wait, immediate = false) { | |
| let timeout = null | |
| let initialCall = true | |
| return function() { | |
| const callNow = immediate && initialCall | |
| const next = () => { | |
| callback.apply(this, arguments) | |
| timeout = null | |
| } |
| // Returns the value at a given percentile in a sorted numeric array. | |
| // "Linear interpolation between closest ranks" method | |
| function percentile(arr, p) { | |
| if (arr.length === 0) return 0; | |
| if (typeof p !== 'number') throw new TypeError('p must be a number'); | |
| if (p <= 0) return arr[0]; | |
| if (p >= 1) return arr[arr.length - 1]; | |
| var index = arr.length * p, | |
| lower = Math.floor(index), |
| # sudo apt-get install pv | |
| $ pv app.js | nc 192.168.1.123 10000 |
| import com.google.common.base.Function; | |
| import com.google.common.collect.Lists; | |
| import com.google.common.primitives.Ints; | |
| import lombok.Data; | |
| import org.junit.Test; | |
| import java.math.BigDecimal; | |
| import java.util.List; | |
| @Data |