Skip to content

Instantly share code, notes, and snippets.

View n1chre's full-sized avatar
💯

Filip Hrenić n1chre

💯
View GitHub Profile
module Prettify
(
Doc,
char, double, text,
(<>), hcat, fsep, punctuate,
compact, pretty
) where
data Doc = Empty
| Char Char
@n1chre
n1chre / mrepro.c
Last active May 6, 2017 18:14
Network programming wrappers for functions and misc
#include "mrepro.h"
void Getaddrinfo(const char* hostname, const char* servicename,
const struct addrinfo* hints, struct addrinfo** result)
{
int error;
error = getaddrinfo(hostname, servicename, hints, result);
if (error) Errx(MP_ADDR_ERR, "getaddrinfo: %s", gai_strerror(error));
}
void Getnameinfo(const struct sockaddr* sockaddr, socklen_t addrlen,
oznaceni_podaci = ...
neoznaceni_podaci = ...
threshold = 0.05
dok ima neoznacenih podataka:
train,test = oznaceni_podaci.split()
treniraj model ( train, test )
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.LinkedList;
import java.util.List;
/**
* Created by fhrenic on 12/11/2016.
@n1chre
n1chre / ns-simulator-install.sh
Last active December 17, 2016 13:52
Installation script for ns2 simulator
#! /usr/bin/env bash
cd ~/Downloads
# must be named like this
TAR_FILE='ns-allinone-2.35.tar.gz'
# this will be the directory
DIR_NAME='ns-allinone-2.35'
@n1chre
n1chre / double-regex.java
Created December 22, 2016 13:56
Regular expresion used for finding doubles in a string
/**
* Regular expression for finding numbers in double format
*/
private static final Pattern NUM = Pattern.compile("[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?");
@n1chre
n1chre / ns-simulator.tcl
Created December 26, 2016 14:50
Simulation in ns2 for Information networks project assignment
# Luka Sonjic 0036476996
# Matej Lipovac 0036468779
# Oblikovanje simulatora
set ns [new Simulator]
# Otvaranje datoteke za NAM trace
set nf [open out.nam w]
$ns namtrace-all $nf
@n1chre
n1chre / TabuProblem.java
Last active January 8, 2017 19:10
Basic tabu search implementation in Java
package hr.fer.tel.hmo.tabu.alg;
import java.util.Collection;
/**
* Interface for tabu search
*/
public interface TabuProblem<S> {
/**
@n1chre
n1chre / provision.sh
Created January 7, 2017 15:20
Vagrant provision script: set up Derby database and Tomcat server
#! /usr/bin/env bash
APPNAME=
# tomcat conf
TADM_USER=admin
TADM_PASS=admin
# derby conf
DERBY_DB=/home/vagrant/database
@n1chre
n1chre / Parallel.java
Last active January 8, 2017 16:46
Running of parallel tasks that can be terminated if an acceptable value is produced.
package parallel;
import java.util.Collection;
import java.util.Observable;
import java.util.Observer;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicInteger;
/**
* This class is used to execute tasks in parallel.