Skip to content

Instantly share code, notes, and snippets.

View eyeezzi's full-sized avatar

Uzziah Eyee eyeezzi

View GitHub Profile
@eyeezzi
eyeezzi / cloudflare-subzone-creation-error.txt
Last active April 14, 2020 01:14
Debug output when trying to create a Cloudflare site based on a subdomain
cloudflare_zone.api-samplesite-com: Creating...
Error: Error creating zone "api.samplesite.com": error from makeRequest: HTTP status 400: content "{\"success\":false,\"errors\":[{\"code\":1116,\"message\":\"Please ensure you are providing the root domain and not any subdomains (e.g., example.com, not subdomain.example.com)\"}],\"messages\":[],\"result\":null}"
on DNS-CF-api-samplesite-com.tf line 6, in resource "cloudflare_zone" "api-samplesite-com":
6: resource "cloudflare_zone" "api-samplesite-com" {
@eyeezzi
eyeezzi / aiven_kafka_producer.js
Last active February 13, 2020 23:42
Connecting producer to Aiven Kafka not working
// Ensure process.env contains all the needed environment variables.
const kafka = require('node-rdkafka')
console.log(JSON.stringify(kafka.features))
// ["gzip","snappy","ssl","sasl","regex","lz4","sasl_gssapi","sasl_plain","sasl_scram","plugins","zstd","sasl_oauthbearer"]
const createProducer = (onDeliveryReport) => {
const producer = new kafka.Producer({
'metadata.broker.list': process.env.KAFKA_BROKERS_LIST,
'sasl.username': process.env.KAFKA_CLIENT_USERNAME,
@eyeezzi
eyeezzi / imagepullsecret_using_kubectl.yaml
Last active September 5, 2019 20:58
Output of terraform imagePullSecret creation
apiVersion: v1
data:
.dockerconfigjson: eyJhdXRocyI6eyJodHRwczovL2djci5pbyI6eyJ1c2VybmFtZSI6Il9qc29uX2tleSIsInBhc3N3b3JkIjoidGVzdCIsImVtYWlsIjoieW91cmVtYWlsQGV4YW1wbGUuY29tIiwiYXV0aCI6IlgycHpiMjVmYTJWNU9uUmxjM1E9In19fQ==
kind: Secret
metadata:
creationTimestamp: null
name: gcr-json-key
namespace: staging
type: kubernetes.io/dockerconfigjson
version: '3'
services:
user-simulator: # an instrumented service
build: user-simulator
environment:
JAEGER_SERVICE_NAME: user-simulator
JAEGER_AGENT_HOST: jaeger-agent
JAEGER_AGENT_PORT: 6832
JAEGER_SAMPLER_TYPE: const
/* api-service */
app.use('/api/v1/whereami', async (req, res, next) => {
const parentSpan = createContinuationSpan(tracer, req, 'whereami-request')
const childSpan = tracer.startSpan('city-from-ip', {childOf: parentSpan})
const _ = await axios.get(`http://ip-api.com/json/${req.ip}`)
childSpan.finish()
// Do more work and create more children spans.
/* in each service */
var opentracing = require('opentracing')
var initTracer = require('jaeger-client').initTracerFromEnv;
var tracer = initTracer()
/* user-simulator */
async function whereami() => {
const span = tracer.startSpan('whereami-request')
const location = await axios.get(`${process.env.API_SERVER_ADDRESS}/whereami`, {
headers: getCarrier(span, tracer)
})
span.finish()
@eyeezzi
eyeezzi / PSUILoginTestsCompact.swift
Last active December 19, 2018 18:25
Testing Flows
import XCTest
class PSUILoginTestsCompact: XCTestCase {
func setUpForFreshInstall() -> XCUIApplication {
let app = XCUIApplication()
app.launchArguments = ["UI_TESTING"]
app.launchEnvironment["SOME_ENV_KEY"] = "SOME_ENV_VALUE"
app.launch()
return app
@eyeezzi
eyeezzi / Customer.swift
Last active December 13, 2018 00:08
Testing Models
import Foundation
public struct Customer: RemoteModelType {
// public init(email: String? = nil, phone: String? = nil, firstName: String? = nil, ...) {}
public var billingAddress: Address? {
if var address = self.defaultAddress ?? self.addresses.first {
address.firstName = address.firstName ?? self.firstName
return address.isValidForBilling() ? address : nil
}
@eyeezzi
eyeezzi / CustomerDetailsViewControllerTests.swift
Last active December 12, 2018 23:49
Testing View Controllers
@testable import Shopify_POS
class CustomerDetailsViewControllerTests: PointOfSaleTests {
func testDetailsOfflineDisablesEdit() {
let customerDataProvider = CustomersDataProvider.Mock()
let customerDetails = CustomerDetailsViewController(account: account, customer: createCustomer(), /*...*/ reachability: ReachabilityMock(with: .none))
let navigationController = UINavigationController(rootViewController: customerDetails)
navigationController.view.resize(to: .modal)