Skip to content

Instantly share code, notes, and snippets.

@dexafree
dexafree / init.vim
Created October 13, 2016 13:35
Init vim for bug report
" -*- mode: vimrc -*-
"vim: ft=vim
" dotspaceneovim/auto-install {{{
"Automatic installation of spaceneovim.
if has('nvim')
let s:config_dir = $HOME . '/.config/nvim'
else
let s:config_dir = $HOME . '/.vim'
endif
@dexafree
dexafree / FieldMapGenerator.java
Created September 1, 2016 20:51
Object To HashMap<String, String> for UrlEncode with annotation. Originally thought to be used for sending objects through Retrofit's @fieldmap annotation
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;
/**
* Class that will convert a given object (of any kind) and iterate over its fields, converting them to a
* Map<String, String>.
*
* It offers different working modes ({@link MODE}), that can be passed to the "toMap" method.
@dexafree
dexafree / semaphors.groovy
Created December 5, 2015 14:45
Semaphors
import groovy.json.*
class Node {
def links = []
def timeOff
def timeOn
def id
def period
@dexafree
dexafree / fixmd.py
Created August 25, 2015 16:24
Python script that allows me to use a custom org2md post-processor after pandoc's conversion
import sys
import re
lines = []
def fix_first_line(line):
is_jekyll_regex = re.compile("^---", re.IGNORECASE)
is_jekyll = re.search(is_jekyll_regex, line)
if is_jekyll:
@dexafree
dexafree / gradle.properties
Created July 1, 2015 14:17
Archivo gradle.properties de ejemplo
VERSION_NAME=1.0.0
VERSION_CODE=1000
GROUP=com.github.dexafree
POM_DESCRIPTION=La descripcion de mi proyecto
POM_URL=https://github.com/dexafree/miproyecto
POM_SCM_URL=https://github.com/dexafree/miproyecto
POM_SCM_CONNECTION=scm:git@github.com:dexafree/miproyecto.git
POM_SCM_DEV_CONNECTION=scm:git@github.com:dexafree/miproyecto.git
POM_LICENCE_NAME=The Apache Software License, Version 2.0
@dexafree
dexafree / upgradeghost.sh
Last active August 29, 2015 14:08
Upgrade Ghost installation
#!/bin/sh
GHOST_PATH=/var/ghost
### Make backup
tar cvzf ghostbackup.tar.gz $GHOST_PATH
### Download last ghost version
wget http://ghost.org/zip/ghost-latest.zip
### Remove core
server {
listen 80;
server_name www.TUDOMINIO.com TUDOMINIO.com;
if ($host = 'localhost' ) {
rewrite ^/(.*)$ http://www.TUDOMINIO.com/$1 permanent;
}
location ~ ^/(ghost/signup/) {
@dexafree
dexafree / CoordDownloader.py
Created May 24, 2014 13:29
Script utilizado para descargar las coordenadas de todas las paradas de FGC y añadirlas a una base de datos SQLite. Extrae los datos en un archivo llamado SQL.txt
# -*- coding: utf-8 -*-
import urllib2
from bs4 import BeautifulSoup
# Array de todas las lineas de FGC
linies = ['l6', 'l7', 's1', 's2', 's5', 's55', 's8', 's33', 's4', 's8', 'r5', 'r50', 'r6', 'r60']
# Creamos el opener y le añadimos los headers
opener = urllib2.build_opener()
opener.addheaders = [('User-agent', 'Mozilla/5.0')]