Skip to content

Instantly share code, notes, and snippets.

View meshuga's full-sized avatar

Patryk Orwat meshuga

View GitHub Profile
INSERT INTO authors (
name, bio
) VALUES (
$1, $2
)
RETURNING *;
@meshuga
meshuga / Makefile
Last active September 10, 2022 16:47
install_tools:
go install github.com/swaggo/swag/cmd/swag@latest
go install golang.org/x/tools/cmd/stringer
go install github.com/vektra/mockery/v2@latest
go install github.com/kyleconroy/sqlc/cmd/sqlc@latest
generate:
go generate ./...
test:
package internal
//go:generate mockery --all --keeptree
type UserStatus int
const (
Unverified UserStatus = iota
Verified
Suspended
)
@meshuga
meshuga / list.txt
Created June 10, 2020 16:12 — forked from shortjared/list.txt
List of AWS Service Principals
a4b.amazonaws.com
acm-pca.amazonaws.com
acm.amazonaws.com
alexa-appkit.amazon.com
alexa-connectedhome.amazon.com
amazonmq.amazonaws.com
apigateway.amazonaws.com
application-autoscaling.amazonaws.com
appstream.application-autoscaling.amazonaws.com
appsync.amazonaws.com
@meshuga
meshuga / assume_role.sh
Created May 20, 2020 08:06
Assume a role with MFA in bash and export session to environmental variables
PROFILE=test
echo "Please, provide MFA code:"
read MFA_CODE
ASSUMED_ROLE=$(aws sts assume-role --role-arn="$(aws configure get role_arn --profile $PROFILE)" --role-session-name=session --token-code=$MFA_CODE --serial-number="$(aws configure get mfa_serial --profile $PROFILE)" --output text)
ASSUMED_ROLE_ARRAY=( $ASSUMED_ROLE )
if [ -z "$ASSUMED_ROLE_ARRAY" ]
then
provider "aws" {
region = "ap-southeast-1"
}
resource "aws_iam_role" "ec2_role" {
name = "ec2-role"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
@meshuga
meshuga / MongoProvisioningConfiguration.java
Last active February 10, 2016 11:40
Embedded mongo + mongobee
package mongoTest
import com.github.mongobee.Mongobee;
import com.mongodb.Mongo;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.mongo.MongoProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@meshuga
meshuga / HttpClientResponseFreeze.java
Created November 24, 2015 11:20
HttpClientResponse freeze
package eu.ydp.esa.tts.controller.impl;
import com.github.tomakehurst.wiremock.junit.WireMockRule;
import io.vertx.rxjava.core.Vertx;
import io.vertx.rxjava.core.http.HttpClientRequest;
import io.vertx.rxjava.core.http.HttpClientResponse;
import org.junit.Rule;
import org.junit.Test;
import java.util.concurrent.CountDownLatch;
import io.vertx.core.DeploymentOptions;
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;
import io.vertx.rxjava.core.Vertx;
import io.vertx.rxjava.ext.mongo.MongoService;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class MongoCommandProblemTest {