Skip to content

Instantly share code, notes, and snippets.

View DinoChiesa's full-sized avatar

Dino Chiesa DinoChiesa

View GitHub Profile
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; restclient - invoke REST API calls from within Emacs
(require 'restclient)
(eval-after-load "restclient"
(if (not (fboundp 'json-pretty-print-buffer))
(defun json-pretty-print-buffer ()
(json-prettify-buffer))))
# -*- restclient -*-
#
# URLs for querying Apigee Edge
# Yes, this runs within emacs.
:edge-auth := (dino-netrc-basic-auth-header "api.enterprise.apigee.com")
:mgmtserver = https://api.enterprise.apigee.com
GET :mgmtserver/v1/o/deecee/apis/parity-test99/revisions
Authorization: :edge-auth
// TestWebRequest.cs
// ------------------------------------------------------------------
//
// Author: Dino
// initialized on: Fri Feb 26 17:00:17 2016
//
// last saved: <2016-February-26 17:19:13>
// ------------------------------------------------------------------
//
// Copyright © 2016 Dino Chiesa
#!/bin/bash
# -*- mode:shell-script; coding:utf-8; -*-
#
# findApiKey.sh
#
# A bash script for finding a particular API Key in an Apigee Edge organization.
#
# Last saved: <2016-February-05 17:30:50>
#
@DinoChiesa
DinoChiesa / .htaccess
Created January 29, 2016 21:09
to force a server to load SSL endpoint
RewriteCond %{SERVER_PORT} !=443
RewriteRule .* https://%{HTTP_HOST}/$1 [R=301,L]
@DinoChiesa
DinoChiesa / add-to-your-theme-header.php
Created January 29, 2016 21:07
Use PHP code to force Wordpress to redirect to a secure site
/*
* 2016 Jan 29
*
* For redirecting to SSL site, from within PHP.
*
* This is useful if:
* - Your site is running behind a load-balancer, which
* means you cannot directly infer HTTPS, AND
* - you don't have the ability to modify
* .htaccess on your hosted site.
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew update
$ brew install openssl
$ which openssl
/usr/bin/openssl
$ openssl version
OpenSSL 0.9.8zg 14 July 2015
$ /usr/local/Cellar/openssl/1.0.2e_1/bin/openssl version
OpenSSL 1.0.2e 3 Dec 2015
@DinoChiesa
DinoChiesa / httpsig-in-postman-pre-request-script.js
Created January 26, 2016 23:18
pre-request script for Postman, to perform HttpSignature calculation. Also SHA-256 message digest.
function computeHttpSignature(config, headerHash) {
var template = 'keyId="${keyId}",algorithm="${algorithm}",headers="${headers}",signature="${signature}"',
sig = template;
// compute sig here
var signingBase = '';
config.headers.forEach(function(h){
if (signingBase !== '') { signingBase += '\n'; }
signingBase += h.toLowerCase() + ": " + headerHash[h];
});