Skip to content

Instantly share code, notes, and snippets.

Adrian Ber beradrian

Block or report user

Report or block beradrian

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
beradrian / proxy.js
Created Jan 18, 2018
CORS proxy with node-http-proxy
View proxy.js
/** If you want to use the local development environment with the dev backend,
* this will create a proxy so you won't run into CORS issues.
* It accepts the following command line parameters:
* - port the port where the proxy will listen
* - target the DEV backend target to contact.
* Example: If you set the port to 3000 and target to then
* your actual "resourceBaseUrl" in NiboSettings should be http://localhost:3000/api/v1
// Define the command line options
const optionDefinitions = [
beradrian / log.js
Last active Nov 21, 2017
Log from JS to Fluentd/Logstash
View log.js
var log4js = require('log4js');
// Use as host
// - as host for local Docker or the IP provided by `docker-machine ip default`
// var host = '';
var host = 'localhost';
console.log("Using central log host " + host);
console.log("Configure log4js ...");
beradrian / App.config
Created Oct 13, 2017
Logstash NLog Target
View App.config
<target name="logstash" xsi:type="Network" address="tcp://host:port" newLine="true">
<layout xsi:type="JsonLayout" includeAllProperties="false">
<attribute name="@timestamp" layout="${date:format=yyyy-MM-ddTHH\:mm\:ss.fffZ}" />
<attribute name="level" layout="${level:upperCase=true}"/>
<attribute name="category" layout="${logger}" />
<attribute name="message" layout="${message}" />
<attribute name="environment" layout="production" />
<attribute name="extra" layout="value" />
beradrian / chronos.docker-compose.yml
Last active May 25, 2017
docker-compose.yml samples
View chronos.docker-compose.yml
version: '3'
image: zookeeper
restart: always
- "2181:2181"
ZOO_SERVERS: server.1=zk1:2888:3888
beradrian / build.gradle
Last active May 25, 2017 — forked from xconnecting/build.gradle
Gradle: Using jdbc in build script
View build.gradle
import groovy.sql.Sql
// more information at
apply plugin: 'groovy'
apply plugin: 'eclipse'
apply plugin: 'maven'
repositories { mavenCentral() }
configurations { driver }
View FineTuneCache.nginx.conf
proxy_cache_path /path/to/cache levels=1:2 keys_zone=my_cache:10m max_size=10g
inactive=60m use_temp_path=off;
server {
location / {
proxy_cache my_cache;
View jmeter-results-to-junit.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="" version="1.0">
<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
<xsl:template match="/testResults">
<xsl:for-each select="*">
<xsl:attribute name="classname"><xsl:value-of select="name()"/></xsl:attribute>
<xsl:attribute name="name"><xsl:value-of select="@lb"/></xsl:attribute>
beradrian / .travis.yml
Last active Jun 23, 2016
Karma with Chrome and FF on Travis
View .travis.yml
language: node_js
- stable
- export CHROME_BIN=/usr/bin/google-chrome
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- sudo apt-get update
- sudo apt-get install -y libappindicator1 fonts-liberation
- sudo apt-get upgrade libstdc++6 lsb-base
package com.stefisoft.webchat;
import java.util.HashSet;
import java.util.Set;
import javax.websocket.Endpoint;
import javax.websocket.server.ServerApplicationConfig;
import javax.websocket.server.ServerEndpointConfig;
import org.slf4j.Logger;
beradrian /
Created Dec 3, 2015
Distance between two geographical points
import org.geotools.referencing.GeodeticCalculator;
import java.awt.geom.Point2D;
* How far is NY from London ?
public class DistanceTest {
You can’t perform that action at this time.