Skip to content

Instantly share code, notes, and snippets.

View djromero's full-sized avatar
⌨️
Working

Julián Romero djromero

⌨️
Working
  • Job&Talent
  • Madrid (Spain)
View GitHub Profile
// This is my configuration for Phoenix <https://github.com/sdegutis/Phoenix>,
// a super-lightweight OS X window manager that can be configured and
// scripted through Javascript.
var mNone = [],
mCmd = ['cmd'],
mShift = ['shift'],
nudgePixels = 10,
padding = 0,
previousSizes = {};
@djromero
djromero / mb_search_artist.js
Created March 12, 2014 17:44
Search an artist name in Music Brainz database.
var http = require("http")
var query = require('querystring');
var term = process.argv[2];
var DEBUG = false;
var options = {
host: 'search.musicbrainz.org',
path: '/ws/2/artist/?fmt=json&query=' + query.escape(term)
};
@djromero
djromero / retag.sh
Created April 4, 2014 15:05
Change ID3 tags in the command line with id3v2.
#!/bin/bash
# Copy the Artist tag to Artist Album.
# Requires id3v2 [brew install id3vw]
#
DIR="500 Greatest Songs"
find "$DIR" -name "*mp3" | while read song
do
artist=`id3v2 --list "$song" | grep TPE1 | cut -d: -f 2 | sed -e 's/^ //'`
@djromero
djromero / PonyDebuggerCoreData.m
Created April 8, 2014 10:50
Enable Core Data debugging with Pony Debugger.
/* Xcode configuration
OTHER_CFLAGS=-I$(HOME)/Library/PonyDebugger/include -DWITH_PONYD=1
OTHER_LDFLAGS=-L$(HOME)/Library/PonyDebugger -lSocketRocket -lPonyDebugger -licucore -ObjC
*/
#if WITH_PONYD
#import <PonyDebugger/PonyDebugger.h>
#endif
#if WITH_PONYD
@djromero
djromero / SlowAnimations.m
Created April 8, 2014 11:32
iOS global slow animations
dispatch_async(dispatch_get_main_queue(), ^{
[(CALayer *)[self.window layer] setSpeed:.2];
});
@djromero
djromero / latin1_to_utf8.sh
Created May 31, 2014 21:39
Latin1 subtitles to UTF-8 oneliner
find * -name "*srt" | while read file;do file -I "$file" | grep 8859;if [ $? -eq 0 ];then iconv -f latin1 -t utf8 "$file" > "_${file}"; mv "_${file}" "$file";fi;done
/*
2013-09-29 21:23:26.468 perf[3911:60b] Sep 26, 2013, 8:47 AM confidence high type walking steps 16
2013-09-29 21:23:26.474 perf[3911:60b] Sep 26, 2013, 8:56 AM confidence medium type walking steps 0
2013-09-29 21:23:26.492 perf[3911:60b] Sep 26, 2013, 9:08 AM confidence high type stationary steps 25
...
*/
if([CMMotionActivityManager isActivityAvailable]) {
CMMotionActivityManager *cm = [[CMMotionActivityManager alloc] init];
CMStepCounter *sc = [[CMStepCounter alloc] init];
@djromero
djromero / update_provisioning_profile.sh
Last active February 6, 2024 12:13
Download and install a single iOS provisioning profile for Xcode
#!/bin/sh
#
# Download and install a single iOS provisioning profile
# Requires https://github.com/nomad/cupertino
#
# Usage
# - Login to your account once:
# ios login
# - Configure TEAM and PROFILE (instructions below)
# - Run update_provisioning_profile.sh at anytime, usually after adding/removing devices to the profile
[self.collectionView aspect_hookSelector:@selector(touchesBegan:withEvent:)
withOptions:AspectPositionAfter
usingBlock:^(id<AspectInfo> aspectInfo, NSSet *touches, UIEvent *event) {
NSLog(@"touchesBegan:withEvent:\n%@\n%@\n", touches, event);
}
error:&error];
[self aspect_hookSelector:@selector(pointInside:withEvent:)
withOptions:AspectPositionAfter
@djromero
djromero / image_diff.py
Last active August 29, 2015 14:13
Compare two images.
# http://effbot.org/zone/pil-comparing-images.htm
from PIL import Image
import sys
import math
import operator
if len(sys.argv) < 3:
print "<image_path> <image_path>".format(sys.argv[0])
sys.exit(1)