Skip to content

Instantly share code, notes, and snippets.

View rberrelleza's full-sized avatar
👋
Hi friend!

Ramiro Berrelleza rberrelleza

👋
Hi friend!
View GitHub Profile
@rberrelleza
rberrelleza / local-path-storage.yaml
Last active October 12, 2019 23:10
Configure k3s to use local path storage by default
apiVersion: v1
kind: Namespace
metadata:
name: local-path-storage
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: local-path-provisioner-service-account
namespace: local-path-storage
@rberrelleza
rberrelleza / helm+cnd.md
Last active December 4, 2018 21:32
Helm development
  1. Set the context of kubectl with your dev cluster and your namespace. (e.g. kubectl config use-context gke_development-123_europe-west4-c_europe --namespace=ramiro)
  2. Update to the lastest cnd version: go get github.com/okteto/cnd
  3. Install syncthing
  4. Export your deployment manifest: kubectl get --export deployment "$YOUR_DEPLOYMENT" -oyaml > deployment.yml
  5. Create a cnd.yml file:
swap:
  deployment:
    file: deployment.yml
 container: api 
@rberrelleza
rberrelleza / lauch_ami.sh
Created December 6, 2017 18:18
script to launch an AMI
#!/bin/bash
output=$(aws ec2 run-instances --image-id $1 --instance-type m3.large --key-name YOUR_KEY --security-group-ids YOUR_SG --subnet-id YOUR_SUBNET --associate-public-ip-address --block-device-mapping '[{"DeviceName": "/dev/sda1","Ebs":{"VolumeSize":60}}]')
instance=$(echo $output | grep -o '\"InstanceId\": "i-........\"' | grep -o i-........ )
tag=$(whoami)-$(date +"%Y-%m-%d_%H-%M-%S")
sleep 5
aws ec2 create-tags --resources $instance --tags Key=Name,Value=$tag
echo $instance%
@rberrelleza
rberrelleza / rewrite_author.sh
Created December 6, 2017 18:16
Rewrite a git commiter's email and name
#!/bin/sh
git filter-branch -f --env-filter '
OLD_EMAIL=$1
CORRECT_NAME=$2
CORRECT_EMAIL=$3
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
@rberrelleza
rberrelleza / gitappend.sh
Created March 7, 2017 23:40
Append to last commit with the same message
git --global config.ap '!message=$(git log -1 --pretty=%B) && git commit -m "$message" --amend'
@rberrelleza
rberrelleza / junit-sort.py
Created September 14, 2016 22:53
Sort junit test files by the provided attribute
import argparse
import sys
import xml.etree.ElementTree as ET
def getChildValue(val):
try:
return float(val)
except:
return val

Keybase proof

I hereby claim:

  • I am rberrelleza on github.
  • I am rberrelleza (https://keybase.io/rberrelleza) on keybase.
  • I have a public key whose fingerprint is 526A 22E3 E3D3 A322 73FD BDA9 3B16 AAED 6189 E49E

To claim this, I am signing this object:

import base64
import requests
import urllib
apikey=urllib.unquote("YOUR_KEY")
apisecret=urllib.unquote("YOUR_API_SECRET")
bearer_creds="{}:{}".format(apikey, apisecret)
base64encoded_creds = base64.b64encode(bearer_creds)
twitter_api_url="https://api.twitter.com/oauth2/token"
@rberrelleza
rberrelleza / packer-kill-orphans.sh
Created November 11, 2015 01:44 — forked from aaronzirbes/packer-kill-orphans.sh
Delete orphaned artifacts left by packer.io
#!/bin/bash
set -e
# Keypairs
echo "Finding Key Pairs..."
KEY_PAIRS_JSON=`aws ec2 describe-key-pairs --filters 'Name=key-name,Values=packer*'`
KEY_PAIRS=`echo "${KEY_PAIRS_JSON}" | grep 'KeyName' |sed -e 's/.*"KeyName": "//' -e 's/",* *$//'`
# Security Groups
@rberrelleza
rberrelleza / eml.pl
Created April 30, 2015 00:14
Display a eml file on the console
perl -MMIME::Base64 -ne 'print decode_base64($_)' < YOUR_FILE.eml