Skip to content

Instantly share code, notes, and snippets.

@outofcoffee
outofcoffee / find-ecr-image.sh
Last active March 1, 2024 13:35
Check if Docker image exists with tag in AWS ECR
#!/usr/bin/env bash
# Example:
# ./find-ecr-image.sh foo/bar mytag
if [[ $# -lt 2 ]]; then
echo "Usage: $( basename $0 ) <repository-name> <image-tag>"
exit 1
fi
IMAGE_META="$( aws ecr describe-images --repository-name=$1 --image-ids=imageTag=$2 2> /dev/null )"
@enricofoltran
enricofoltran / main.go
Last active April 6, 2025 09:48
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@mrrooijen
mrrooijen / database.sslmode.require.yml
Last active February 6, 2024 21:33
SSL configurations for Rails + Postgres in either require or verify-full mode to ensure secure connections. Useful for Amazon RDS, Compose.io, etc.
production:
adapter: postgresql
encoding: unicode
sslmode: require
url: postgres://user:password@host:port/db
@chrismdp
chrismdp / s3.sh
Last active January 23, 2025 09:26
Uploading to S3 in 18 lines of Shell (used to upload builds for http://soltrader.net)
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (http://soltrader.net)
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
{
path=$1
@rafrombrc
rafrombrc / http_req_stat_filter.lua
Last active August 29, 2015 14:18
Sample Heka SandboxFilter emitting graphite format stats from HTTP request data
require "string"
require "math"
require "table"
require "cjson"
local status_codes = {}
local request_times = {}
local ticker_interval = read_config("ticker_interval") or error("must provide ticker_interval")
local percent_thresh = read_config("percent_threshold") or 90
@dysinger
dysinger / aws-cfn-coreos-kubernetes.json
Last active December 6, 2024 10:55
CoreOS Kubernetes on AWS CloudFormation
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "CoreOS on EC2: http://coreos.com/docs/running-coreos/cloud-providers/ec2/",
"Mappings": {
"RegionMap": {
"ap-northeast-1": {
"AMI": "ami-f9b08ff8"
},
"ap-southeast-1": {
"AMI": "ami-c24f6c90"
@rafrombrc
rafrombrc / message_types.md
Last active October 26, 2016 20:14
Heka internal message types
  • heka.counter-output: Generated by CounterFilter. Usually picked up by a LogOutput for writing to stdout.

  • heka.plugin-report: Used inside the reporting infrastructure for plugins to provide report data to the dashboard, typically not injected into the router at all.

  • heka.input-report: Used inside the reporting infrastructure for the input recycle chan to provide report data to the dashboard, typically not injected into the router at all.

  • heka.inject-report: Used inside the reporting infrastructure for the inject recycle chan to provide report data to the dashboard, typically not injected into the router at all.

  • heka.router-report: Used inside the reporting infrastructure for the router to provide report data to the dashboard, typically not injected into the router at all.

@rafrombrc
rafrombrc / statsd_graph
Created July 16, 2014 22:54
Sample Lua code for graphing statsd data
require("circular_buffer")
require("string")
require("cjson")
local idx_num
local stat_value
local debug
-- # rows, # cols, # seconds per row
cbuf = circular_buffer.new(300, 1, 1)
@altryne
altryne / Readme.md
Created May 7, 2014 17:46
Hubot Slack webhook

#A script to post back to Slack via the webhooks API

##why this exists?

Slack's own hubot adapter needs the hubot installation to be accessible via web. This can be problematic in some cases, as a security risk.

This hack let's you run your Hubot behind a firewall, and connect to Slack via the IRC gateway.

To respond, Hubot uses the incoming webhooks end-point of Slack.

@jkreps
jkreps / benchmark-commands.txt
Last active March 8, 2025 12:25
Kafka Benchmark Commands
Producer
Setup
bin/kafka-topics.sh --zookeeper esv4-hcl197.grid.linkedin.com:2181 --create --topic test-rep-one --partitions 6 --replication-factor 1
bin/kafka-topics.sh --zookeeper esv4-hcl197.grid.linkedin.com:2181 --create --topic test --partitions 6 --replication-factor 3
Single thread, no replication
bin/kafka-run-class.sh org.apache.kafka.clients.tools.ProducerPerformance test7 50000000 100 -1 acks=1 bootstrap.servers=esv4-hcl198.grid.linkedin.com:9092 buffer.memory=67108864 batch.size=8196