Skip to content

Instantly share code, notes, and snippets.

@TurekBot
TurekBot / build.gradle
Created January 10, 2018 17:46
Gradle Shadow Example
group 'com.github.yourusername'
version '1.0-SNAPSHOT'
//These are dependencies that have to do with just the build. See: https://stackoverflow.com/a/23627293/5432315
buildscript {
repositories {
jcenter()
}
dependencies {
//This is necessary to use the gradle shadow plugin
@Ninir
Ninir / aws-api-gw-lambda-post-root-resource.md
Created August 4, 2016 16:37
Create an AWS API Gateway with a POST method on the root resource targetting a given Lambda

Description

This helps creating an AWS API GW with a POST method on the root resource (i.e /) targetting a given Lambda.

The current Terraform documentation is exposing a Mock integration. Thus, a few options are missing when wanting to expose a Lambda integration instead.

There are a few things to know:

1. Add the integration HTTP Method

First of all, you will need to add the integration_http_method alongside the http_method, as in:

@keeth
keeth / api.tf
Last active January 13, 2021 14:34
Apex + Terraform + AWS Lambda + API Gateway + JSON Encoded Errors + CORS
resource "aws_api_gateway_rest_api" "myApi" {
name = "myApi-${var.env}"
description = "My awesome API (${var.env} environment)"
}
resource "aws_api_gateway_deployment" "myApi" {
depends_on = [
"aws_api_gateway_integration.myApi_myEndpoint_post",
"aws_api_gateway_integration_response.myApi_myEndpoint_post",
"aws_api_gateway_integration_response.myApi_myEndpoint_post_400",
@geeknam
geeknam / cognitoupload.py
Created April 2, 2017 07:13
Upload file to S3 with an authenticated Cognito User
import boto3
import uuid
class CognitoUserFileUploader(object):
def __init__(self, *args, **kwargs):
self.__dict__.update(kwargs)
self.id_token = self.get_cognito_id_token(
self.username, self.refresh_token,
self.device_key, self.client_id
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
@krets
krets / slack_leave_bd_channels.py
Last active July 15, 2022 17:39
Quick script to leave a bunch of slack channels with the "bd-" prefix.
#!/usr/bin/env python
import argparse
import requests
import logging
LOG = logging.getLogger("slack_leaver")
class JSONRest(object):
def __init__(self, base_url):
@jives
jives / wow.ahk
Last active October 15, 2022 13:07
Anti AFK AHK script for WoW
;
; Ade's Anti AFK AHK script for WoW
;
;
; How to use this script
;
; Make sure WoW is running
; Start this script by right clicking on it and selecting "Run Script"
; Press Shift+Ctrl+F9 to activate the script
@mpj
mpj / watcher.rb
Last active January 26, 2023 01:05
Keep directory in sync with remote server using Rsync and FSEvent.
#!/usr/bin/env ruby
require 'rubygems'
require 'rb-fsevent'
require 'ruby-growl'
def sync(local, host, remote, growl)
# Construct the bash command that runs rsync.
@ErikSwan
ErikSwan / The American Inferno.md
Last active March 17, 2023 03:21
Text of "The American Inferno", a book by (fictional) author Evelyn Miller in the game Red Dead Redemption 2. Actual author unknown.

The American Inferno

Chapter II

In the end, what has a man but his thoughts? I would postulate further, what has a man to stand for, but his thoughts? His actions, perhaps? I know precious little of actions. Lions, donkeys, hyenas. They all act. So is that what we are? No. We are more and less than the beasts. We are thoughts. We are actions and the reflections upon those actions. Yet, we are also not merely reflections. We are not mirrors.

That is the preserve of spirits, of the gods. We are actions and the thoughts upon actions. Neither one nor other. We are free neither from action, nor from thought. Our humanity can only be understood if we embrace both the animal and the god within us. As humans, we must nourish both, yet America is a land of action. A place fixated not on ideas, not on the redemptive power of thought but on the obliteration of the intellect.

It is a place wherein mankind has attempted to deny half of his being, and in pursuing freedom has attempted to split himself. Much like the

@jonbartels
jonbartels / mirth-cert-report.sql
Last active January 3, 2024 14:25
Report on SSL Certificate Usage in Mirth Connect
with channel_xml as (
select
name,
xmlparse(document channel) as channel_xml
from channel c
)
, destination_connector_xml as (
SELECT
name as channel_name,
unnest(xpath('//destinationConnectors/connector/name/text()', channel_xml))::TEXT as connector_name,