Skip to content

Instantly share code, notes, and snippets.

View marhan's full-sized avatar

Markus Hanses marhan

View GitHub Profile
@marhan
marhan / gist:f6783cd361d118a576eadc5350a4d4c9
Created March 19, 2018 14:33 — forked from pburkholder/gist:a9cdde0b33be8d5e3c08
Shared examples in rspec/serverspec.....

Create the following folder structure in your cookbook:

test
└── integrationq
    ├── helpers
    │   ├── serverspec
    │   │   ├── shared_serverspec_tests
    │   │   │   └── shared_tests2.rb
    │   │   └── spec_helper.rb
@marhan
marhan / docker-macos-terraform.md
Created February 22, 2018 20:07 — forked from brianshumate/docker-macos-terraform.md
The Simplest Terraform with Docker on macOS

If you'd like to experiment with Terraform on macOS locally, a great provider for doing so is the Docker provider. You can get set up in a few simple steps, like so:

1. Install Docker

Install Docker for Mac if you have not already.

@marhan
marhan / server_hardening.md
Created December 2, 2017 21:04 — forked from vivianspencer/server_hardening.md
Debian 8 Hardening

Debian 8 Hardening

  1. Update root's mail recipient. Open /etc/aliases replacing [email protected] with an administrator's email address. This is where logs will be emailed.

    root:     [email protected]
    
  2. Update the the default umask to 027. Edit the file /etc/init.d/rc and change the following setting:

umask 027

@marhan
marhan / ConnectTimeoutTest.java
Created August 9, 2017 10:15 — forked from anthavio/ConnectTimeoutTest.java
How to simulate connect timeout error and test it
import java.net.HttpURLConnection;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketTimeoutException;
import java.net.URL;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@marhan
marhan / EmbeddedMessageQueueResource.java
Created August 6, 2017 22:45 — forked from mlaccetti/EmbeddedMessageQueueResource.java
Apache QPid as embedded MQ broker
package laccetti.test;
import org.apache.qpid.server.Broker;
import org.apache.qpid.server.BrokerOptions;
import com.google.common.io.Files;
/**
* We shouldn't need external things for testing
*/
<!DOCTYPE html>
<html>
<head>
<title>AWS SDK for JavaScript - Sample Application</title>
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.65.0.min.js"></script>
<!-- <script src="https://sdk.amazonaws.com/js/aws-sdk-2.7.20.min.js"></script> -->
</head>
<body>
<div id="results"></div>
@marhan
marhan / gist:49414244a48b508e30c60908c6e21530
Created May 13, 2017 19:30
vagrant-share/helper/api (LoadError) Fix for vagrant 1.9.x
vagrant plugin install vagrant-share --plugin-version 1.1.8
@marhan
marhan / zeppelin_manage.sh
Created May 11, 2017 15:20
Starts and stops the Apache Zeppelin application with a standalone Apache Spark cluster
#!/bin/bash
# Configuration
WAIT_SECONDS=2
function start() {
echo
echo "=> Starting spark Master <="
echo
sh ${SPARK_HOME}/sbin/start-master.sh > /dev/null 2>&1
@marhan
marhan / create_user.sh
Created May 9, 2017 21:17
Creates a linux user without interaction
#!/bin/bash
password="develop" # your chosen password
crypted_password=$(perl -e 'printf("%s\n", crypt($ARGV[0], "password"))' "$password")
sudo useradd -m -p $crypted_password -s /bin/bash developer
@marhan
marhan / install_oracle_jdk.sh
Created May 8, 2017 09:22
Installs oracle jdk 8 on Debian 8 and Ubuntu 16
#!/bin/bash
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee -a /etc/apt/sources.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee -a /etc/apt/sources.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886 && apt-get update
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections
apt-get install -y oracle-java8-installer