Skip to content

Instantly share code, notes, and snippets.

View zeddee's full-sized avatar

Zed zeddee

View GitHub Profile
@zeddee
zeddee / main.go
Created January 6, 2018 16:42 — forked from julz/main.go
containersched minicontainer
package main
import (
"fmt"
"os"
"os/exec"
"syscall"
)
func main() {
@zeddee
zeddee / traverse_node.go
Created January 20, 2018 21:01 — forked from xeoncross/traverse_node.go
Simple DOM node traversal in golang using a very useful collector/matcher function
package main
import (
"bytes"
"fmt"
"io"
"strings"
"unicode"
"golang.org/x/net/html"
if [ "$1" == "" ]; then
echo 'Please specify one build target.\n e.g. ./adoc_build.sh index.adoc'
exit 1
fi
echo "Building $1"
asciidoctor $1 &&\
asciidoctor-pdf $1
package main // import "github.com/docker/docker/pkg/namesgenerator"
import (
"fmt"
"math/rand"
)
var (
left = [...]string{
"admiring",

Git Submodules

Here be dragons

In Chuck Palahniuk's words, "You must jump into disaster with both feet." Git submodules are generally avoided because:

  1. They tend to be poorly understood, and
  2. It's hard to keep track one repository, let alone several that have to sync into one master project.

But here we are.

<!doctype html>
<html>
<head>
<style type='text/css'>
.box {
width:200px;
height:200px;
text-align:center;
box-sizing:border-box;
padding:20px;

How to load tsvs into pandas

Load tsvs by specifying \s+ as a separator (sep=<seperator>) value when calling `pd.read_csv'.

If your tsv contains values with spaces, then use \s\s+ instead.

import pandas as pd
w = pd.read_csv('./weather.dat',sep='\s+',index_col=0)
@zeddee
zeddee / tweet_listener.py
Last active August 3, 2018 21:55 — forked from hugobowne/tweet_listener.py
Here I define a Tweet listener that creates a file called 'tweets.txt', collects streaming tweets as .jsons and writes them to the file 'tweets.txt'; once 100 tweets have been streamed, the listener closes the file and stops listening.
# forked from hugobowne/tweet_listener.py
class MyStreamListener(tweepy.StreamListener):
"""
Inheriting tweepy.StreamListener object class
Appears like we're doing this to add the
self.num_tweets and self.file attributes
to the initialization operator.
""""
def __init__(self, api=None):
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
)
package main
import (
"encoding/json"
"io/ioutil"
"log"
"net/http"
"github.com/gorilla/mux"
)