Skip to content

Instantly share code, notes, and snippets.

@kevinold
kevinold / safari-open-pages.py
Created September 29, 2023 16:33 — forked from aleks-mariusz/safari-open-pages.py
This script fetches the current open tabs in all Safari windows. Useful to run remotely on your mac when you are at work and want to read a page you have open (remotely) at home but don't remember the url but can log in to your home system on the command line
#!/usr/bin/python
#
# This script fetches the current open tabs in all Safari windows.
# Useful to run remotely on your mac when you are at work and want
# to read a page you have open (remotely) at home but don't remember
# the url but can log in to your home system on the cmmand line
#
import sys
@kevinold
kevinold / manually-remove-resource-from-amplify-project.md
Created August 12, 2022 13:44 — forked from josefaidt/manually-remove-resource-from-amplify-project.md
Instructions for surgically removing non-existent resource from local Amplify project

Let's say we've removed a Lambda Layer from the Lambda Console and are no longer able to perform operations using the Amplify CLI.

An error occurred fetching the latest layer version metadata for ""

> amplify remove function
? Choose the resource you would want to remove 10263layer58c94806 (layer)
When you delete a layer version, you can no longer configure functions to use it.
However, any function that already uses the layer version continues to have access to it.
✖ Loading layer data from the cloud...
/// <reference types="cypress" />
import _ from "lodash";
import path from "path";
import axios from "axios";
import dotenv from "dotenv";
import Promise from "bluebird";
import { percyHealthCheck } from "@percy/cypress/task";
import codeCoverageTask from "@cypress/code-coverage/task";
/*
Version: 0.1 (Rough and ready!)
Author: David Sim (nationalinterest on discord)
Date: 22 July 2021
Description: Creates links to
TODO: Validate whether the input information is valid
*/
/* Instructions for setup
const { SF_username, SF_password, SF_login_url } = Cypress.env()
describe('Programmatically log in to SF app', () => {
it('makes XHR req & loads dashboard', () => {
Cypress.log({name: 'loginViaOAuth'});
cy.request({
method: 'POST',
url: SF_login_url,
body: {
const { SF_username, SF_password, SF_client_id, SF_client_secret, SF_security_token } = Cypress.env()
describe('Programmatically log in to SF app', () => {
it('makes XHR req & loads dashboard', () => {
Cypress.log({name: 'loginViaOAuth'});
// request access token from SF OAuth endpoint
const oAuthTokenOptions = {
method: 'POST',
/// <reference types="cypress" />
import { random } from 'lodash'
const apiGraphQL = `${Cypress.env("apiUrl")}/graphql`;
const hasMutation = (req, operationName) => {
return req.body.hasOwnProperty("query") && req.body.query.includes(`mutation ${operationName}`)
}
const hasQuery = (req, operationName) => {
@kevinold
kevinold / find-ecr-image.sh
Created February 10, 2021 23:00 — forked from outofcoffee/find-ecr-image.sh
Check if Docker image exists with tag in AWS ECR
#!/usr/bin/env bash
# Example:
# ./find-ecr-image.sh foo/bar mytag
if [[ $# -lt 2 ]]; then
echo "Usage: $( basename $0 ) <repository-name> <image-tag>"
exit 1
fi
IMAGE_META="$( aws ecr describe-images --repository-name=$1 --image-ids=imageTag=$2 2> /dev/null )"

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

@kevinold
kevinold / machine.js
Created May 15, 2020 15:25
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions