Skip to content

Instantly share code, notes, and snippets.

@zak905
zak905 / AmazonS3TestClient.java
Created June 22, 2017 08:55
lightweight version of AmzonS3Client(AWS SDK) that can be used in tests with S3Ninja
public class AmazonS3TestClient extends AmazonS3Client {
private static Log log = LogFactory.getLog(AmazonS3TestClient.class);
String testBucketName = "yourBucketName";
public AmazonS3TestClient(AWSCredentials awsCredentials, ClientConfiguration clientConfiguration) {
super(new StaticCredentialsProvider(awsCredentials), clientConfiguration);
}
@zak905
zak905 / package.json
Created November 5, 2017 20:23
Script to automatically generate service worker after a GWT build and before packaging the app.
{
"name": "gwt-pwa",
"version": "0.0.1",
"description": "generates service worker for GWT app",
"main": "serviceWorkerBuilder.js",
"dependencies": {
"handlebars": "^4.0.11"
},
"devDependencies": {},
"scripts": {
@zak905
zak905 / compress_mozjpeg.c
Last active July 3, 2022 10:10
full example for compressing an image using MozJPEG
#include <stdio.h>
#include <jpeglib.h>
#include <stdlib.h>
#include <setjmp.h>
#include <math.h>
//based on the official example https://github.com/mozilla/mozjpeg/blob/master/example.txt
void compress_JPEG_file(char *src_file_name, char* dst_file_name, int quality) {
struct jpeg_compress_struct cinfo;
@zak905
zak905 / compress_memory.c
Created July 23, 2022 14:30
full example for compressing an image using MozJPEG: using a memory buffer
#include <stdio.h>
#include <jpeglib.h>
#include <stdlib.h>
#include <setjmp.h>
#include <math.h>
#include <string.h>
#define INPUT_BUF_SIZE 4096
struct compress_result {
@zak905
zak905 / empty.go
Created December 9, 2022 16:05
schema discussion
package empty