Skip to content

Instantly share code, notes, and snippets.

View pecigonzalo's full-sized avatar
🌊

Gonzalo Peci pecigonzalo

🌊
View GitHub Profile
@pecigonzalo
pecigonzalo / memory.conf
Created July 27, 2020 19:30
Linux running
# Required by intensive applications like ElasticSeach
vm.max_map_count=262144
vm.swappiness = 10
vm.dirty_ratio = 80
vm.dirty_background_ratio = 5
vm.dirty_expire_centisecs = 12000
FROM ubuntu:bionic
LABEL version="0.1"
LABEL description="A simple PHP 7.2 Server"
# RUN apk update \
# && apk -y --no-install-recommends install php-memcached php7.3-mysql php-xdebug php7.3-gd \
# && apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
ENV TERM=linux
@pecigonzalo
pecigonzalo / delete_all_object_versions.sh
Last active July 25, 2022 21:12 — forked from weavenet/delete_all_object_versions.sh
Delete all versions (except latest) of all files in s3 versioned bucket using AWS CLI and jq.
#!/bin/bash
bucket=$1
set -e
echo "Removing all versions from $bucket"
versions=`aws s3api list-object-versions --bucket $bucket |jq '.Versions | .[] | select(.IsLatest | not)'`
markers=`aws s3api list-object-versions --bucket $bucket |jq '.DeleteMarkers'`
@pecigonzalo
pecigonzalo / mbox2gg.py
Last active November 21, 2023 11:11 — forked from jacksonj04/mbox2gg.pl
mbox to Google Groups
#! /usr/bin/env python
# Import a mbox file to a Google Group using https://developers.google.com/admin-sdk/groups-migration/index
# You'll need to install https://developers.google.com/api-client-library/python/
# and enable Groups Migration API, read prerequisits of the API SDK
from __future__ import print_function
import mailbox
import StringIO
@pecigonzalo
pecigonzalo / ECSDynamicHostPort.go
Created August 10, 2017 16:05 — forked from IngmarStein/ECSDynamicHostPort.go
Get dynamically mapped host port from within ECS container
package main
import (
"encoding/json"
"io/ioutil"
"log"
"net/http"
"os"
"bufio"
@pecigonzalo
pecigonzalo / sns_example.json
Created June 12, 2017 14:33
Example SNS event
{
"Records": [
{
"EventSource": "aws:sns",
"EventVersion": "1.0",
"EventSubscriptionArn": "arn:aws:sns:us-east-1:123456789123:AutoScalingNotifications:00000000-0000-0000-0000-000000000000",
"Sns": {
"Type": "Notification",
"MessageId": "00000000-0000-0000-0000-000000000000",
"TopicArn": "arn:aws:sns:us-east-1:123456789:AutoScalingNotifications",
@pecigonzalo
pecigonzalo / docker-dind-swarm-cluster.sh
Created June 9, 2017 17:32
Docker in Docker (dind) swarm creation script
#!/bin/bash
# set -x
MANAGER=${1:-3}
WORKER=${2:-0}
#=========================
# Creating cluster members
#=========================
@pecigonzalo
pecigonzalo / ecs-run
Created April 28, 2017 10:59 — forked from vcastellm/ecs-run
Run task and wait for result in AWS ECS
#!/usr/bin/env bash
set -e
function usage() {
set -e
cat <<EOM
##### ecs-run #####
Simple script for running tasks on Amazon Elastic Container Service
One of the following is required:
Required arguments:
@pecigonzalo
pecigonzalo / bastion
Last active November 13, 2019 18:02
SSH bastion lookup
#!/usr/bin/env bash
set -e # exit on command errors
set -o nounset # abort on unbound variable
set -o pipefail # capture fail exit codes in piped commands
# set -x
# Config:
# ~/.ssh/config
# Host i-*
@pecigonzalo
pecigonzalo / jessie-base.preseed
Created April 21, 2017 11:49 — forked from pgaskin/jessie-base.preseed
A preseed file for a minimal Debian Jessie installation
# How to run
# In the folder with these files
# sudo python -m SimpleHTTPServer 80
#
# Update the ip at the bottom of this file to the output of
# hostname -I
# This is your ip
#
# Start debian cd
# Press esc on menu