Skip to content

Instantly share code, notes, and snippets.

View aeppert's full-sized avatar

Aaron Eppert aeppert

View GitHub Profile
@aeppert
aeppert / poll_load_average.go
Last active July 5, 2017 17:22
Periodic polling of load average and check for an increase
package main
import (
"fmt"
"time"
"github.com/shirou/gopsutil/load"
)
var currentLoad *load.AvgStat
@aeppert
aeppert / dockertags.sh
Created May 22, 2017 14:11
List docker tags
#!/bin/bash
#
# Original: https://stackoverflow.com/questions/28320134/how-to-list-all-tags-for-a-docker-image-on-a-remote-registry
#
if [ $# -lt 1 ]
then
cat << HELP
dockertags -- list all tags for a Docker image on a remote registry.
@aeppert
aeppert / hl7sniff.rb
Created February 16, 2017 15:22 — forked from sween/hl7sniff.rb
# Ron Sweeney
# Dev Arboretum
# Original Post: http://www.clubpacswestmi.net/articles/2007/4/1/a-ruby-hl7-sniffer
require 'pcap'
require 'Ethernet'
require 'rubygems'
require 'ruby-hl7'
@aeppert
aeppert / pcap_count_packets.go
Created February 10, 2017 22:24
Count Packets in a PCAP
package main
import (
"flag"
"fmt"
"github.com/google/gopacket"
"github.com/google/gopacket/pcap"
"log"
)
@aeppert
aeppert / README.md
Created February 10, 2017 15:55 — forked from grigorescu/README.md
breakpoint_to_pcap

breakpoint_to_pcap

Overview

Given an input PCAP and a location in a Bro script, this script will filter the PCAP into a new file, which contains only the connections that visited that script location. This script can help filter a large PCAP to narrow down problematic connections, such as protocol violations, weirds, etc.

Example

@aeppert
aeppert / movefile.go
Created February 10, 2017 01:53
Golang move file using os.Rename method
package main
import (
"fmt"
"os"
)
func main() {
err := os.Rename("/dir1/file1", "/dir2/file2")
#include <sstream>
#include <iostream>
#include <numeric>
#include <string>
#include <iostream>
std::string &righttrim(std::string &s) {
s.erase(std::find_if(s.rbegin(), s.rend(),
std::not1(std::ptr_fun<int, int>(std::isspace))).base(), s.end());
return s;
package main
import (
"crypto/tls"
"crypto/x509"
"flag"
"fmt"
"io/ioutil"
"log"
"net/http"
@aeppert
aeppert / durationdiff.go
Created January 12, 2017 21:14
Return the time.Time between passed in time and duration string (m,h,s, etc.)
package main
import (
"fmt"
"time"
)
func getDurationDiff(t time.Time, duration string) (time.Time, error) {
dur, err := time.ParseDuration(fmt.Sprintf("-%s", duration))
if err != nil {
return time.Now(), err
#!/bin/bash
start() {
echo "Starting"
}
stop() {
echo "Stopping"
}