Skip to content

Instantly share code, notes, and snippets.

@tetheredge
tetheredge / nvd_update.go
Created June 23, 2016 01:56
nvd_update_code
package main
import (
"fmt"
_ "github.com/go-sql-driver/mysql"
"io"
"log"
"net/http"
"os"
"time"
@tetheredge
tetheredge / nvd_full.go
Last active June 21, 2016 22:54
nvd_full_code
func SetupDb(user, password, host, dbName string) (*sql.DB, error) {
if host == "locahost" || host == "127.0.0.1" {
host = ""
}
d, err := sql.Open("mysql", user+":"+password+"@tcp("+host+":3306)/"+dbName)
if err != nil {
return nil, err
}
return d, nil
type Nvd struct {
Title string `xml:"nvd"`
}
type Entry struct {
XMLName xml.Name `xml:"entry"`
Type string `xml:"type,attr"`
Name string `xml:"name,attr"`
Sequence string `xml:"seq,attr"`
Published string `xml:"published,attr"`
@tetheredge
tetheredge / subcommand.go
Last active February 19, 2016 02:43 — forked from iamralch/subcommand.go
flag package: subcommand example
package main
import (
"flag"
"fmt"
"os"
)
func main() {
askCommand := flag.NewFlagSet("ask", flag.ExitOnError)

Docker Container/Image Basics

This is a basic step by step intro to working with Docker containers and Images. You should be able to follow along with your installation of docker, but be sure to change IDs/naming schemes according to your use case.

The goal of this exercise is to create a base image from the ubuntu base image that has both the jre and htop installed.

Start up an ubuntu container to modify, install htop, then exit.

docker run -t -i ubuntu /bin/bash

Get the ID of the container you just modified.

Building a new Base Image

Practical documentation on how to create a new base image.

Pick a Base Image to work on.

First we'll want to identify what image we are going to use as our base image to modify is.

In this example our previous base image is old-oca-bastion.

Define a Goal

We have been tasked with doing the following:

Migrating Docker Storage....

Stop Docker Service

rdocker-cli.rb restart_docker_service IP

Copy all the things!

### Keybase proof
I hereby claim:
* I am tetheredge on github.
* I am tetheredge (https://keybase.io/tetheredge) on keybase.
* I have a public key whose fingerprint is 2B03 2BC9 CC44 7BF9 EE83 64CB C03E FDA1 F1B6 FABB
To claim this, I am signing this object:
require 'minitest/mock'
require 'minitest/unit'
require 'date'
MiniTest::Unit.autorun
class TestMailPurge < MiniTest::Unit::TestCase
class MailPurge
def initialize(imap)
@imap = imap
// includes bindings for fetching/fetched
var PaginatedCollection = Backbone.Collection.extend({
initialize: function() {
_.bindAll(this, 'parse', 'url', 'pageInfo', 'nextPage', 'previousPage');
typeof(options) != 'undefined' || (options = {});
this.page = 1;
typeof(this.perPage) != 'undefined' || (this.perPage = 10);
},
fetch: function(options) {