Skip to content

Instantly share code, notes, and snippets.


Cameron Moreau cameronmoreau

View GitHub Profile
cameronmoreau / android_generate_key_hash
Last active Aug 29, 2015
Android Generate Key Hash
View android_generate_key_hash
public static String printKeyHash(Activity context) {
PackageInfo packageInfo;
String key = null;
try {
//getting application package name, as defined in manifest
String packageName = context.getApplicationContext().getPackageName();
//Retriving package info
packageInfo = context.getPackageManager().getPackageInfo(packageName,
View baddassprogram.cpp
/* CSCI 152 Spring 2015 - Program 6
Your Name
program will enter data into two single dimension arrays (no duplicate values in arrays)
program will find the union and intersection of the two arrays
program will display the union and intersection */
using namespace std;
cameronmoreau / gist:72d596d96ebc2ec674e4
Created Jun 6, 2015
Upload hundreds of Prase objects at once
View gist:72d596d96ebc2ec674e4
* To use this in your Prase project:
* Upload this gist as main.js in Cloud Code for Parse
* Create a PFObject from "fileTestSave"
* Store all data into a JSON Array, and attach as a PFFile
* Then run the "RemoveFiles" background job daily to get rid of
* the stored files
View memoization.c
#include <stdio.h>
#include <stdlib.h>
int max(int x, int y) {
if(x > y) return x;
return y;
int func_aux(int N, int sols[]) {
if(N <= 1) return 1;
cameronmoreau / # gcc - 2017-01-31_12-24-04.txt
Created Jan 31, 2017
gcc on macOS 10.12.2 - Homebrew build logs
View # gcc - 2017-01-31_12-24-04.txt
Homebrew build logs for gcc on macOS 10.12.2
Build date: 2017-01-31 12:24:04
cameronmoreau /
Created Mar 10, 2017 — forked from soheilhy/
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for,, and on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

cameronmoreau / imageResizeUtil.js
Created Apr 13, 2017
Resize images on the web
View imageResizeUtil.js
import Promise from 'bluebird';
export const resizeImage = (image, maxWidth, maxHeight, quality) => {
const canvas = document.createElement('canvas');
let width = image.width;
let height = image.height;
if (width > height) {
if (width > maxWidth) {
View jwkstest.json
"keys": [
"kty": "RSA",
"e": "AQAB",
"use": "sig",
"kid": "key-1",
"alg": "RS256",
"value": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3nEfiW1JPDi0FHUrNXbz\nME9E5PSir3/FIKcNdlY0dN+ObHuJTbvqJK4uwN7mGw0pQoW5VOXhBwiswVqYmMis\nPeEyWVCjburOuFHe/6zLfnwWOL9XtP+azaI4aTwKLFiwgkjxbSXLT+uEbW6Mj0a5\nnb49I28N2fJpOmwCgfNIRa4Zezu1jR7HtozCAnlTzSsme7PSuv0RkmfrI51K+zSg\nWTH6fA1+HS7BnimJfwMBHlv6qHUjEs0QU9uqaVo5OeF50zRbHP3GP5/zrcPvOVI4\nuLH/VUhVP5St1RAmoOHHG2I0/9SU46MK2yUa45cMZVHxnXqpdumCafSywR4t994d\nDwIDAQAB\n-----END PUBLIC KEY-----",
"n": "AN5xH4ltSTw4tBR1KzV28zBPROT0oq9_xSCnDXZWNHTfjmx7iU276iSuLsDe5hsNKUKFuVTl4QcIrMFamJjIrD3hMllQo27qzrhR3v-sy358Fji_V7T_ms2iOGk8CixYsIJI8W0ly0_rhG1ujI9GuZ2-PSNvDdnyaTpsAoHzSEWuGXs7tY0ex7aMwgJ5U80rJnuz0rr9EZJn6yOdSvs0oFkx-nwNfh0uwZ4piX8DAR5b-qh1IxLNEFPbqmlaOTnhedM0Wxz9xj-f863D7zlSOLix_1VIVT-UrdUQJqDhxxtiNP_UlOOjCtslGuOXDGVR8Z16qXbpgmn0ssEeLffeHQ8"
cameronmoreau / istio -> envoy.yaml
Created Oct 31, 2018
This is a subset of the final envoy config for RBAC policies, showing some comparative (AND/OR) logic
View istio -> envoy.yaml
access_log_path: /tmp/admin_access.log
protocol: TCP
port_value: 9901
- name: listener_0
View saml
<?xml version="1.0" encoding="UTF-8"?>
<md:EntityDescriptor xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"
<md:IDPSSODescriptor WantAuthnRequestsSigned="true"
<md:KeyDescriptor use="signing">
<ds:KeyInfo xmlns:ds="">