View puppeteer_youtube.js
This file contains 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 puppeteer = require('puppeteer') | |
const screenshot = 'youtube_fm_dreams_video.png' | |
try { | |
const browser = await puppeteer.launch() | |
const page = await browser.newPage() | |
await page.goto('https://youtube.com') | |
await page.type('#search', 'Fleetwood Mac Dreams') | |
await page.click('button#search-icon-legacy') | |
await page.waitForSelector('ytd-thumbnail.ytd-video-renderer') |
View gist:3fe4a740640ea8116183ad8628086cae
This file contains 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
/** | |
* @name Etsy shopping cart | |
* @desc Goes to etsy.com, select the first knick knack and adds it to the shopping cart. | |
*/ | |
const assert = require('assert') | |
const puppeteer = require('puppeteer') | |
let browser | |
let page |
View Dockerfile
This file contains 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
FROM ubuntu:16.04 | |
# Create a user so our program doesn't run as root. | |
RUN mkdir -p /home/chrome/ | |
RUN groupadd -r chrome &&\ | |
useradd -r -g chrome -d /home/chrome -s /sbin/nologin -G audio,video chrome | |
ENV HOME=/home/chrome |
View s3dynamo.js
This file contains 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 AWS = require('aws-sdk') | |
const s3 = new AWS.S3() | |
const dynamodb = new AWS.DynamoDB() | |
exports.handler = (event, context, callback) => { | |
fetchS3() | |
.then(data => { | |
console.log(data) | |
return putDynamoDB(data.LastModified.toString()) | |
}) |
View s3dynamo.go
This file contains 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
package main | |
import ( | |
"fmt" | |
"github.com/aws/aws-lambda-go/events" | |
"github.com/aws/aws-lambda-go/lambda" | |
"github.com/aws/aws-sdk-go/aws" | |
"github.com/aws/aws-sdk-go/aws/session" | |
"github.com/aws/aws-sdk-go/service/dynamodb" | |
"github.com/aws/aws-sdk-go/service/s3" |
View numbers.js
This file contains 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
exports.handler = (event, context, callback) => { | |
const fibo = fib() | |
for (let i=0; i<30; i++){ | |
console.log(fibo()) | |
} | |
const result = { | |
"isBase64Encoded": false, | |
"statusCode": 200, | |
"headers": {}, | |
"body": "done" |
View numbers.go
This file contains 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
package main | |
import ( | |
"fmt" | |
"github.com/aws/aws-lambda-go/events" | |
"github.com/aws/aws-lambda-go/lambda" | |
) | |
func Handler() (events.APIGatewayProxyResponse, error) { | |
f := fibonacci() |
View numbers_recursive.js
This file contains 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
exports.handler = (event, context, callback) => { | |
for (let i=0; i<30; i++){ | |
console.log(fib(i)) | |
} | |
const result = { | |
"isBase64Encoded": false, | |
"statusCode": 200, | |
"headers": {}, | |
"body": "done" | |
} |
View hook_method.js
This file contains 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
var install_hook_to = function(obj) { | |
if (obj.hook || obj.unhook) { | |
throw new Error('Object already has properties hook and/or unhook'); | |
} | |
obj.hook = function(_meth_name, _fn, _is_async) { | |
var self = this, | |
meth_ref; | |
View aci.sh
This file contains 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
az group create --name timACI --location eastus | |
az container create --name simpleservice --image magneticio/simpleservice:1.0.0 --resource-group timACI --ip-address public --port 3000 | |
az container show --name simpleservice --resource-group timACI | |
Name ResourceGroup ProvisioningState Image IP:ports CPU/Memory OsType Location | |
------------- --------------- ------------------- ------------------------------ ------------------- --------------- -------- ---------- | |
simpleservice timACI Succeeded magneticio/simpleservice:1.0.0 52.191.116.216:3000 1.0 core/1.5 gb Linux eastus |
NewerOlder