Skip to content

Instantly share code, notes, and snippets.

View bshaffer's full-sized avatar

Brent Shaffer bshaffer

View GitHub Profile
#!/bin/bash
IMAGE="gcr.io/cloud-devrel-public-resources/owlbot-php:latest"
COMMON_PROTOS_PHP=~/Code/common-protos-php
GOOGLEAPIS_GEN=~/Code/googleapis-gen
docker run --rm --user $(id -u):$(id -g) \
-v $COMMON_PROTOS_PHP:/repo -v $GOOGLEAPIS_GEN:/googleapis-gen -w /repo \
--env HOME=/tmp \
gcr.io/cloud-devrel-public-resources/owlbot-cli:latest copy-code \
#!/bin/bash
IMAGE="gcr.io/cloud-devrel-public-resources/owlbot-php:latest"
COMMON_PROTOS_PHP=~/Code/common-protos-php
GOOGLEAPIS_GEN=~/Code/googleapis-gen
docker run --rm --user $(id -u):$(id -g) \
-v $COMMON_PROTOS_PHP:/repo -v $GOOGLEAPIS_GEN:/googleapis-gen -w /repo \
--env HOME=/tmp \
gcr.io/cloud-devrel-public-resources/owlbot-cli:latest copy-code \
#!/bin/bash
COMPONENT_NAME=""
if [ "$#" -eq 1 ]; then
COMPONENT_NAME=" -name $1 "
elif [ "$#" -ne 0 ]; then
echo "usage: generate-gapic-services.sh [COMPONENT]"
exit 1;
fi
@bshaffer
bshaffer / generate-all-apiary-services.sh
Last active February 9, 2023 15:14
bash script to loop through all the servivces and generate the preferred version
#!/bin/bash
# Make sure you clone the discovery-artifact-manager repo in the directory outside of this one:
# $ git clone https://github.com/googleapis/discovery-artifact-manager
SERVICES=("abusiveexperiencereport" "acceleratedmobilepageurl" "accessapproval" "accesscontextmanager" "adexchangebuyer2" "adexperiencereport" "admin" "admob" "adsense" "adsensehost" "alertcenter" "analytics" "analyticsadmin" "analyticsdata" "analyticshub" "analyticsreporting" "androiddeviceprovisioning" "androidenterprise" "androidmanagement" "androidpublisher" "apigateway" "apigee" "apigeeregistry" "apikeys" "appengine" "area120tables" "artifactregistry" "assuredworkloads" "authorizedbuyersmarketplace" "baremetalsolution" "batch" "beyondcorp" "bigquery" "bigqueryconnection" "bigquerydatatransfer" "bigqueryreservation" "bigtableadmin" "billingbudgets" "binaryauthorization" "blogger" "books" "businessprofileperformance" "calendar" "certificatemanager" "chat" "chromemanagement" "chromepolicy" "chromeuxreport" "civicinfo" "classroo
@bshaffer
bshaffer / list-services.js
Created November 22, 2022 14:51
list apiary services in JSON format
const { Octokit, App } = require("octokit");
async function run() {
const github = new Octokit();
// fetch tree head and look for /discoveries folder's tree SHA
const {
data: tree
} = await github.rest.git.getTree({
owner: "googleapis",
repo: "discovery-artifact-manager",
<?php
require 'vendor/autoload.php';
use Google\Cloud\Compute\V1\Disk;
use Google\Cloud\Compute\V1\Instance;
use Google\Cloud\Compute\V1\AttachedDisk;
use Google\Cloud\Compute\V1\NetworkInterface;
$instancesClient = new Google\Cloud\Compute\V1\InstancesClient();
$disksClient = new Google\Cloud\Compute\V1\DisksClient();
@bshaffer
bshaffer / polyfill-php70.diff
Last active September 1, 2020 23:54
Fix for WordPress Plugin error "Fatal error: Cannot declare class ArithmeticError". See below for instructions.
commit c79529943b7aa11ac328b1de6ac10173da35b453
Author: Julien Deniau <julien.deniau@gmail.com>
Date: Wed Sep 5 14:38:59 2018 +0200
add test to prevent lint from failing
diff --git a/vendor/symfony/polyfill-php70/Resources/stubs/ArithmeticError.php b/vendor/symfony/polyfill-php70/Resources/stubs/ArithmeticError.php
index 6819124..4c981d0 100644
--- a/vendor/symfony/polyfill-php70/Resources/stubs/ArithmeticError.php
+++ b/vendor/symfony/polyfill-php70/Resources/stubs/ArithmeticError.php
<?php
class NullSessionHandler implements SessionHandlerInterface
{
public function open($savePath, $sessionName)
{
return true;
}
public function close()
{
return true;
@bshaffer
bshaffer / index.php
Last active April 21, 2020 08:38
Example PHP CGI-style front controller
<?php
// Static list provides security against URL injection by default.
switch (@parse_url($_SERVER['REQUEST_URI'])['path']) {
case '/':
require 'homepage.php';
break;
case 'admin.php':
require 'admin.php';
break;