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 / 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 / bash-pattern-subst
Created April 24, 2012 18:44
Pattern substitution
$ VAR='XOXOXOX'
$ echo ${VAR/X/.} ## first occurence only (anywhere)
.OXOXOX
$ echo ${VAR//X/.} ## all occurences
.O.O.O.
$ VAR='OXOXOX'
$ echo ${VAR/#X/.} ## first occurence (only if beginning match)
OXOXOX
@caruccio
caruccio / config.yml
Created June 12, 2012 01:47
Automatic remote download movies from http://movies.io (flexget + transmission)
## 1 - Create an account in http://movies.io and setup a RSS for your movies
####
## 2 - Install and configure flexget
####
$ sudo easy_install flexget
$ cat <<EOF > ~/.flexget/config.yml
feeds:
movies.io:
@caruccio
caruccio / gist:3056826
Created July 5, 2012 22:18
Extract variable value from file
This should extract the value of a variable from a text file.
It works fine with bash/sh and makefile variables.
Had to use 2 sed()s to deal with name='value' cases.
Fixes are welcome.
$ VAR_NAME=PREFIX
$ sed --version
GNU sed version 4.1.5
$ cat filename.conf | \
sed -ne \
@caruccio
caruccio / pythonic.py
Created September 24, 2012 15:04
What does 'pythonic' means?
for i, j in { 'a': 1, 'b': 2 }.iteritems():
print i, j
for i, j in [ ('a', 1), ('b', 2) ]:
print i, j
@caruccio
caruccio / xorg-synaptics.conf
Created November 26, 2012 22:09
Setup xorg synaptics on my Dell Inspiron 14Z 5423
Section "InputDevice"
Identifier "touchpad"
Driver "synaptics"
Option "LeftEdge" "1766"
Option "RightEdge" "5382"
Option "TopEdge" "1645"
Option "BottomEdge" "4563"
Option "FingerLow" "25"
Option "FingerHigh" "30"
Option "FingerPress" "256"
@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 / 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.