Skip to content

Instantly share code, notes, and snippets.

View cbergau's full-sized avatar

Christian Bergau cbergau

  • Arvato eCommerce
  • Hannover (Germany)
View GitHub Profile
StringBuilder sb = new StringBuilder();
try {
String line;
Process p = Runtime.getRuntime().exec("npm outdated --json");
BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
while ((line = input.readLine()) != null) {
sb.append(line);
}
input.close();
@cbergau
cbergau / Application.java
Created April 24, 2019 11:47
Simple GET Request with Apache HTTP Client
package de.christianbergau;
import org.apache.http.HttpResponse;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import java.io.IOException;
@cbergau
cbergau / log4j2.xml
Created March 19, 2019 22:15
log4j2.xml for Graylog2
<Configuration packages="biz.paluch.logging.gelf.log4j2">
<Appenders>
<Gelf name="gelf" host="udp:192.168.99.100" port="12201" version="1.1" extractStackTrace="true"
filterStackTrace="true" mdcProfiling="true" includeFullMdc="true" maximumMessageSize="8192"
originHost="%host{fqdn}" additionalFieldTypes="request=String">
<Field name="timestamp" pattern="%d{dd MMM yyyy HH:mm:ss,SSS}" />
<Field name="level" pattern="%level" />
<Field name="simpleClassName" pattern="%C{1}" />
<Field name="className" pattern="%C" />
<Field name="server" pattern="%host" />
//////////////////////////////////////////////////////
//This file includes all racial units, heroes,
//upgrades, buildings and abilities. Please consult
//CustomKeyInfo.txt for information on how to go about
//using this file for customized hotkey support.
//////////////////////////////////////////////////////
/////////////////////////////
//Shared Commands (attack, etc.)
let config = {
"php": [{
"base-image": "php:5-apache",
"groups": [
{
"name": "Memcache",
"properties": [
{
"name": "memcache.lifetime",
"type": "integer",
@cbergau
cbergau / console
Last active December 20, 2017 22:07
<?php
// a:62:{s:15:"ALLUSERSPROFILE";s:14:"C:\ProgramData";s:16:"ANDROID_NDK_PATH";s:56:"C:\Users\Christian\Documents\Android\ndk\android-ndk-r8d";s:7:"APPDATA";s:34:"C:\Users\Christian\AppData\Roaming";s:18:"CommonProgramFiles";s:35:"C:\Program Files (x86)\Common Files";s:23:"CommonProgramFiles(x86)";s:35:"C:\Program Files (x86)\Common Files";s:18:"CommonProgramW6432";s:29:"C:\Program Files\Common Files";s:12:"COMPUTERNAME";s:12:"CHRISTIAN-PC";s:7:"ComSpec";s:27:"C:\WINDOWS\system32\cmd.exe";s:27:"DOCKER_TOOLBOX_INSTALL_PATH";s:31:"C:\Program Files\Docker Toolbox";s:30:"FPS_BROWSER_APP_PROFILE_STRING";s:17:"Internet Explorer";s:31:"FPS_BROWSER_USER_PROFILE_STRING";s:7:"Default";s:16:"FP_NO_HOST_CHECK";s:2:"NO";s:12:"GTK_BASEPATH";s:37:"C:\Program Files (x86)\GtkSharp\2.12\";s:4:"HOME";s:18:"C:\Users\Christian";s:9:"HOMEDRIVE";s:2:"C:";s:8:"HOMEPATH";s:16:"\Users\Christian";s:9:"JAVA_HOME";s:33:"C:\Program Files\Java\jdk1.7.0_45";s:8:"JRE_HOME";s:33:"C:\Program Files\Java\jdk1.7.0_45";s:12:"LOCALAPPDATA";s:
New Node Configuration
Node interpreter: C:\PathHere\node_modules\.bin\babel-node.cmd
Node parameters: --presets=babel_preset-es2015
Working directory: Working directory of your project, or project root
JavaScript file: node_modules\react-scripts\scripts\test.js
Application paramters: --env=jsdom
Environment variables: CI=true
const Hapi = require('hapi');
const server = new Hapi.Server();
server.connection({
port: 3000,
host: 'localhost'
});
server.route({
method: 'GET',
path: '/greet',
@cbergau
cbergau / c_uni.c
Last active December 13, 2016 22:49
#include <iostream>
#include <windows.h>
#include <stdio.h>
typedef struct person {
char *firstName;
char *lastName;
int yearOfBirthday;
char *job;
} PERSON;
#include <iostream>
#include <windows.h>
int cmpfunc(const void * a, const void * b) {
return ( *(int*)a - *(int*)b );
}
int cstring_cmp(const void * a, const void * b) {
const char **ia = (const char **)a;
const char **ib = (const char **)b;