Skip to content

Instantly share code, notes, and snippets.

View unaipme's full-sized avatar
😇

Unai P. Mendizabal unaipme

😇
  • Ordizia, Gipuzkoa
View GitHub Profile
@unaipme
unaipme / docker-compose.yml
Created February 20, 2020 08:43
Docker Compose yml configuration file for TTN Stack
version: '3.7'
services:
# If using CockroachDB:
cockroach:
image: cockroachdb/cockroach
command: start --http-port 26256 --insecure
restart: unless-stopped
volumes:
- ${DEV_DATA_DIR:-.env/data}/cockroach:/cockroach/cockroach-data
@unaipme
unaipme / SpotiDump.java
Created May 20, 2019 16:53
Java class to get the audio features of some songs from Spotify's official API.
package eus.unai.spotidump;
import com.google.gson.Gson;
import com.google.gson.internal.LinkedTreeMap;
import com.opencsv.CSVReader;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
@unaipme
unaipme / Main.java
Created May 9, 2019 14:12
(Custom) CSV to XML
package eus.unai.jena;
import org.apache.jena.rdf.model.*;
import org.apache.jena.vocabulary.RDF;
import org.apache.jena.vocabulary.RDFS;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.HashMap;
@unaipme
unaipme / dates.erl
Last active February 18, 2019 15:24
First encounter with Erlang
-module(dates).
-author("unai").
%% API
-export([classify_day/1]).
classify_day({saturday}) -> classify_day({weekend});
classify_day({sunday}) -> classify_day({weekend});
classify_day({weekend}) -> weekend;
classify_day({_}) -> weekday.
@unaipme
unaipme / Ariketa2.c
Last active May 16, 2018 10:19
Zerrenda kateatuak
#include <stdio.h>
#include <stdlib.h>
#define MAX_STR 128
typedef struct zenbakia {
int balorea;
struct zenbakia *hurrengoa;
} ZENBAKIA;
@unaipme
unaipme / algoritmoak.c
Last active May 1, 2018 12:55
Ordenazio algoritmoak
#include "algoritmoak.h"
void arrunta(int *zerrenda, int dim) {
int i, j;
for (i = 0; i < dim; i++) {
for (j = i; j < dim; j++) {
if (*(zerrenda + i) > *(zerrenda + j)) {
swap(zerrenda + 1, zerrenda + i);
}
}
@unaipme
unaipme / files.c
Created February 19, 2018 18:02
Working with files in C
#include <stdio.h>
#include <string.h>
#define _CRT_SECURE_NO_WARNINGS
typedef struct {
int algo;
int numero;
char nombre[5];
} DATO;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@unaipme
unaipme / druid.sh
Created January 16, 2018 09:12
Druid simple execution wrapper
#!/bin/bash
_LOG_DIR=/var/log/druid
_PID_DIR=/var/run/druid
function start {
if [ -f $_PID_DIR/$1.pid ]; then
echo "Component $1 already running"
else
if [ -f $_LOG_DIR/$1.out ]; then
@unaipme
unaipme / index.jsx
Created January 3, 2018 19:59
React.js adibidea
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
/*
todo lo que está entre llaves, {}, es interpretado como jsx.
una cosa de jsx es que no puedes escribir el css directamente, sino que tienes que utilizar un objecto de javascript como abajo
*/
class Header extends Component {
render() {
return (