Skip to content

Instantly share code, notes, and snippets.

View hkparker's full-sized avatar

Hayden Parker hkparker

View GitHub Profile
@hkparker
hkparker / main.go
Created July 24, 2021 22:31
Fyne chat bubble that mostly works
package main
import (
"image/color"
"strings"
"time"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/canvas"
package main
import (
"fmt"
"flag"
"bufio"
"os"
"encoding/hex"
log "github.com/sirupsen/logrus"
@hkparker
hkparker / setup_ids.rb
Created July 14, 2019 07:11
Every time I boot xenserver/xcp-ng I have to bridge the interfaces for my IDS to get TAP traffic. My IDS runs this at boot to ssh in and do it.
#!/usr/bin/ruby
require 'net/ssh'
bridges = ["xenbr3", "xenbr4", "xenbr5"]
bridge_interfaces = {
"xenbr3" => "eth3",
"xenbr4" => "eth4",
"xenbr5" => "eth5"
}
@hkparker
hkparker / encrypt_offsite.rb
Created July 29, 2016 08:11
encrypt file content and paths
require 'json'
require 'shellwords'
present = []
names = {}
["hayden", "xobackups"].each do |dir|
Dir["#{dir}/**/*"].each do |path|
next if !File.file?(path)
newname = `echo "#{path}" | sha256sum | cut -d ' ' -f 1`.strip
@hkparker
hkparker / elasticsearch.service
Created July 25, 2016 06:29
Elasticsearch service file
[Unit]
Description=Elasticsearch
Requires=docker.service
After=docker.service
[Service]
Restart=always
ExecStart=/usr/bin/docker run -v "/elasticsearch":/usr/share/elasticsearch/data -p=9200:9200 -p=9300:9300 --user="111:117" elasticsearch
ExecStop=/usr/bin/docker stop -t 2 elasticsearch
@hkparker
hkparker / xo-docker-compose.yml
Created July 24, 2016 20:43
Docker Compose for Xen Orchestra
version: '2'
services:
xo:
build: .
ports:
- "80:80"
redis:
image: "redis@sha256:b50f15d427aea5b579f9bf972ab82ff8c1c47bffc0481b225c6a714095a9ec34"
@hkparker
hkparker / xo-Dockerfile
Created July 24, 2016 20:43
Dockerfile for Xen Orchestra
FROM node:6-wheezy@sha256:5eb189fa5041cb692146d3212593ef965e8adf58f48a2bfc738fa30bb7f5045f
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install build-essential libpng-dev git python-minimal -y
RUN git clone -b stable http://github.com/vatesfr/xo-server /opt/xo-server && \
git clone -b stable http://github.com/vatesfr/xo-web /opt/xo-web
RUN cd /opt/xo-server && npm install && npm run build && \
@hkparker
hkparker / parse_vif.go
Last active June 5, 2016 21:22
Setup xen vif bridges at boot for IDS
package main
import (
"bufio"
"fmt"
"os/exec"
"regexp"
"strings"
)
-----BEGIN PGP MESSAGE-----
owF1UmtMFUcUBnxRBLWNQRG0sBepIo+dndkXjwoUryaEgAm1gWpgdnf23uXCvbgX
qJRHScValRZKq8X6aAtFHqkBFFNFrK2mKgJGJYC28QeNkVBpUoS02tDYXUIT2qTz
YzJzzne+c75zTq3fAg9vT8vZz6asTckpnn3jkseOKc+kUkpyKSVUTCkl52nEWWi+
nDifUDGUg5RI2E2iNFew06WQqFx38BwmgiomultzOQ0UHcVHiVR5hAk3g1XNaSN6
ga6ZXBQWFCLyNFKgqtKqKImCKPOKpDBQgiJWIeIwixCSDEq7y134r6zULGe2phhW
BiZBMdFq4BNNfJLhK5p18EhAtIoQBgBxNC3wHMAMlEUIJRGqQDSBbqLPSbI7CrDu
ILpZbz7RHXkkW3e5ZkXLhZoJAYg1ODgAaaMi7LYbQZAjqqxgGiBGIVgWkcoiFvMq
z/KsLMsASSyWFE4EIpB5SABRkCBCnqFpFQBG4jgaKwygFSLRgkR4RVYBJ0u8pLAK
@hkparker
hkparker / progress.go
Created December 7, 2015 07:50
progress output for cli go applications
func PrintProgress(completed_files, statuses, finished chan string) {
last_status := ""
last_len := 0
for {
select {
case completed_file := <-completed_files:
fmt.Printf("\r")
line := "completed: " + completed_file
fmt.Print(line)
print_len := len(line)