Skip to content

Instantly share code, notes, and snippets.

View aronbudinszky's full-sized avatar

Aron Budinszky aronbudinszky

View GitHub Profile
@aronbudinszky
aronbudinszky / todo-app-openapi.yaml
Created November 15, 2019 10:32
A fictional "Todo app" API.
openapi: 3.0.0
info:
title: Example Task Manager Project
description: An example API documentation for a task manager.
version: "1.0"
servers:
- url: 'https://example.com/taskmanager/'
components:
schemas:
Task:
@aronbudinszky
aronbudinszky / redoc-usage.sh
Last active November 15, 2019 09:56
Use redoc.
# Generates the spec into zero-dependency HTML file
redoc-cli bundle -o ~/desired/path/for/output/index.html ~/path/to/your/openapi.yaml
# Starts a server with spec rendered with ReDoc. Supports SSR mode (--ssr) and can watch the spec (--watch)
redoc-cli serve ~/path/to/your/openapi.yaml --watch
@aronbudinszky
aronbudinszky / redoc-install.sh
Created November 15, 2019 09:46
Install Redoc cli.
npm install -g redoc-cli
@aronbudinszky
aronbudinszky / prism-run.sh
Last active January 4, 2020 14:59
Run prism server.
# Run the prism server, you can set the port with -p to whatever you want
prism mock -p 4010 ~/path/to/your/openapi.yaml
# Now you can access the fake API endpoints
curl -X GET "http://127.0.0.1:4010/endpoint?parameter=value" -H "accept: application/json"
# If you have json_pp installed (available via Homebrew on macOS) you can even nicely format the response
curl -X GET "http://127.0.0.1:4010/endpoint?parameter=value" -H "accept: application/json" | json_pp
# You can also test specific response codes using the __code query string
@aronbudinszky
aronbudinszky / prism-install.sh
Created November 14, 2019 22:16
Install prism.
npm install -g @stoplight/prism-cli
@aronbudinszky
aronbudinszky / petstore-example.yaml
Created November 14, 2019 15:00
The example Petstore Swagger API yaml.
swagger: '2.0'
info:
description: |
This is a sample Petstore server. You can find
out more about Swagger at
[http://swagger.io](http://swagger.io) or on
[irc.freenode.net, #swagger](http://swagger.io/irc/).
version: 1.0.0
title: Swagger Petstore
termsOfService: http://swagger.io/terms/
@aronbudinszky
aronbudinszky / campfire-stream-running.sh
Last active October 9, 2019 21:50
Examples for running a campfire stream.
# Stream all lines from a log file
./tail-campfire.sh "/var/log/apache/example-site-error.log" "https://3.basecamp.com/.../lines"
# Stream lines that contain 'fatal error'
./tail-campfire.sh "/var/log/apache/example-site-error.log" "https://3.basecamp.com/.../lines" "fatal error"
# Run the script on a background thread
./tail-campfire.sh "/var/log/apache/example-site-error.log" "https://3.basecamp.com/.../lines" &
@aronbudinszky
aronbudinszky / campfire-stream.sh
Created October 9, 2019 21:46
An script for streaming log file contents into Basecamp Campfire.
#!/bin/bash
tail -n0 -F "$1" | while read LINE; do
(echo "$LINE" | grep -e "$3") && curl -X POST --silent --data-urlencode \
"content=$(echo $LINE)" "$2";
done
void main() async {
if (!kReleaseMode) {
// For Android devices you can also allowBadCertificates: true below, but you should ONLY do this when !kReleaseMode
final proxy = CustomProxy(ipAddress: "localhost", port: 8888);
proxy.enable();
}
// Run app
runApp(MyApp());
import 'dart:io';
import 'package:flutter/foundation.dart';
/// Allows you to set and enable a proxy for your app
class CustomProxy {
/// A string representing an IP address for the proxy server
final String ipAddress;
/// The port number for the proxy server
/// Can be null if port is default.