Skip to content

Instantly share code, notes, and snippets.

View maiconbaumx's full-sized avatar

Maicon Baum maiconbaumx

  • Sicredi
  • Porto Alegre
View GitHub Profile
@weavenet
weavenet / delete_all_object_versions.sh
Created May 4, 2015 05:21
Delete all versions 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'`
markers=`aws s3api list-object-versions --bucket $bucket |jq '.DeleteMarkers'`
@thomasdarimont
thomasdarimont / readme.MD
Last active February 5, 2024 02:05
Example for using jemalloc to analyze memory allocation profile of a Java Application

Install Graphviz

sudo apt-get install graphviz

#Clone jemalloc git clone https://github.com/jemalloc/jemalloc

Configurie jemalloc with profiling enabled

./configure --enable-prof --enable-stats --enable-debug --enable-fill make make install

@johnrc
johnrc / jupyterhub-install.sh
Last active May 27, 2020 00:39
JupyterHub setup on centos
#!/bin/sh
curl -O http://repo.continuum.io/archive/Anaconda3-4.0.0-Linux-x86_64.sh
chmod u+x Anaconda3-4.0.0-Linux-x86_64.sh
./Anaconda3-4.0.0-Linux-x86_64.sh -b -p /opt/anaconda3
export PATH=/opt/anaconda3/bin:$PATH
curl --silent --location https://rpm.nodesource.com/setup_4.x | bash -
yum install nodejs -y
npm install -g configurable-http-proxy
pip install jupyterhub
@hermes-pimentel
hermes-pimentel / elb-cf-logs-parser.sh
Last active December 27, 2017 12:59
ELB/CF Parser
#download files from bucket
#group logs
cat *.log >> single.txt && mv single.txt single.log
#IPS GET
cat single.log| grep -v POST | awk '{print $3}' | cut -d : -f 1 | sort | uniq -c | sort -nr
#IPS POST
cat single.log| grep -v GET | awk '{print $3}' | cut -d : -f 1 | sort | uniq -c | sort -nr
@hermes-pimentel
hermes-pimentel / NAT-HA.sh
Last active August 3, 2016 16:01
NAT HA with only one machine. (ASG)
#!/bin/sh
#1) Create your private subnet, SGs, and etc... and get the route table ID from privates subnets that need a NAT instance / allocate a new Elastic IP and get the ID.
#2) create a launch configuration with the script bellow (dont use user-data text, upload a file with '.sh' extension)
# use the this policy in AMI role:
#ec2-role-policy
# {
# "Version": "2012-10-17",
# "Statement": [
# {
@hermes-pimentel
hermes-pimentel / tag-ebs.py
Last active October 14, 2022 07:52
Copy tags from EC2 to EBS
# set variable AWS_PROFILE= to credentials
import boto3
# CHANGE REGION HERE-
ec2 = boto3.resource('ec2', 'sa-east-1')
#check your own tags before run this script
#loop for tag Name
def tag_name():
print "Loop for TAG Name"
for volume in ec2.volumes.all():
@yegorg
yegorg / sysctl.conf
Created September 20, 2016 09:28
ubuntu sysctl performance tuning
# Kernel sysctl configuration file for Linux
#
# Version 1.12 - 2015-09-30
# Michiel Klaver - IT Professional
# http://klaver.it/linux/ for the latest version - http://klaver.it/bsd/ for a BSD variant
#
# This file should be saved as /etc/sysctl.conf and can be activated using the command:
# sysctl -e -p /etc/sysctl.conf
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and sysctl.conf(5) for more details.
@lukeplausin
lukeplausin / bash_aws_jq_cheatsheet.sh
Last active July 15, 2024 09:10
AWS, JQ and bash command cheat sheet. How to query, cut and munge things in JSON generally.
# Count total EBS based storage in AWS
aws ec2 describe-volumes | jq "[.Volumes[].Size] | add"
# Count total EBS storage with a tag filter
aws ec2 describe-volumes --filters "Name=tag:Name,Values=CloudEndure Volume qjenc" | jq "[.Volumes[].Size] | add"
# Describe instances concisely
aws ec2 describe-instances | jq '[.Reservations | .[] | .Instances | .[] | {InstanceId: .InstanceId, State: .State, SubnetId: .SubnetId, VpcId: .VpcId, Name: (.Tags[]|select(.Key=="Name")|.Value)}]'
# Wait until $instance_id is running and then immediately stop it again
aws ec2 wait instance-running --instance-id $instance_id && aws ec2 stop-instances --instance-id $instance_id
# Get 10th instance in the account
@bojand
bojand / index.md
Last active July 15, 2024 02:51
gRPC and Load Balancing

Just documenting docs, articles, and discussion related to gRPC and load balancing.

https://github.com/grpc/grpc/blob/master/doc/load-balancing.md

Seems gRPC prefers thin client-side load balancing where a client gets a list of connected clients and a load balancing policy from a "load balancer" and then performs client-side load balancing based on the information. However, this could be useful for traditional load banaling approaches in clound deployments.

https://groups.google.com/forum/#!topic/grpc-io/8s7UHY_Q1po

gRPC "works" in AWS. That is, you can run gRPC services on EC2 nodes and have them connect to other nodes, and everything is fine. If you are using AWS for easy access to hardware then all is fine. What doesn't work is ELB (aka CLB), and ALBs. Neither of these support HTTP/2 (h2c) in a way that gRPC needs.

@lestephane
lestephane / Dockerfile
Created September 10, 2017 19:35
Dockerized terraform bundler
FROM golang:alpine
RUN apk update && apk upgrade && \
apk add --no-cache git zip
ARG TERRAFORM_VERSION
RUN git clone --single-branch --branch v${TERRAFORM_VERSION} https://github.com/hashicorp/terraform.git /go/src/github.com/hashicorp/terraform
RUN cd $GOPATH/src/github.com/hashicorp/terraform && echo $GOPATH && go install ./tools/terraform-bundle