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);
<?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 / 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 / NSObject+AssociatedObjects.h
Created December 23, 2011 18:33 — forked from xslim/NSObject+AssociatedObjects.h
Blocks support for RestKit RKClient
#import <Foundation/Foundation.h>
@interface NSObject (AMAssociatedObjects)
- (void)associateValue:(id)value withKey:(void *)key; // Retains value.
- (id)associatedValueForKey:(void *)key;
@end
@ecentinela
ecentinela / gist:1275450
Created October 10, 2011 14:25 — forked from javan/gist:1168475
Fix iPhone home button
Found this tip in comment here: http://www.tipb.com/2011/01/04/tipb-bug-home-button-working-iphone/
1.) Open any application
2.) Press and hold the power button until the slide to shutdown swipe bar appears.
3.) Release Power button
4.) Press and hold Home button Lightly
until screen returns to icon screen
# How to echobot with XMPP, BOSH, and Strophe
1. Setup ejabberd(http://www.ejabberd.im/) server and setup account admin@localhost.local
NOTE: localhost should be enough. If you setup something else, make sure you add it at /etc/hosts like this
#/etc/hosts
127.0.0.1 localhost.local
NOTE: Also download Psi(http://psi-im.org/), and make sure you can connect to your ejabberd server.
2. Download strophe(http://code.stanziq.com/strophe/) and place it (eg: /Users/makoto/work/sample/strophejs-1.0)
#Importante: resetear el single_access_token de los usuarios que no tengan
cd /var/www/apps/pareja10/current
script/console staging (o production)
User.find_each do |u|
unless u.single_access_token?
u.reset_single_access_token
u.save(false)
end
end