Skip to content

Instantly share code, notes, and snippets.

View petergdoyle's full-sized avatar

Peter Doyle petergdoyle

View GitHub Profile
@petergdoyle
petergdoyle / HexEncoder.java
Created April 19, 2019 11:42
Hex Encode Strings in Java
public class HexEncoder {
public static void main(String[] args) {
System.out.printf("String:%s HexEncoded: %s\n", "hello world", hexEncode("hello world".getBytes()));
}
static private String hexEncode(byte[] input) {
StringBuilder result = new StringBuilder();
@petergdoyle
petergdoyle / start_socks_proxy.sh
Created July 2, 2018 23:58
Start up a socks proxy using SSH
#!/bin/bash
local_port="9090"
read -e -p "Enter the local port to run the proxy on: " -i "$local_port" local_port
remote_host="cleverfishsoftware.com"
read -e -p "Enter the remote host to run the proxy from: " -i "$remote_host" remote_host
remote_port="22"
read -e -p "Enter the remote ssh port: " -i "$remote_port" remote_port

Secure Azure VMs

Secure the Node VMs

Any VMs have public ip numbers and registered domain names. Therefore these machines are accessible to the internet and vulternable to attack. Using available Azure VM images has its advantages but a verification of security measures is required to ensure that the VMs are not immediately open to intrusion and do not become compromised over time.

Do Not Use Azure public VM Images

Ideally a vm should be created from distro sources and provisioned and uploaded to Azure accordingly. The following outlines the process to build a CentOS 7.x minimal installation and load it to Azure : Prepare a CentOS-based virtual machine for Azure, 05/09/2016. The current Swarm Nodes were built on top of publically available CentOS vm images. These should likely be replaced once the integration of all the moving parts is complete and the setup and provisioning of this configuratio

import java.util.Iterator;
import static com.gslab.pepper.input.FieldDataFunctions.*;
import static com.gslab.pepper.input.CustomFunctions.*;
public class MessageIterator1498484495874 implements Iterator<String> {
private static StringBuilder builder = new StringBuilder();
@Override
<profile>
<id>copy-dependencies</id>
<!--
Usage: mvn clean install -Pcopy-dependencies -Dpackage-name=om.manning.nettyinaction.chapter2 -Dclass-name=Ech
oServer
java -jar target/${artifactId}.jar
-->
<build>
<plugins>
@petergdoyle
petergdoyle / hello_world.sh
Created January 2, 2016 13:55
script used for testing script execution from gist
#!/bin/sh
echo hello world!
yum -y groupinstall "X Window System"
#install the lightweight xfce desktop
yum -y groupinstall xfce
yum -y install xfce4-terminal
#install additional themes. these can be selected with the desktop settings widget on xfce
wget -O crunchy-dark-grey.tar.gz https://dl.orangedox.com/xCs7czovfGqWuOhBgm/crunchy-dark-grey.tar.gz?dl=1
tar -xvf crunchy-dark-grey.tar.gz
mv crunchy-dark-grey /usr/share/themes
# We borrow heavily from the kernel build setup, though we are simpler since
# we don't have Kconfig tweaking settings on us.
# The implicit make rules have it looking for RCS files, among other things.
# We instead explicitly write all the rules we care about.
# It's even quicker (saves ~200ms) to pass -r on the command line.
MAKEFLAGS=-r
# The source directory tree.
srcdir := ..
@petergdoyle
petergdoyle / Vagrantfile.plex.vbx
Created August 13, 2015 19:39
A set of Vagrant box definitions
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "CentOS-7.1.1503-x86_64"
config.vm.network "forwarded_port", guest: 32400, host: 32400, host_ip: "0.0.0.0", id: "plex", auto_correct: true
config.vm.provision "shell", inline: <<-SHELL
@petergdoyle
petergdoyle / mongodb.repo
Last active August 29, 2015 14:22
define a mongodb repo entry into /etc/yum.repos.d/mongodb.repo
[mongodb-org-3.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.0/x86_64/
gpgcheck=0
enabled=1