Skip to content

Instantly share code, notes, and snippets.

View caruccio's full-sized avatar
😐
state = not in mood

Mateus Caruccio caruccio

😐
state = not in mood
View GitHub Profile
@caruccio
caruccio / rh-openshift-rest-api.txt
Last active September 20, 2017 22:33
Summary of RedHat's Openshift RESTfull API
############################################
# Summary of RedHat's Openshift RESTfull API
#
# METHOD PATH PARAMETER_NAME=[VALUE|...] <NAME=[VALUE|...]>
#
# - <...> are optional parameter.
# - VALUE* is the default.
############################################
# Domains
@caruccio
caruccio / attr-tree.md
Last active October 16, 2019 05:59
Attribute tree

Attribute tree

Based upon One-line Tree in Python, here is a tree-like class where struct is accesible by attributes rather than keys (much more readable IMHO):

from collections import defaultdict

class Tree(defaultdict):
	def __init__(self, *va, **kva):
		super(Tree, self).__init__(*va, **kva)
@caruccio
caruccio / .gitconfig
Created March 15, 2013 13:38
.gitconfig
[core]
pager = less -XF
[user]
name = Mateus Caruccio
email = mateus@caruccio.com
[color]
diff = auto
branch = auto
@caruccio
caruccio / .ssh_config
Created March 21, 2013 13:12
Reusing a shared master ssh connection across many ssh client instances (really fast login after first login).
Host my-server # Alias for this server so you can run "$ ssh my-server"
#ForwardAgent yes # Use local agent to password-free authentication
#User my_user # Name of remote user
#IdentityFile ~/.ssh/id_rsa-${MY_SERVER} # I suggest you to use key-pair auth
Hostname my.server.fqdn # Real server hostname
ControlMaster auto # share a single ssh connection across many ssh instances
ControlPersist 60 # send master connection to background, close it if idle for 60 seconds
ControlPath ~/.ssh/master/ssh-%h # place local sharing socket in a secure place
@caruccio
caruccio / getup-auth.py
Last active December 16, 2015 11:28
Gists para o blog
from hammock import Hammock as Getup
username, password = 'mateus.caruccio@getupcloud.com', 'minha_senha'
getup = Getup('https://broker.getupcloud.com/broker/rest', auth=(username, password))
@caruccio
caruccio / PS1.sh
Last active August 26, 2019 17:52
My bash PS1
# Based on code from http://andrewray.me/bash-prompt-builder/index.html
DELTA_CHAR="δ"
CONFLICT_CHAR="☓"
NOBRANCH_TEXT="no-branch"
REBASE_TEXT="✂ ʀebase"
# Colors for prompt
COLOR_RED=$(tput sgr0 && tput setaf 1)
COLOR_GREEN=$(tput sgr0 && tput setaf 2)
@caruccio
caruccio / openshift-nginx-cartridge-blog-post.md
Last active December 30, 2015 03:58
Original blog post on running Nginx PHP-FPM under OpenShift

Hosting your app using nginx: The high performance web server

Brazilian Portuguese version here.

OpenShift platform is an amazing tool when it comes to app development and deploy: auto scalable, secure by default, language agnostic and open-source. By abstracting infrastructure in a simple way, it is possible to create a full-fledged application with databases in a few minutes.

Even with all this power, sometimes we just need to serve a bunch os static files: HTML, images, javascript and CSS.

@caruccio
caruccio / install.sh
Last active January 4, 2016 10:29
Getup Cloud installer
#!/bin/bash
mesg() { echo -e "$(tput sgr0 && tput setaf 2)${*}$(tput sgr0)"; }
info() { echo -e "$(tput sgr0 && tput setaf 3)${*}$(tput sgr0)"; }
warn() { echo -e "$(tput sgr0 && tput setaf 1)${*}$(tput sgr0)"; }
echo
mesg ------------------------------
mesg "Este script instala e configura o RHC para utilizar na Getup Cloud."
warn "A senha do super usuário será solicitada em seguida."
@caruccio
caruccio / teste-reboot.yml
Last active August 29, 2015 14:02
test reboot
Name: elasticsearch
Cartridge-Short-Name: ELASTICSEARCH
Display-Name: ElasticSearch 1.1.1
Description: "ElasticSearch"
Version: 1.1.1
License: Apache
Vendor: elasticsearch.org
Cartridge-Version: 0.0.2
Cartridge-Vendor: julianandandy
Source-Url: https://github.com/caruccio/openshift-elasticsearch-cartridge/archive/master;reboot;.zip
@caruccio
caruccio / miniargs.py
Last active December 26, 2022 00:22
Really small python command line arg parser, now with parameter validation®
# -*- coding: utf-8 -*-
from __future__ import print_function
class MiniArgs(object):
__getattr__ = lambda *a, **ka: None
def __init__(self, argv, valid=None):
def normalize_name(name):
return name.lstrip('-').replace('-','').replace('+','')