This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| ACCOUNT_ID=$AWS_ACCOUNT_ID | |
| REGION=$AWS_REGION | |
| aws ecr get-login-password --region ${REGION} | docker login --username AWS --password-stdin "${ACCOUNT_ID}.dkr.ecr.${REGION}.amazonaws.com" | |
| dockerconfigjson=$(cat ~/.docker/config.json | base64 -w0) | |
| # This local minikube secret should be used as imagePullSecret in Deployment manifests applied to minikube | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * inspired by https://gist.github.com/astamicu/eb351ce10451f1a51b71a1287d36880f | |
| * modified to remove all liked Youtube videos and to work with Youtube as of June 2023 | |
| */ | |
| setInterval(function () { | |
| videos = document.getElementsByTagName('ytd-playlist-video-renderer'); | |
| // when a video is removed, the tag gets an 'is-dimissed' attribute, which tripped the original script | |
| var notDismissedIndex = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Quoted from: | |
| * https://www.alphr.com/delete-all-watch-later-videos-youtube/ | |
| * The above used xpath with a span, which doesn't work for Youtube as of June 2023 | |
| */ | |
| setInterval(function () { | |
| document.querySelector('#primary button[aria-label="Action menu"]').click(); | |
| var things = document.evaluate( '//yt-formatted-string[contains(text(),"Remove from")]', | |
| document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null ); | |
| for (var i = 0; i < things.snapshotLength; i++) { things.snapshotItem(i).click(); } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import moment from 'moment'; | |
| import {GraphQLScalarType, GraphQLError, Kind} from 'graphql'; | |
| module.exports = new GraphQLScalarType({ | |
| name: 'Date', | |
| /** | |
| * Serialize date value into string | |
| * @param {moment} value date value | |
| * @return {String} date as string | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const {RateLimiter} = require('limiter'); | |
| async function main(rate, interval) { | |
| const rateLimiter = new RateLimiter(rate, interval); | |
| for await (const iter of queryBatches('ExampleTable', {keyConditionExpressoin: {...}, expressionAttributeValues: {...}})) { | |
| const {ConsumedCapacity} = iter.metadata(); | |
| for (const value of iter) { | |
| // You can use functional-pipelines to reduce or transduce the iterator as needed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const {RateLimiter} = require('limiter'); | |
| RateLimiter.prototype.getTokens = async function (count) { | |
| const that = this; | |
| if (count <= this.tokenBucket.bucketSize) { | |
| return new Promise((resolve, reject) => { | |
| this.removeTokens(count, (err, remaining) => { | |
| if (err) { | |
| return reject(err); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const F = require('functional-pipelines') | |
| async function queryAll(table, {keyConditionExpression, expressionAttributeValues, strict, limit} = {}, options = {}, params = {}) { | |
| return F.reduceAsync(F.append(/*reducingFn*/), () => [], querySequence(table, {keyConditionExpression, expressionAttributeValues, limit, strict}, options, params)); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async function* querySequence(table, {keyConditionExpression, expressionAttributeValues, strict = false, limit} = {}, options = {}, params = {}) { | |
| return yield* queryBatches(table, {keyConditionExpression, expressionAttributeValues, strict, limit, flatten: true}, options, params); // see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/yield* | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const F = require('functional-pipelines'); | |
| async function* queryBatches(table, {keyConditionExpression, expressionAttributeValues, strict = false, limit, flatten = false} = {}, options = {}, params = {}) { | |
| let LastEvaluatedKey; | |
| let Count; | |
| let ScannedCount; | |
| let ConsumedCapacity; | |
| let itemsBatch = []; | |
| let resultsCount = 0; | |
| let yieldCount = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async function query(table, {keyConditionExpression, expressionAttributeValues} = {}, options = {}, params = {}) { | |
| const docClient = new AWS.DynamoDB.DocumentClient({...options}); | |
| const requiredParams = { | |
| TableName: table, | |
| KeyConditionExpression: keyConditionExpression, | |
| ExpressionAttributeValues: expressionAttributeValues, | |
| ReturnConsumedCapacity: 'TOTAL' | |
| }; | |
| return docClient.query({...requiredParams, ...params}).promise(); | |
| } |
NewerOlder