Skip to content

Instantly share code, notes, and snippets.

Avatar

Cameron Moreau cameronmoreau

View GitHub Profile
@cameronmoreau
cameronmoreau / android_generate_key_hash
Last active August 29, 2015 14:14
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,
@cameronmoreau
cameronmoreau / baddassprogram.cpp
Created April 29, 2015 02:11
Coty's CPP Program
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 */
#include<iostream>
#include<new>
using namespace std;
@cameronmoreau
cameronmoreau / gist:72d596d96ebc2ec674e4
Created June 6, 2015 19:06
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
cameronmoreau / # gcc - 2017-01-31_12-24-04.txt
Created January 31, 2017 23:59
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
cameronmoreau / nginxproxy.md
Created March 10, 2017 20:29 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?
View nginxproxy.md

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 example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

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

@cameronmoreau
cameronmoreau / imageResizeUtil.js
Created April 13, 2017 05:38
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
cameronmoreau / istio -> envoy.yaml
Created October 31, 2018 19:25
This is a subset of the final envoy config for RBAC policies, showing some comparative (AND/OR) logic
View istio -> envoy.yaml
admin:
access_log_path: /tmp/admin_access.log
address:
socket_address:
protocol: TCP
address: 127.0.0.1
port_value: 9901
static_resources:
listeners:
- name: listener_0
@cameronmoreau
cameronmoreau / saml
Last active December 31, 2018 20:17
View saml
<?xml version="1.0" encoding="UTF-8"?>
<md:EntityDescriptor xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"
entityID="http://www.okta.com/k2lvtem0VAJDMINKEYJW">
<md:IDPSSODescriptor WantAuthnRequestsSigned="true"
protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
<md:KeyDescriptor use="signing">
<ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:X509Data>
<ds:X509Certificate>MIICmTCCAgKgAwIBAgIGAUPATqmEMA0GCSqGSIb3DQEBBQUAMIGPMQswCQYDVQQGEwJVUzETMBEG
A1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzENMAsGA1UECgwET2t0YTEU