Skip to content

Instantly share code, notes, and snippets.

{
"rootUrl": "https://www.googleapis.com/",
"icons": {
"x32": "http://www.google.com/images/icons/product/search-32.gif",
"x16": "http://www.google.com/images/icons/product/search-16.gif"
},
"revision": "20200706",
"fullyEncodeReservedExpansion": true,
"resources": {
"videoCategories": {
const {SecretManagerServiceClient} = require('@google-cloud/secret-manager');
const client = new SecretManagerServiceClient();
const express = require('express');
const app = express();
let secret;
async function getSecret() {
if (!secret) {
const [version] = await client.accessSecretVersion({
@JustinBeckwith
JustinBeckwith / package-lock.json
Created January 7, 2020 15:35
package-lock.json example
{
"name": "@google-cloud/bigtable",
"version": "2.3.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@babel/code-frame": {
"version": "7.5.5",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz",
"integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==",
<html>
<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script>
<body>
<pre class="prettyprint">
const test = 'so this is great';
function boop(v1) {
console.log(v1, v2);
}
async function boop() {
console.error(`here is a backtick ${thing} this is fine`);
D0920 16:58:52.869000000 12304 dns_resolver.cc:348] Using native dns resolver
I0920 16:58:52.873000000 12304 timer_manager.cc:85] Spawn timer thread
I0920 16:58:52.891000000 12304 init.cc:153] grpc_init(void)
I0920 16:58:52.900000000 12304 completion_queue.cc:473] grpc_completion_queue_create_internal(completion_type=0, polling_type=0)
I0920 16:58:52.892000000 4892 timer_manager.cc:235] timers not checked: expect another thread to
I0920 16:58:52.965000000 4892 timer_manager.cc:183] sleep until kicked
I0920 16:58:53.113000000 12304 ssl_credentials.cc:128] grpc_ssl_credentials_create(pem_root_certs=(null), pem_key_cert_pair=0000000000000000, verify_options=000000000019D2B8, reserved=0000000000000000)
I0920 16:58:53.148000000 12304 plugin_credentials.cc:263] grpc_metadata_credentials_create_from_plugin(reserved=0000000000000000)
I0920 16:58:53.159000000 12304 composite_credentials.cc:262] grpc_composite_channel_credentials_create(channel_creds=000000000228C110, call_creds=00000000002ED2C0, reserved=00000000000
const {google} = require('googleapis');
async function cmlePredict(description_text) {
const client = await google.auth.getClient({
scopes: [
'https://www.googleapis.com/auth/cloud-platform'
]
});
const ml = google.ml('v1');
{
"captchaResult": "CAPTCHA_NOT_NEEDED",
"kind": "pagespeedonline#result",
"id": "https://github.com/",
"responseCode": 200,
"title": "The world's leading software development platform · GitHub",
"ruleGroups": {
"SPEED": {
"score": 58
}
<html>
<head>
<title>Getting Started</title>
</head>
<body>
<script src="bundle.js"></script>
</body>
</html>
@JustinBeckwith
JustinBeckwith / index.js
Last active June 26, 2017 17:48
Bounce a file with GCF
const request = require('request');
const gcs = require('@google-cloud/storage')();
const uuid = require('uuid/v4');
const bucket = gcs.bucket('el-gato-functions');
exports.bounce = (req, res) => {
const bounceUrl = req.get('bounceUrl') || 'https://www.googleapis.com/discovery/v1/apis/';
console.log(`requesting ${bounceUrl}`);
request(bounceUrl, (err, response, body) => {
-- warning: this query looks at ~2 TB of data and will cost ~$10 to run.
SELECT
COUNT(*) as cnt, package
FROM
JS(
(SELECT content FROM [bigquery-public-data:github_repos.contents] WHERE id IN (
SELECT id FROM [bigquery-public-data:github_repos.files] WHERE RIGHT(path, 12) = "package.json"
)),
content,
"[{ name: 'package', type: 'string'}]",