This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version": "2008-10-17", | |
"Statement": [ | |
{ | |
"Sid": "PublicReadGetObject", | |
"Effect": "Allow", | |
"Principal": { | |
"AWS": "*" | |
}, | |
"Action": "s3:GetObject", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
expires { | |
match .css$ 1d # expires | |
match .js$ 1d # expires | |
match .png$ 7d # expires | |
match .jpg$ 7d #expires # expires | |
match .webp$ 7d | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
go run build.go -goos=linux -goarch=amd64 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<picture> | |
<source srcset="bourbon@2x 2x" media="(max-width: 768px)"> | |
<source srcset="bourbon.webp" type="image/webp"/> | |
<img src="bourbon.png" alt="logo" width="223" height="78"> | |
</picture> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AddType image/webp .webp | |
## expires | |
<IfModule mod_expires.c> | |
# Turn on the module. | |
ExpiresActive on | |
# Set the default expiry times. | |
ExpiresDefault "access plus 2 days" | |
ExpiresByType image/jpg "access plus 1 month" | |
ExpiresByType image/gif "access plus 1 month" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yum install python26-pip | |
pip install virtualenv | |
wget https://dl.eff.org/certbot-auto | |
chmod a+x certbot-auto | |
/usr/local/bin//certbot-auto --debug -v --server https://acme-v01.api.letsencrypt.org/directory certonly -d poppin.com.au -d www.poppin.com.au |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
repoquery --list repo-name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Gets the JPEG size from the array of data passed to the function, file reference: http://www.obrador.com/essentialjpeg/headerinfo.htm | |
static char get_jpeg_size(unsigned char* data, unsigned int data_size, unsigned short *width, unsigned short *height) { | |
//Check for valid JPEG image | |
int i=0; // Keeps track of the position within the file | |
if(data[i] == 0xFF && data[i+1] == 0xD8 && data[i+2] == 0xFF && data[i+3] == 0xE0) { | |
i += 4; | |
// Check for valid JPEG header (null terminated JFIF) | |
if(data[i+2] == 'J' && data[i+3] == 'F' && data[i+4] == 'I' && data[i+5] == 'F' && data[i+6] == 0x00) { | |
//Retrieve the block length of the first block since the first block will not contain the size of file | |
unsigned short block_length = data[i] * 256 + data[i+1]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func jpegDimensions(data []byte) (int32, int32) { | |
var width, height, i int | |
data_size := cap(data) | |
if data[i] == 0xFF && data[i+1] == 0xD8 && data[i+2] == 0xFF && data[i+3] == 0xE0 { | |
i += 4 | |
if data[i+2] == 'J' && data[i+3] == 'F' && data[i+4] == 'I' && data[i+5] == 'F' && data[i+6] == 0x00 { | |
block_length := int(data[i])*256 + int(data[i+1]) | |
for i < data_size { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Read the content | |
var bodyBytes []byte | |
if c.Request.Body != nil { | |
bodyBytes, _ = ioutil.ReadAll(c.Request.Body) | |
} | |
// Restore the io.ReadCloser to its original state | |
c.Request.Body = ioutil.NopCloser(bytes.NewBuffer(bodyBytes)) | |
// Use the content |