Skip to content

Instantly share code, notes, and snippets.

Kieren Johnstone kierenj

Block or report user

Report or block kierenj

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View sample.md

Debug output

Target: 33333333333333333333333333333333

Access key: 1111111111111111111111111111111111111111

Secret key: 2222222222222222222222222222222222222222

URL: https://vws.vuforia.com/targets/33333333333333333333333333333333/instances

View metricbeat-manifest.yml
---
apiVersion: v1
kind: ConfigMap
metadata:
name: metricbeat-config
namespace: kube-system
labels:
k8s-app: metricbeat
data:
metricbeat.yml: |-
View sql-opener-secret.yaml
apiVersion: v1
kind: Secret
metadata:
name: my-kube-secret-name
type: Opaque
data:
username: base64-encoded-username-here
password: base64-encoded-password-here
View sql-opener-initContainer.yaml
initContainers:
- image: redriversoftware/sql-azure-firewall-opener:latest
name: sql-azure-firewall-opener
env:
- name: username
valueFrom:
secretKeyRef:
name: my-kube-secret-name
key: username
- name: password
View headers3.cs
// the attribute itself - to put against our action parameters.
// combines the model binding engine with our value provider factory.
public class FromHeaderAttribute : ParameterBindingAttribute
{
public override HttpParameterBinding GetBinding(HttpParameterDescriptor parameter)
{
var httpConfig = parameter.Configuration;
var binder = new ModelBinderAttribute()
.GetModelBinder(httpConfig, parameter.ParameterType);
return new ModelBinderParameterBinding(
View headers2.cs
[HttpGet]
[Route("products")]
public IHttpActionResult GetProducts([FromUri]string filter, [FromHeader]StandardGetHeaders headers)
{
// validate headers (and any other bound fields), returning useful messages
// upon failure
if (!ModelState.IsValid) return BadRequest(ModelState);
// run our query
var results = RunGetProductsQuery(
View headers1.cs
[HttpGet]
[Route("products")]
public IHttpActionResult GetProducts([FromUri]string filter)
{
string headerValue = null;
IEnumerable headerValues;
if (Request.Headers.TryGetValue("X-Secret-Penguin-Handshake", out headerValues))
{
headerValue = headerValues.FirstOrDefault();
}
View rate-limited-client.cs
public class MyLimitedApiClient
{
private static readonly object _syncRoot = new object();
private DateTime? _nextRequestTimeSlot = null;
private readonly HttpClient _http;
private static readonly TimeSpan RateLimitedInterval = TimeSpan.FromSeconds(0.1); // 10 per sec
public async Task<T> GetJson<T>(string url) where T : class
{
View demo2.json
{
"swagger": "2.0",
"info": {
"version": "v1",
"title": "API"
},
"basePath": "\/",
"paths": {
"\/categories": {
"get": {
View sample.json
{
"swagger": "2.0",
"info": {
"version": "v1",
"title": "API"
},
"basePath": "\/",
"paths": {
"\/categories": {
"get": {
You can’t perform that action at this time.