Skip to content

Instantly share code, notes, and snippets.

View jay-johnson's full-sized avatar

Jay jay-johnson

View GitHub Profile
@jay-johnson
jay-johnson / start-vm.sh
Last active September 2, 2018 19:49
KVM - virt-install to start a vm - with cpu + memory + bridge network settings - and commented out how to seed a file to the vm on startup
virt-install \
–-name master1 \
–-vcpus 2 \
–-ram 1024 \
–-network bridge=br0 \
# –-connect qemu:///system \
# –-disk pool=master1,size=20,bus=virtio,sparse=false \
# -–location http://us.archive.ubuntu.com/ubuntu/dists/trusty/main/installer-amd64/ \
# -–initrd-inject=preseeds/preseed.cfg \
# -–extra-args="locale=en_US.UTF-8 console-setup/ask_detect=false keyboard-configuration/layoutcode=us file=file:/preseed.cfg vga=788 quiet console=tty0 utf8 console=ttyS0,115200" \
@jay-johnson
jay-johnson / splunk_send_json_fields_over_tcp.py
Last active July 4, 2018 03:33
Send Logs with JSON Fields to Splunk over TCP with sourcetype set to _json
#!/usr/bin/env python
import os
import sys
import json
import socket
import datetime
import time
@jay-johnson
jay-johnson / convert_to_numeric_csv.py
Created July 2, 2018 21:33
Pandas - convert a csv to categorical numeric values
#!/usr/bin/env python
import pandas as pd
cur_file = './test.csv'
df = pd.read_csv(cur_file)
org_cols = df.columns.values
cols = {}
for c in org_cols:
print('categorizing column: {}'.format(c))
@jay-johnson
jay-johnson / splunk-compose.yml
Last active June 21, 2018 06:32
Splunk Docker Compose Free
version: '3'
services:
splunkenterprise:
hostname: splunkenterprise
container_name: "splunk"
image: splunk/splunk:7.0.3
environment:
SPLUNK_START_ARGS: --accept-license --answer-yes
@jay-johnson
jay-johnson / add this to etc ansible hosts
Created May 23, 2018 04:09
add this to etc ansible hosts
openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true', 'challenge': 'true', 'kind': 'HTPasswdPasswordIdentityProvider', 'filename': '/etc/origin/master/htpasswd'}]
@jay-johnson
jay-johnson / Installing OCP with Virtual Box.md
Last active June 25, 2018 04:12
Installing OCP with Virtual Box
imagetouse=/home/jay/Documents/ocp-3.9.ova
vmname=ocp
nicname=enp7s0

vboxmanage controlvm ${vmname} poweroff
vboxmanage unregistervm ${vmname} --delete
vboxmanage import ${imagetouse} --options keepallmacs --vsys 0 --cpus 4 --vsys 0 --memory 16000 --vmname ${vmname}
vboxmanage modifyvm ${vmname} --nic1 nat
vboxmanage modifyvm ${vmname} --nic1 bridged --bridgeadapter1 ${nicname}
@jay-johnson
jay-johnson / Anti-Nex - Antivirus for Network Exploits.rst
Last active February 12, 2018 16:16
Anti-Nex - Antivirus for Network Exploits

image

Antivirus for Network Exploits

This is the first Anti-Nex release for detecting attacks and malicious network traffic using artificial intelligence (deep neural networks with Keras and Tensorflow). These tools and datasets are for quickly training models to defend applications, infrastructure and personal property.

Here are the Anti-Nex repositories on GitHub:

  1. Network-Pipeline - Distributed capture tools
node {
// https://registry.hub.docker.com/_/maven/
def maven32 = docker.image('maven:3.2-jdk-7-onbuild');
stage 'Mirror'
// First make sure the slave has this image.
// (If you could set your registry below to mirror Docker Hub,
// this would be unnecessary as maven32.inside would pull the image.)
maven32.pull()
// We are pushing to a private secure docker registry in this demo.
@jay-johnson
jay-johnson / recover_source_code.md
Created January 17, 2018 23:06 — forked from simonw/recover_source_code.md
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
@jay-johnson
jay-johnson / python-color-theme-dark.json
Last active August 20, 2017 18:56
Visual Studio Code - Python Dark Theme
// This theme's colors are based on the original Monokai
//
// 1) Install it by adding it to an existing installed theme
// cd C:\Programs\MicrosoftVSCode\resources\app\extensions\theme-monokai
//
// 2) open up the theme's package.json:
// C:\Programs\MicrosoftVSCode\resources\app\extensions\theme-monokai\package.json
//
// 3) Add it into the package.json "contributes.themes" list:
//