View remove-stale-containers.py
#!/usr/bin/env python
## If you see messages like this on your kubelet journal:
##
## Mar 25 22:36:44 ip-10-0-3-67.ec2.internal dockerd-current[28612]: time="2018-03-25T22:36:44.419126265Z" level=error msg="Handler for GET /v1.24/containers/60532fa8184bdf41e52788194faa1253f1168e3ad4f54f7c159192fe66c4bb1d/json returned error: No such container: 60532fa8184bdf41e52788194faa1253f1168e3ad4f54f7c159192fe66c4bb1d"
##
## use this script to remove dockershim container files from /var/lib/dockershim/sandbox
import os, glob, subprocess
View migrate-pv-to-zone.sh
#!/bin/bash
set -eu
NAMESPACE=$1
PVCNAME=$2
TARGETZONE=$3
DEPLOYMENTOBJ=$4
PVNAME=$(oc -n $NAMESPACE get pvc $PVCNAME --template={{.spec.volumeName}})
VOLUMEID=$(oc -n $NAMESPACE get pv $PVNAME --template={{.spec.awsElasticBlockStore.volumeID}} | cut -d/ -f 4)
View keybase.md

Keybase proof

I hereby claim:

  • I am caruccio on github.
  • I am caruccio (https://keybase.io/caruccio) on keybase.
  • I have a public key ASD6Us-tApW2y3pqe9q7ruqypYAF289oNQQXUWVX5fcE0go

To claim this, I am signing this object:

View underlinize.md

Check ou this trick to convert any text into a sequence of chars of the same length

$ MESSAGE="Some arbitrary message to convert into dashes"
$ echo "$MESSAGE" | tr "$MESSAGE" -

I like to use it to "underlinize" titles on my scripts

View mariadb-galera-persistent-template.yml
# Source: https://github.com/getupcloud/openshift-mariadb-galera/blob/master/mariadb-galera-persistent-template.yml
---
kind: Template
apiVersion: v1
metadata:
name: mariadb-galera-persistent
annotations:
description: MariaDB Galera cluster persistent (NFS)
iconClass: icon-mariadb
tags: database,mysql,replication,mariadb,galera,nfs
View Dockerfile
FROM openshift/base-centos7
# This image provides an Apache+PHP environment for running PHP
# applications.
MAINTAINER Mateus Caruccio <mateus.caruccio@getupcloud.com>
EXPOSE 8080
ENV PHP_VERSION=7.0
View defparamval.py
# Instead of defining a global to use inside your function, just define it as a default
# value of the function, specially if the value can cost some significant time
regex = re.compile('[^0-9]') # globals are evil (are they?)
def clean_zip(string):
return regex.sub('', string)
# This way we execute re.compile a single time AND have the advantage to overwrite it when necessary
def clean_zip(string, regex=re.compile('[^0-9]')):
View infinite-stream-post.py
from contextlib import contextmanager
import requests
import io
import sys
import time
class Streamer(io.TextIOBase):
def readline(self, limit=-1):
time.sleep(0.5)
return '.' * (1024 if limit <= 0 else limit) + "\n"
View assemble
#!/bin/bash
# Salve este arquivo em seu repositorio, no caminho ".s2i/bin/assemble"
if [ "$STI_SCRIPTS_PATH/assemble" ]; then
source $STI_SCRIPTS_PATH/assemble
fi
# Faça o que voce precisa aqui...
View getupcloud-signup-form.html
<script type='text/javascript' src='https://code.jquery.com/jquery-3.1.0.min.js'></script>
<script type='text/javascript'>
$(document).ready(function ()
{
$('#show-password').change(function() {
$('#password').prop('type', this.checked ? 'text' : 'password')
})
$('#signup-form').submit(function(event) {