Skip to content

Instantly share code, notes, and snippets.

@toddlers
toddlers / jenkins_backup.sh
Created January 14, 2015 07:38
Jenkins_Bacup via jenkins
# Delete all files in the workspace
rm -rf *
# Create a directory for the job definitions
mkdir -p $BUILD_ID/jobs
# Copy global configuration files into the workspace
cp $JENKINS_HOME/*.xml $BUILD_ID/
# Copy keys and secrets into the workspace
cp $JENKINS_HOME/identity.key.enc $BUILD_ID/
@toddlers
toddlers / cfn.yml
Last active April 14, 2024 07:26
aws api gateway with step function execution
AWSTemplateFormatVersion: 2010-09-09
Description: My API Gateway and Lambda function
Parameters:
apiGatewayName:
Type: String
Default: my-api
apiGatewayStageName:
Type: String
AllowedPattern: "[a-z0-9]+"
@toddlers
toddlers / Dockerfile
Created July 27, 2016 11:24
using envsubst in Dockerfile
FROM ubuntu:trusty
RUN \
apt-get update \
&& apt-get -y install gettext-base \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
ENV VALUE=foo
ENV VALUE1=boo
COPY config.txt source_config.txt
@toddlers
toddlers / cargo.toml
Last active February 15, 2024 17:44
s3 presigned urls
[package]
name = "s3_presign"
version = "0.1.0"
edition = "2021"
# Starting in Rust 1.62 you can use `cargo add` to add dependencies
# to your project.
#
# If you're using an older Rust version,
# download cargo-edit(https://github.com/killercup/cargo-edit#installation)
@toddlers
toddlers / .gitignore
Created January 2, 2024 17:20 — forked from nicosingh/.gitignore
ECS using Terraform sample
*.tfbackup
.terraform/
*.tfstate
.terraform.tfstate.lock.info
@toddlers
toddlers / apigateway-invoke.py
Created September 3, 2021 09:37 — forked from Riebart/apigateway-invoke.py
Python script to invoke an AWS API Gateway endpoint that requires IAM authentication. Uses boto for signing the request, and requests for issuing it.
#!/usr/bin/env python3
"""
Provides a simple Python wrapper for invoking an API Gateway endpoint using IAM signed requests.
Example:
python3 apigateway-invoke.py GET \
https://xxxxxxxxxx.execute-api.us-east-1.amazonaws.com/default/MethodName | jq .
"""
try:
@toddlers
toddlers / cobra-klog.go
Created December 28, 2019 13:10
klog-with-cobra
package main
import (
"flag"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"k8s.io/klog"
)
@toddlers
toddlers / dexec.sh
Created June 27, 2023 17:03 — forked from papes1ns/dexec.sh
dexec.sh
#!/usr/bin/env bash
set -eu # do not proceed on error
if [ $# -lt 1 ] || [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
cat <<EOF
Quick command to get a shell inside a running docker container.
Usage: dexec [container_name] [command]
@toddlers
toddlers / fileinfo.go
Created January 25, 2017 13:08
getting fileinfo in go
package main
import (
"fmt"
"os"
)
func main() {
// can handle symbolic link, but will no follow the link
@toddlers
toddlers / haproxy.conf
Last active March 6, 2023 10:02
haproxy config with directives explained
global
log 127.0.0.1 local1 info info
user haproxy
group haproxy
daemon
#quiet
#debug
stats socket /var/run/haproxy/haproxy.sock mode 0600 level admin
defaults