Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
!In the mood

Mateus Caruccio caruccio

💭
!In the mood
View GitHub Profile
View teste-reboot.yml
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 Apr 24, 2012
Pattern substitution
View bash-pattern-subst
$ 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 Jun 12, 2012
Automatic remote download movies from http://movies.io (flexget + transmission)
View config.yml
## 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 Jul 5, 2012
Extract variable value from file
View gist:3056826
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 Sep 24, 2012
What does 'pythonic' means?
View pythonic.py
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 Nov 26, 2012
Setup xorg synaptics on my Dell Inspiron 14Z 5423
View xorg-synaptics.conf
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"
View .gitconfig
[core]
pager = less -XF
[user]
name = Mateus Caruccio
email = mateus@caruccio.com
[color]
diff = auto
branch = auto
@caruccio
caruccio / .ssh_config
Created Mar 21, 2013
Reusing a shared master ssh connection across many ssh client instances (really fast login after first login).
View .ssh_config
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 Dec 16, 2015
Gists para o blog
View getup-auth.py
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 Dec 30, 2015
Original blog post on running Nginx PHP-FPM under OpenShift
View openshift-nginx-cartridge-blog-post.md

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.