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.helloWorld = function helloWorld(req, res) { | |
//Connect to MongoDB Atlas | |
var MongoClient = require('mongodb').MongoClient; | |
var uri = "mongodb://user:pass@cluster0-shard-00-00-6chsu.mongodb.net:27017,cluster-shard-00-01-6chsu.mongodb.net:27017,cluster-shard-00-02-6chsu.mongodb.net:27017/test?ssl=true&replicaSet=Cluster-shard-0&authSource=admin"; | |
MongoClient.connect(uri, function(err, db) { | |
//check for connection errors | |
if (err) res.status(400).send(err); | |
//Read the data from the incoming request & add it to an object to insert | |
var message = req.body.message; |
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
#!/bin/bash | |
# a script to make great time lapses from the narrative clip. | |
# copy files to safe place, iterate through with ls-v, use spinners | |
# find a .mp4, rename the files, make a timelapse with the files (use spinners and headless ffmpeg) | |
# And then turn into ts files? delete videos in progress? Less ram/storage better! | |
#convert videos to better files with ffmpeg | |
# concatenate all the ts files, be sure to specify codec | |
# clean up. |
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
<?php | |
$client_id = ''; | |
$client_secret = ''; | |
$redirect_uri= "http://localhost:8080/callback.php"; | |
$authorization_code = $_GET['code']; | |
if(!$authorization_code){ | |
die('something went wrong!'); | |
} |
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
await page.goto('https://www.wikihow.com/Tie-Your-Shoes'); | |
await page.waitForSelector('#article_shell'); | |
await page.screenshot({ | |
path: './production.png', | |
fullPage: false, | |
}) | |
await page.goto('https://www.wikihow.com/Tie-Your-Shoes'); | |
await page.waitForSelector('#article_shell'); | |
await page.screenshot({ | |
path: './local.png', |
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
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@0.11.7"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.2/Chart.bundle.min.js"></script> | |
<div style="width:400px;"> | |
<canvas id="myChart" width="400" height="400"></canvas> | |
</div> | |
<button onclick="train()">Train the model 1 step</button> | |
<script> | |
const trainX = [ | |
3.3, |
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'); | |
browser = await puppeteer.launch({ | |
headless: true, | |
slowMo: 80, | |
}); | |
page = await browser.newPage(); | |
await page.goto('http://example.com'); |
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
$ chrome --headless --screenshot=local.png \ | |
--window-size=1280,1000 localhost:8080 | |
$ chrome --headless --screenshot=production.png \ | |
--window-size=1280,1000 https://example.com/ | |
$ pixelmatch local.png production.png output.png 0.1 |
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
page.type('#name','Sammy',{ | |
delay: 50//how long to wait between keystrokes | |
}) | |
page.keyboard.type('Hello World!'); | |
page.keyboard.press('ArrowLeft'); | |
await page.keyboard.down('Shift'); | |
await page.keyboard.up('Shift'); |
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
let mouse = page.mouse(); | |
// same as page.click(), but uses a page x,y coordinate | |
mouse.click(300, 287,{ | |
button: 'middle',//left, right, middle | |
clickCount: 2, | |
delay: 20 //how long to hold down the mouse button | |
}) | |
mouse.down(); | |
mouse.up(); | |
mouse.move(x,y); |
NewerOlder