Skip to content

Instantly share code, notes, and snippets.

View ecentinela's full-sized avatar

Javier Martínez Fernández ecentinela

  • Barcelona, Spain
View GitHub Profile
@ecentinela
ecentinela / android_application_signature.java
Created December 5, 2012 20:11
Get Android application signature
PackageInfo info;
try {
info = getPackageManager().getPackageInfo("ecentinela.mercadotes", PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md;
md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
@ecentinela
ecentinela / Change author details in commit history
Created October 2, 2009 11:17
Change author / commiter details in all commits (WARNING: Will change all SHA1s)
#!/bin/sh
git filter-branch --env-filter '
an="$GIT_AUTHOR_NAME"
am="$GIT_AUTHOR_EMAIL"
cn="$GIT_COMMITTER_NAME"
cm="$GIT_COMMITTER_EMAIL"
if [ "$GIT_COMMITTER_EMAIL" = "your@email.to.match" ]
@ecentinela
ecentinela / phpunit
Created May 26, 2011 16:56
Install PHPUnit in MAMP
cd /Applications/MAMP/bin
ln -s php5.3 php5
php5/bin/pear channel-discover pear.phpunit.de
php5/bin/pear channel-discover components.ez.no
php5/bin/pear channel-discover pear.symfony-project.com
php5/bin/pear channel-update pear.php.net
php5/bin/pear upgrade pear
php5/bin/pear install phpunit/PHPUnit
ln -s /Applications/MAMP/bin/php5/bin/phpunit /usr/local/bin/phpunit
phpunit --version
@ecentinela
ecentinela / imagick
Created October 19, 2011 18:14
install imagick on mamp 2 - lion
# install brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"
# install imagemagick
brew install imagemagick
# install imagick
brew install imagick
# if giving errors on the installation, comment the content on ~/.bash_profile or ~/.profile, open a new terminal and retry
@ecentinela
ecentinela / destroy_volume.sh
Created October 31, 2016 10:27 — forked from weirded/destroy_volume.sh
Data Destroying Drone script
#!/bin/bash
set -e
export INSTANCE_ID=`wget -q -O - http://169.254.169.254/latest/meta-data/instance-id`
export VOLUME_ID=v-12345678
export EC2_URL=https://ec2.us-east-1.amazonaws.com
export EC2_ACCESS_KEY=[key id]
export EC2_SECRET_KEY=[key]
sudo apt-get install scrub
euca-attach-volume -i $INSTANCE_ID -d /dev/sdj $VOLUME_ID
@ecentinela
ecentinela / test.js
Created December 26, 2015 10:38 — forked from mscdex/test.js
sharing sessions between node.js and php using redis
var express = require('express'),
app = express(),
cookieParser = require('cookie-parser'),
session = require('express-session'),
RedisStore = require('connect-redis')(session);
app.use(express.static(__dirname + '/public'));
app.use(function(req, res, next) {
if (~req.url.indexOf('favicon'))
return res.send(404);
@ecentinela
ecentinela / email_in_command.php
Created January 9, 2013 09:25
The memory spool is flushed on the kernel.terminate event that occurs after a response was sent. Seems that this event is not called on commands. Seen on http://stackoverflow.com/questions/13122096/unable-to-send-e-mail-from-within-custom-symfony2-command-but-can-from-elsewhere
$this
->getContainer()
->get('mailer')
->getTransport()
->getSpool()
->flushQueue(
$this
->getContainer()
->get('swiftmailer.transport.real')
);
@ecentinela
ecentinela / remove_dupe.sh
Created January 8, 2013 21:32
Remove duplicates on open with menu on osx mountain lion
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
@ecentinela
ecentinela / linkify.php
Created March 27, 2012 05:06 — forked from jasny/linkify.php
PHP function to turn all URLs in clickable links
<?php
/**
* Turn all URLs in clickable links.
*
* @param string $value
* @param array $protocols http/https, ftp, mail, twitter
* @param array $attributes
* @param string $mode normal or all
* @return string
*/
@ecentinela
ecentinela / behat-jenkins.txt
Created March 17, 2012 09:29 — forked from robo47/behat-jenkins.txt
Behat, Symfony2, Jenkins
Ant-Task which runs behat:
<?xml version="1.0" encoding="UTF-8"?>
<project name="Foo" default="build" basedir=".">
....
<target name="behat">
<exec dir="${basedir}/" executable="php" failonerror="true">