Skip to content

Instantly share code, notes, and snippets.

@mikepatrick
mikepatrick / sig4-java1.java
Created December 10, 2017 17:47
sig4-java
package com.cds.boot.Demo2.controllers;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
import hmac, hashlib
#http://docs.aws.amazon.com/general/latest/gr//sigv4-calculate-signature.html
DateKey = hmac.new(b'AWS4wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY', b'20150830', hashlib.sha256).digest()
print("kdate: " + hmac.new(b'AWS4wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY', b'20150830', hashlib.sha256).hexdigest())
DateRegionKey = hmac.new(DateKey, b'us-east-1', hashlib.sha256).digest()
print("kRegion: " + hmac.new(DateKey, b'us-east-1', hashlib.sha256).hexdigest())
DateRegionServiceKey = hmac.new(DateRegionKey, b'iam', hashlib.sha256).digest()
import hmac, hashlib
#http://docs.aws.amazon.com/general/latest/gr/signature-v4-examples.html#signature-v4-examples-python
DateKey = hmac.new(b'AWS4wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY', b'20120215', hashlib.sha256).digest()
print("kdate: " + hmac.new(b'AWS4wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY', b'20120215', hashlib.sha256).hexdigest())
DateRegionKey = hmac.new(DateKey, b'us-east-1', hashlib.sha256).digest()
print("kRegion: " + hmac.new(DateKey, b'us-east-1', hashlib.sha256).hexdigest())
DateRegionServiceKey = hmac.new(DateRegionKey, b'iam', hashlib.sha256).digest()
@mikepatrick
mikepatrick / dummy_interface_with_code_typescript.ts
Created November 16, 2017 03:47
.ts file containing interface and code.
interface DummyContent {
name: string;
age?: number;
}
class DummyClass {
printMessage = () => {
console.log("message");
}
}
@mikepatrick
mikepatrick / dummy_interface_typescript.ts
Created November 16, 2017 03:46
.ts file containing only an interface. Compiles to an empty string.
interface DummyContent {
name: string;
age?: number;
}