Skip to content

Instantly share code, notes, and snippets.

@fiunchinho
fiunchinho / .travis.yml
Created August 29, 2012 20:16 — forked from gyndav/.travis.yml
Simple Mongo PHP Driver extension installer for Travis CI. Works like a charm for other PECL extensions too.
before_script:
- ./path/to/mongo-php-driver-installer.sh
@fiunchinho
fiunchinho / mongod
Created June 2, 2013 22:08
Rotate mongo logs every week
# /etc/logrotate.d/mongod
# http://linuxcommand.org/man_pages/logrotate8.html
/var/log/mongodb/mongodb.log {
weekly
missingok
rotate 30
compress
dateext
notifempty
sharedscripts
# watch files and rerun phpunit on changes
phpunitwait() {
while inotifywait $(find $1 -name '*.php');
do
clear;
phpunit --colors $2;
done;
}
@fiunchinho
fiunchinho / tdd
Last active December 25, 2015 10:19
Watch for changes in files (code and tests) and run phpunit tests whenever changes are detected. Althought is not needed, I recommend to use a phpunit.xml configuration file.
#!/bin/bash
if [ $# -ne 1 ]; then
echo "Usage: $0 CODE-DIRECTORY"
exit 1
fi
code_directory=$1
if [ ! -d $code_directory ]; then
@fiunchinho
fiunchinho / UserSpec.php
Created December 2, 2013 20:09
Triying to describe in PHPSpec that using wrong parameters throws exception
<?php
namespace MyApp;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
class UserSpec extends ObjectBehavior
{
function it_fails_when_using_a_not_valid_email()
@fiunchinho
fiunchinho / .vimrc
Created January 25, 2014 21:29
Current vim configuration file
" Theme
colorscheme railscasts
" Sugar
set showmatch " highlight matching [{()}]
set number " show line numbers
set showcmd " show command in bottom bar
set cursorline " highlight current line
syntax on " Enable syntax highlighting
@fiunchinho
fiunchinho / gist:19efa2a7729698d6d09a
Last active August 29, 2015 14:03
Deployment tools
* PHP-based:
** http://magephp.com/
** http://kohkimakimoto.github.io/altax/
** http://deployer.in/
** http://rocketeer.autopergamene.eu/
* Ruby
** http://capistranorb.com/
* Python
@fiunchinho
fiunchinho / ListExample.java
Last active July 30, 2018 18:04
Feign Observable serialization doesn't work
package net.armesto.feign;
import feign.Feign;
import feign.Param;
import feign.RequestLine;
import feign.jackson.JacksonDecoder;
import feign.jackson.JacksonEncoder;
import rx.Observable;
import java.util.List;
@fiunchinho
fiunchinho / postgres-cheatsheet.md
Last active March 2, 2016 18:34 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

If run with -E flag, it will describe the underlaying queries of the \ commands (cool for learning!).

Most \d commands support additional param of __schema__.name__ and accept wildcards like *.*

@fiunchinho
fiunchinho / credentials.py
Created March 17, 2016 12:06
Python script to fetch AWS access key and secret key from a running EC2 instance
from botocore.credentials import InstanceMetadataProvider, InstanceMetadataFetcher
provider = InstanceMetadataProvider(iam_role_fetcher=InstanceMetadataFetcher(timeout=1000, num_attempts=2))
credentials = provider.load()
access_key = credentials.access_key
secret_key = credentials.secret_key
print access_key
print secret_key