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 / 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);
let imageRef1 = self.backgroundView?.image?.CGImage
let coreImage1 = CIImage(CGImage: imageRef1)
let imageRef2 = image?.CGImage
let coreImage2 = CIImage(CGImage: imageRef2)
let coreImage3 = coreImage1.imageByApplyingFilter("CIColorBlendMode", withInputParameters: ["inputBackgroundImage" : coreImage2])
self.imageView?.image = UIImage(CIImage: coreImage3)
<?php
class ImageDiff {
// not bigger 20
private $matrix = 15;
public function getImageInfo($image_path){
list($width, $height, $type, $attr) = getimagesize($image_path);
$image_type = '';
@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 / 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 / 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">
@ecentinela
ecentinela / php-mongo.sh
Created March 10, 2012 12:06
php mongo extension
curl -OL https://github.com/downloads/mongodb/mongo-php-driver/osx-php5.3-1.0.11.zip