I hereby claim:
- I am andrhamm on github.
- I am andrhamm (https://keybase.io/andrhamm) on keybase.
- I have a public key ASD1L_zjBmhhjwPN9qUKs_j3afa7VxjZaxsSRq_qahht_Ao
To claim this, I am signing this object:
| /* | |
| * Use Chrome web inspector to remove elements for files | |
| * you don't want to count in the diff stats, then run this | |
| * function to update the diff stats in the UI | |
| */ | |
| function () { | |
| var allAdditions = 0; | |
| $(".diffstat > a").each( function (index, element) { | |
| $(".diffstat-bar", this).remove(); | |
| var addition = $.trim($(this).text().replace(/[A-Za-z$-]/g, "")); |
| # EXPIREEQ key value_assertion seconds | |
| # Set a timeout on key if the current value equals value_assertion. | |
| # EXPIREEQ is short for "EXPIRE if EQual" | |
| # The lua script: | |
| expireeq = <<-EOF | |
| local key = KEYS[1] | |
| local val_assert = ARGV[1] | |
| local ex = ARGV[2] | |
| local val = redis.call("GET", key) |
| <--- | |
| _._ _..._ .-', _.._(`)) | |
| '-. ` ' /-._.-' ',/ | |
| ) \ '. | |
| / _ _ | \ | |
| | a a / | | |
| \ .-. ; | |
| '-('' ).-' ,' ; | |
| '-; | .' | |
| \ \ / |
I hereby claim:
To claim this, I am signing this object:
| // Load user profile page, if using RES scroll so many comments are loaded onto the page | |
| // then enter the following in the browser's developer console. | |
| // it will delete 1 post/comment every 1500ms | |
| var $domNodeToIterateOver = $('.del-button .option .yes'), | |
| currentTime = 0, | |
| timeInterval = 1500; | |
| $domNodeToIterateOver.each(function() { |
| // Found this bookmarklet on a blog post somewhere and it is awesome. | |
| // Save to bookmark bar and click to kill any annoying floating headers that take up you vertical resolution | |
| javascript:(function()%7B(function%20()%20%7Bvar%20i%2C%20elements%20%3D%20document.querySelectorAll('body%20*')%3Bfor%20(i%20%3D%200%3B%20i%20%3C%20elements.length%3B%20i%2B%2B)%20%7Bif%20(getComputedStyle(elements%5Bi%5D).position%20%3D%3D%3D%20'fixed')%20%7Belements%5Bi%5D.parentNode.removeChild(elements%5Bi%5D)%3B%7D%7D%7D)()%7D)() |
| const AWS = require('aws-sdk'); | |
| AWS.config.logger = console; | |
| const dynamodb = new AWS.DynamoDB({ apiVersion: '2012-08-10' }); | |
| let val = 'some value'; | |
| let params = { | |
| TableName: "MyTable", | |
| ExpressionAttributeValues: { |
| # JWT-like tokens in Rails | |
| require 'openssl' | |
| require 'base64' | |
| # Generate encrypted signing key | |
| key = OpenSSL::PKey::RSA.new(2048) | |
| cipher = OpenSSL::Cipher.new('AES-128-CBC') |
The AWS JavaScript SDK (and presumably SDKs for other langauges) are dynamically configured from JSON files that specify all the possible API endpoints and their request/response structure for the given service.
In the case of Amazon Personalize, the minimal documentation only describes how to "load" these JSON files for the CLI SDK:
https://docs.aws.amazon.com/personalize/latest/dg/aws-personalize-set-up-aws-cli.html
Here is an example of how to configure a service client object in the JavaScript SDK. I arrived at this conclusion by exploring the node_modules/aws_sdk directory, specifically the apis, and clients subdirectory.
(Download the service models from the page linked above.)
| // handlers/await-state-machine-execution.js | |
| import AWS from 'aws-sdk'; | |
| import { snakeCaseObj } from '../lib/common'; | |
| const stepfunctions = new AWS.StepFunctions({apiVersion: '2016-11-23'}); | |
| const { | |
| STATE_MACHINE_ARN, | |
| } = process.env; |